Author: dmeyer
Date: Wed Feb 13 15:40:47 2008
New Revision: 3083
Log:
doc update, remove deprecated code
Modified:
trunk/base/API_CHANGES.txt
trunk/base/src/__init__.py
trunk/base/src/notifier/__init__.py
trunk/base/src/notifier/async.py
trunk/base/src/notifier/coroutine.py
Modified: trunk/base/API_CHANGES.txt
==============================================================================
--- trunk/base/API_CHANGES.txt (original)
+++ trunk/base/API_CHANGES.txt Wed Feb 13 15:40:47 2008
@@ -62,11 +62,9 @@
@kaa.execute_in_mainloop --> @kaa.threaded(kaa.MAINTHREAD)
@kaa.yield_execution --> @kaa.coroutine
- Currently the old names are still functional but a warning will be
- logged if they are used. @kaa.timed also changed the parameter
- order and name. It is now interval, timer (default Timer) and
- policy (default POLICY_RESTART).
+ @kaa.timed also changed the parameter order and name. It is now
+ interval, timer (default Timer) and policy (default
+ POLICY_RESTART).
3. SocketDispatcher and WeakSocketDispatcher are renamed to IOMonitor
- and WeakIOMonitor. The old name is still functional with a
- warning.
+ and WeakIOMonitor.
Modified: trunk/base/src/__init__.py
==============================================================================
--- trunk/base/src/__init__.py (original)
+++ trunk/base/src/__init__.py Wed Feb 13 15:40:47 2008
@@ -5,7 +5,7 @@
# $Id$
#
# -----------------------------------------------------------------------------
-# Copyright (C) 2005,2006 Dirk Meyer, Jason Tackaberry
+# Copyright (C) 2005-2008 Dirk Meyer, Jason Tackaberry
#
# Please see the file AUTHORS for a complete list of authors.
#
@@ -28,13 +28,14 @@
# import logger to update the Python logging module
import logger
-# import notifier functions into kaa namespace
+# Import notifier functions into kaa namespace. The list of all classes,
functions
+# and decorators can be found in notifier/__init__.py
from kaa.notifier import *
-# import the two important strutils functions
+# Import the two important strutils functions
from strutils import str_to_unicode, unicode_to_str
-# tempfile support.
+# Add tempfile support.
from tmpfile import tempfile
# Expose main loop functions under kaa.main
Modified: trunk/base/src/notifier/__init__.py
==============================================================================
--- trunk/base/src/notifier/__init__.py (original)
+++ trunk/base/src/notifier/__init__.py Wed Feb 13 15:40:47 2008
@@ -30,42 +30,33 @@
#
# -----------------------------------------------------------------------------
-from popen import Process
+# Import all classes, functions and decorators that are part of the API
+
+# Callback classes
from callback import Callback, WeakCallback
+
+# Signal and dict of Signals
from signals import Signal, Signals
-from thread import MainThreadCallback, NamedThreadCallback, ThreadCallback,
is_mainthread, threaded, MAINTHREAD
-from timer import Timer, WeakTimer, OneShotTimer, WeakOneShotTimer, AtTimer,
OneShotAtTimer, timed, POLICY_ONCE, POLICY_MANY, POLICY_RESTART
+
+# InProgress class
+from async import InProgress
+
+# Thread callbacks, helper functions and decorators
+from thread import MainThreadCallback, NamedThreadCallback, ThreadCallback, \
+ is_mainthread, threaded, MAINTHREAD
+
+# Timer classes and decorators
+from timer import Timer, WeakTimer, OneShotTimer, WeakOneShotTimer, AtTimer, \
+ OneShotAtTimer, timed, POLICY_ONCE, POLICY_MANY, POLICY_RESTART
+
+# IO/Socket handling
from sockets import IOMonitor, WeakIOMonitor, Socket, IO_READ, IO_WRITE
+
+# Event and event handler classes
from event import Event, EventHandler, WeakEventHandler
-from coroutine import YieldContinue, YieldCallback, YieldFunction, coroutine
-from async import InProgress
+# coroutine decorator and helper classes
+from coroutine import YieldContinue, YieldCallback, YieldFunction, coroutine
-# XXX: wrappers for deprecated (renamed) decorators. Everything below
-# this comment can be removed once support for deprecated names is
-# removed.
-import logging
-log = logging.getLogger('notifier')
-
-def execute_in_mainloop(async=False):
- log.warning('Decorator @kaa.execute_in_mainloop deprecated; use
@kaa.threaded(kaa.MAINTHREAD)');
- return threaded(MAINTHREAD, async=async)
-
-def execute_in_timer(timer, interval, type=''):
- log.warning('Decorator @kaa.execute_in_timer deprecated; use @kaa.timed');
- if not type:
- type = POLICY_MANY
- if type == 'override':
- type = POLICY_RESTART
- return timed(interval, timer, type)
-
-def wrap(func, old_name, new_name):
- def decorator(*args, **kwargs):
- log.warning('Decorator @kaa.%s deprecated; use @kaa.%s' % (old_name,
new_name))
- return func(*args, **kwargs)
- return decorator
-
-execute_in_thread=wrap(threaded, 'execute_in_thread', 'threaded')
-yield_execution=wrap(coroutine, 'yield_execution', 'coroutine')
-SocketDispatcher=wrap(IOMonitor, 'SocketDispatcher', 'IOMonitor')
-WeakSocketDispatcher=wrap(IOMonitor, 'WeakSocketDispatcher', 'WeakIOMonitor')
+# process management
+from popen import Process
Modified: trunk/base/src/notifier/async.py
==============================================================================
--- trunk/base/src/notifier/async.py (original)
+++ trunk/base/src/notifier/async.py Wed Feb 13 15:40:47 2008
@@ -246,16 +246,6 @@
log.error('Unhandled %s exception:\n%s', cls.__name__, trace)
- def __call__(self, *args, **kwargs):
- """
- You can call the InProgress object to get the results when finished.
- The function will either return the result or raise the exception
- provided to the exception function.
- """
- log.warning('Deprecated call to InProgress(); use get_result()
instead')
- return self.get_result()
-
-
def is_finished(self):
"""
Return if the InProgress is finished.
Modified: trunk/base/src/notifier/coroutine.py
==============================================================================
--- trunk/base/src/notifier/coroutine.py (original)
+++ trunk/base/src/notifier/coroutine.py Wed Feb 13 15:40:47 2008
@@ -238,15 +238,13 @@
Call the YieldFunction to start it if it was not created by
coroutine.
"""
- if not self._valid:
- # The generator was not started yet
- self._valid = True
- self._yield__function = self._yield__function(*args, **kwargs)
- self._continue()
- return True
- # return the result
- log.warning('Deprecated call to InProgress(); use get_result()
instead')
- return InProgress.get_result(self)
+ if self._valid:
+ raise RuntimeError('YieldFunction already running')
+ # The generator was not started yet
+ self._valid = True
+ self._yield__function = self._yield__function(*args, **kwargs)
+ self._continue()
+ return True
def _continue(self, *args, **kwargs):
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Freevo-cvslog mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog