• Home
  • Raw
  • Download

Lines Matching refs:Future

10 *Future* objects are used to bridge **low-level callback-based code**
14 Future Functions
21 * an instance of :class:`asyncio.Future`,
23 * a Future-like object with a ``_asyncio_future_blocking``
33 * *obj* argument as is, if *obj* is a :class:`Future`,
34 a :class:`Task`, or a Future-like object (:func:`isfuture`
56 Wrap a :class:`concurrent.futures.Future` object in a
57 :class:`asyncio.Future` object.
60 Future Object
63 .. class:: Future(\*, loop=None)
65 A Future represents an eventual result of an asynchronous
68 Future is an :term:`awaitable` object. Coroutines can await on
69 Future objects until they either have a result or an exception
77 The rule of thumb is to never expose Future objects in user-facing
78 APIs, and the recommended way to create a Future object is to call
81 of a Future object.
88 Return the result of the Future.
90 If the Future is *done* and has a result set by the
93 If the Future is *done* and has an exception set by the
96 If the Future has been *cancelled*, this method raises
99 If the Future's result isn't yet available, this method raises
104 Mark the Future as *done* and set its result.
106 Raises a :exc:`InvalidStateError` error if the Future is
111 Mark the Future as *done* and set an exception.
113 Raises a :exc:`InvalidStateError` error if the Future is
118 Return ``True`` if the Future is *done*.
120 A Future is *done* if it was *cancelled* or if it has a result
126 Return ``True`` if the Future was *cancelled*.
128 The method is usually used to check if a Future is not
136 Add a callback to be run when the Future is *done*.
138 The *callback* is called with the Future object as its only
141 If the Future is already *done* when this method is called,
151 # Call 'print("Future:", fut)' when "fut" is done.
153 functools.partial(print, "Future:"))
168 Cancel the Future and schedule callbacks.
170 If the Future is already *done* or *cancelled*, return ``False``.
171 Otherwise, change the Future's state to *cancelled*,
176 Return the exception that was set on this Future.
179 returned only if the Future is *done*.
181 If the Future has been *cancelled*, this method raises a
184 If the Future isn't *done* yet, this method raises an
189 Return the event loop the Future object is bound to.
196 This example creates a Future object, creates and schedules an
197 asynchronous Task to set result for the Future, and waits until
198 the Future has a result::
204 # Set *value* as a result of *fut* Future.
211 # Create a new Future object.
231 The Future object was designed to mimic
232 :class:`concurrent.futures.Future`. Key differences include:
234 - unlike asyncio Futures, :class:`concurrent.futures.Future`
237 - :meth:`asyncio.Future.result` and :meth:`asyncio.Future.exception`
240 - :meth:`asyncio.Future.result` and :meth:`asyncio.Future.exception`
241 raise an :exc:`InvalidStateError` exception when the Future is not
244 - Callbacks registered with :meth:`asyncio.Future.add_done_callback`
248 - asyncio Future is not compatible with the