asyncio.Future.exception()

exception() Return the exception that was set on this future. The exception (or None if no exception was set) is returned only if the future is done. If the future has been cancelled, raises CancelledError. If the future isn’t done yet, raises InvalidStateError.

asyncio.Future.cancelled()

cancelled() Return True if the future was cancelled.

asyncio.Future.cancel()

cancel() Cancel the future and schedule callbacks. If the future is already done or cancelled, return False. Otherwise, change the future’s state to cancelled, schedule the callbacks and return True.

asyncio.Future

class asyncio.Future(*, loop=None) This class is almost compatible with concurrent.futures.Future. Differences: result() and exception() do not take a timeout argument and raise an exception when the future isn’t done yet. Callbacks registered with add_done_callback() are always called via the event loop’s call_soon_threadsafe(). This class is not compatible with the wait() and as_completed() functions in the concurrent.futures package. This class is not thread safe. cancel() Cancel th

asyncio.Future.done()

done() Return True if the future is done. Done means either that a result / exception are available, or that the future was cancelled.

asyncio.Event.wait()

coroutine wait() Block until the internal flag is true. If the internal flag is true on entry, return True immediately. Otherwise, block until another coroutine calls set() to set the flag to true, then return True. This method is a coroutine.

asyncio.Event.clear()

clear() Reset the internal flag to false. Subsequently, coroutines calling wait() will block until set() is called to set the internal flag to true again.

asyncio.Event.set()

set() Set the internal flag to true. All coroutines waiting for it to become true are awakened. Coroutine that call wait() once the flag is true will not block at all.

asyncio.Event.is_set()

is_set() Return True if and only if the internal flag is true.

asyncio.ensure_future()

asyncio.ensure_future(coro_or_future, *, loop=None) Schedule the execution of a coroutine object: wrap it in a future. Return a Task object. If the argument is a Future, it is returned directly. New in version 3.4.4. Changed in version 3.5.1: The function accepts any awaitable object. See also The AbstractEventLoop.create_task() method.