Author: dmeyer
Date: Wed Feb 13 16:58:56 2008
New Revision: 3090
Log:
rename YieldContinue to NotFinished
Modified:
trunk/base/API_CHANGES.txt
trunk/base/src/notifier/__init__.py
trunk/base/src/notifier/coroutine.py
trunk/base/test/async_lock.py
trunk/base/test/asynctest.py
trunk/beacon/src/db.py
trunk/beacon/src/query.py
trunk/beacon/src/server/cpuinfo.py
trunk/beacon/src/server/crawl.py
trunk/beacon/src/server/monitor.py
trunk/epg/src/client.py
Modified: trunk/base/API_CHANGES.txt
==============================================================================
--- trunk/base/API_CHANGES.txt (original)
+++ trunk/base/API_CHANGES.txt Wed Feb 13 16:58:56 2008
@@ -68,3 +68,5 @@
3. SocketDispatcher and WeakSocketDispatcher are renamed to IOMonitor
and WeakIOMonitor.
+
+4. Rename YieldContinue to NotFinished
Modified: trunk/base/src/notifier/__init__.py
==============================================================================
--- trunk/base/src/notifier/__init__.py (original)
+++ trunk/base/src/notifier/__init__.py Wed Feb 13 16:58:56 2008
@@ -56,7 +56,7 @@
from event import Event, EventHandler, WeakEventHandler
# coroutine decorator and helper classes
-from coroutine import YieldContinue, YieldCallback, YieldFunction, coroutine
+from coroutine import NotFinished, YieldCallback, YieldFunction, coroutine
# process management
from popen import Process
Modified: trunk/base/src/notifier/coroutine.py
==============================================================================
--- trunk/base/src/notifier/coroutine.py (original)
+++ trunk/base/src/notifier/coroutine.py Wed Feb 13 16:58:56 2008
@@ -16,7 +16,7 @@
#
# A function decorated with 'coroutine' can't use 'return' to return the
# result of the function call. Instead it has to use yield to do this. Besides
-# a normal return, the function can also return 'YieldContinue' in the yield
+# a normal return, the function can also return 'NotFinished' in the yield
# statement. In that case, the function call continues at this point in the
# next notifier iteration. If the function itself has to wait for a result of
# a function call (either another yield function are something else working
@@ -56,7 +56,7 @@
#
# -----------------------------------------------------------------------------
-__all__ = [ 'YieldContinue', 'YieldCallback', 'coroutine', 'YieldFunction' ]
+__all__ = [ 'NotFinished', 'YieldCallback', 'coroutine', 'YieldFunction' ]
# python imports
import sys
@@ -67,7 +67,7 @@
from async import InProgress
# object to signal that the function whats to continue
-YieldContinue = object()
+NotFinished = object()
class YieldCallback(InProgress):
@@ -136,7 +136,7 @@
def coroutine(interval = 0, synchronize = False):
"""
Functions with this decorator uses yield to break and to return the
- results. Special yield values for break are YieldContinue or
+ results. Special yield values for break are NotFinished or
InProgress objects. If synchronize is True the function will
be protected against parallel calls, which can be used avoid
multithreading pitfalls such as deadlocks or race conditions.
@@ -172,11 +172,11 @@
# InProgress return that is already finished, go on
async = result
continue
- elif result != YieldContinue:
+ elif result != NotFinished:
# everything went fine, return result
return _wrap_result(result)
# we need a YieldFunction to finish this later
- # result is either YieldContinue or InProgress
+ # result is either NotFinished or InProgress
progress = YieldFunction(function, interval, result)
if synchronize:
func._lock = progress
@@ -199,7 +199,7 @@
"""
InProgress class that runs a generator function. This is also the return
value
for coroutine if it takes some more time. progress can be either None
- (not started yet), YieldContinue (iterate now) or InProgress (wait until
+ (not started yet), NotFinished (iterate now) or InProgress (wait until
InProgress is done).
"""
def __init__(self, function, interval, progress=None):
@@ -213,8 +213,8 @@
# No progress from coroutine, this means that the YieldFunction
# was created from the outside and the creator must call this
object
self._valid = False
- elif progress == YieldContinue:
- # coroutine was stopped YieldContinue, start the step timer
+ elif progress == NotFinished:
+ # coroutine was stopped NotFinished, start the step timer
self._timer.start(interval)
elif isinstance(progress, InProgress):
# continue when InProgress is done
@@ -256,7 +256,7 @@
# the result is a finished InProgress object
self._async = result
continue
- if result == YieldContinue:
+ if result == NotFinished:
# schedule next interation with the timer
return True
# YieldFunction is done with result
Modified: trunk/base/test/async_lock.py
==============================================================================
--- trunk/base/test/async_lock.py (original)
+++ trunk/base/test/async_lock.py Wed Feb 13 16:58:56 2008
@@ -3,11 +3,11 @@
@kaa.coroutine(synchronize = True)
def f(x):
print 'in', x
- yield kaa.YieldContinue
+ yield kaa.NotFinished
print 'work1', x
- yield kaa.YieldContinue
+ yield kaa.NotFinished
print 'work2', x
- yield kaa.YieldContinue
+ yield kaa.NotFinished
print 'out', x
f(1)
Modified: trunk/base/test/asynctest.py
==============================================================================
--- trunk/base/test/asynctest.py (original)
+++ trunk/base/test/asynctest.py Wed Feb 13 16:58:56 2008
@@ -21,12 +21,12 @@
@kaa.rpc.expose('test3')
@kaa.coroutine()
def test3(self, x):
- yield kaa.YieldContinue
+ yield kaa.NotFinished
yield x
@kaa.coroutine()
def _test4(self, x):
- yield kaa.YieldContinue
+ yield kaa.NotFinished
yield x
@kaa.rpc.expose('test4')
@@ -67,7 +67,7 @@
@kaa.coroutine()
def subyield():
print 3
- yield kaa.YieldContinue
+ yield kaa.NotFinished
print 4
yield 5
@@ -102,7 +102,7 @@
print 6
# just break here and return again in the next mainloop iteration
- yield kaa.YieldContinue
+ yield kaa.NotFinished
# call some async function with different types of
# results (given as parameter)
Modified: trunk/beacon/src/db.py
==============================================================================
--- trunk/beacon/src/db.py (original)
+++ trunk/beacon/src/db.py Wed Feb 13 16:58:56 2008
@@ -350,10 +350,10 @@
else:
items.append(create_by_type(i, parent))
if time.time() > timer + 0.1:
- # we used too much time. Call yield YieldContinue at
+ # we used too much time. Call yield NotFinished at
# this point to continue later.
timer = time.time()
- yield kaa.YieldContinue
+ yield kaa.NotFinished
# sort items based on name. The listdir is also sorted by name,
# that makes checking much faster
@@ -445,10 +445,10 @@
counter += 1
if not counter % 50 and time.time() > timer + 0.05:
- # We used too much time. Call yield YieldContinue at
+ # We used too much time. Call yield NotFinished at
# this point to continue later.
timer = time.time()
- yield kaa.YieldContinue
+ yield kaa.NotFinished
if not 'keywords' in query:
# sort results by url (name is not unique) and return
Modified: trunk/beacon/src/query.py
==============================================================================
--- trunk/beacon/src/query.py (original)
+++ trunk/beacon/src/query.py Wed Feb 13 16:58:56 2008
@@ -79,7 +79,7 @@
self._client = client
# some shortcuts from the client
self._rpc = self._client.rpc
- # InProgress object or YieldContinue
+ # InProgress object or NotFinished
self._async = kaa.InProgress()
# start inititial query
self._beacon_start_query(query)
@@ -92,7 +92,7 @@
def wait(self):
"""
- Return InProgress object or YieldContinue when the object is valid.
+ Return InProgress object or NotFinished when the object is valid.
"""
return self._async
@@ -222,7 +222,7 @@
self.signals['changed'].emit()
if isinstance(self._async, kaa.InProgress):
self._async.finished(self)
- self._async = kaa.YieldContinue
+ self._async = kaa.NotFinished
def __repr__(self):
Modified: trunk/beacon/src/server/cpuinfo.py
==============================================================================
--- trunk/beacon/src/server/cpuinfo.py (original)
+++ trunk/beacon/src/server/cpuinfo.py Wed Feb 13 16:58:56 2008
@@ -144,7 +144,7 @@
def add_load():
x = 0
for i in range(300000):
- yield kaa.YieldContinue
+ yield kaa.NotFinished
print "Done load generation"
add_load()
Modified: trunk/beacon/src/server/crawl.py
==============================================================================
--- trunk/beacon/src/server/crawl.py (original)
+++ trunk/beacon/src/server/crawl.py Wed Feb 13 16:58:56 2008
@@ -498,10 +498,10 @@
counter += async * 20
while counter >= 20:
counter -= 20
- yield kaa.YieldContinue
+ yield kaa.NotFinished
if cpuinfo.cpuinfo()[cpuinfo.IDLE] < 50 or \
cpuinfo.cpuinfo()[cpuinfo.IOWAIT] > 30:
- yield kaa.YieldContinue
+ yield kaa.NotFinished
counter += 1
if not subdirs:
Modified: trunk/beacon/src/server/monitor.py
==============================================================================
--- trunk/beacon/src/server/monitor.py (original)
+++ trunk/beacon/src/server/monitor.py Wed Feb 13 16:58:56 2008
@@ -36,7 +36,7 @@
# kaa imports
import kaa
from kaa.weakref import weakref
-from kaa import OneShotTimer, Timer, YieldContinue
+from kaa import OneShotTimer, Timer, NotFinished
# kaa.beacon imports
from kaa.beacon.item import Item
@@ -219,7 +219,7 @@
c += 1
if c > 20:
# stop it and continue in the next step
- yield YieldContinue
+ yield NotFinished
# TODO: maybe also check parents?
mtime = i._beacon_mtime()
if mtime != i._beacon_data.get('mtime'):
Modified: trunk/epg/src/client.py
==============================================================================
--- trunk/epg/src/client.py (original)
+++ trunk/epg/src/client.py Wed Feb 13 16:58:56 2008
@@ -50,7 +50,7 @@
def wait_while_connecting():
"""
Decorator that wraps kaa.coroutine, raising an exception if
- the client is disconnected, YieldContinue if the client is in the process
+ the client is disconnected, NotFinished if the client is in the process
of connecting, or the actual return value of the decorated function if the
client is connected.
"""
@@ -59,7 +59,7 @@
if client.status == DISCONNECTED:
raise SystemError('Client is disconnected')
while client.status == CONNECTING:
- yield kaa.YieldContinue
+ yield kaa.NotFinished
yield func(client, *args, **kwargs)
newfunc.func_name = func.func_name
@@ -158,7 +158,7 @@
raise SystemError('Client is disconnected')
while self.status == CONNECTING:
- yield kaa.YieldContinue
+ yield kaa.NotFinished
if channel is not None:
if isinstance(channel, Channel):
-------------------------------------------------------------------------
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