Reference¶
Contents:
-
class
async_patterns.Callbacks[source]¶ Accepts callables objects and stores them in a list, then calls them all when something interesting happens
-
class
async_patterns.CoroQueue(loop)[source]¶ A queue of coroutines to be called sequentially.
Parameters: loop – event loop -
join()[source]¶ Wait for all coroutines to finish. Await the underlying
asyncio.Queueobject’s join method.This method is a
coroutine.
-
-
class
async_patterns.CoroQueueClass(queue=None, loop=None)[source]¶ Provide a method wrapper that schedules execution of the wrapped function using a
CoroQueueobject.class Foo(CoroQueueClass): @CoroQueueClass.wrap async def a(self): await asyncio.sleep(1) async def test(loop): f = Foo() f._loop = loop await f.a() await f.close() loop.run_until_complete(test(loop))