Made more things inherit from object in api, cleaned up some doc bugs.

This commit is contained in:
Ryan Williams
2009-07-14 00:19:01 -07:00
parent 261f527bef
commit ef137327f8

View File

@@ -308,20 +308,28 @@ call_after = call_after_local
class _SilentException:
pass
class FakeTimer:
class FakeTimer(object):
def cancel(self):
pass
class timeout:
class timeout(object):
"""Raise an exception in the block after timeout.
Example::
with timeout(seconds[, exc]):
... code block ...
with timeout(10):
urllib2.open('http://example.com')
Assuming code block is yielding (i.e. gives up control to the hub),
an exception provided in `exc' argument will be raised
(TimeoutError if `exc' is omitted).
an exception provided in 'exc' argument will be raised
(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.
"""
@@ -498,7 +506,6 @@ def sleep(seconds=0):
getcurrent = greenlet.getcurrent
GreenletExit = greenlet.GreenletExit
class Spew(object):
"""
"""