Made more things inherit from object in api, cleaned up some doc bugs.
This commit is contained in:
@@ -308,20 +308,28 @@ call_after = call_after_local
|
|||||||
class _SilentException:
|
class _SilentException:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
class FakeTimer:
|
class FakeTimer(object):
|
||||||
|
|
||||||
def cancel(self):
|
def cancel(self):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
class timeout:
|
class timeout(object):
|
||||||
"""Raise an exception in the block after timeout.
|
"""Raise an exception in the block after timeout.
|
||||||
|
|
||||||
|
Example::
|
||||||
|
|
||||||
with timeout(seconds[, exc]):
|
with timeout(10):
|
||||||
... code block ...
|
urllib2.open('http://example.com')
|
||||||
|
|
||||||
Assuming code block is yielding (i.e. gives up control to the hub),
|
Assuming code block is yielding (i.e. gives up control to the hub),
|
||||||
an exception provided in `exc' argument will be raised
|
an exception provided in 'exc' argument will be raised
|
||||||
(TimeoutError if `exc' is omitted).
|
(TimeoutError if 'exc' is omitted)::
|
||||||
|
|
||||||
|
try:
|
||||||
|
with timeout(10, MySpecialError, error_arg_1):
|
||||||
|
urllib2.open('http://example.com')
|
||||||
|
except MySpecialError, e:
|
||||||
|
print "special error received"
|
||||||
|
|
||||||
|
|
||||||
When exc is None, code block is interrupted silently.
|
When exc is None, code block is interrupted silently.
|
||||||
"""
|
"""
|
||||||
@@ -498,7 +506,6 @@ def sleep(seconds=0):
|
|||||||
getcurrent = greenlet.getcurrent
|
getcurrent = greenlet.getcurrent
|
||||||
GreenletExit = greenlet.GreenletExit
|
GreenletExit = greenlet.GreenletExit
|
||||||
|
|
||||||
|
|
||||||
class Spew(object):
|
class Spew(object):
|
||||||
"""
|
"""
|
||||||
"""
|
"""
|
||||||
|
Reference in New Issue
Block a user