• Home
  • Raw
  • Download

Lines Matching full:future

1 """A Future class similar to the one in PEP 3148."""
4 'Future', 'wrap_future', 'isfuture',
30 class Future: class
31 """This class is *almost* compatible with concurrent.futures.Future.
38 raise an exception when the future isn't done yet.
61 # the Future protocol (i.e. is intended to be duck-type compatible).
66 # `await Future()` or`yield from Future()` (correct) vs.
67 # `yield Future()` (incorrect).
73 """Initialize the future.
76 loop object used by the future. If it's not provided, the future uses
101 'future': self,
120 """Return the event loop the Future is bound to."""
123 raise RuntimeError("Future object is not initialized.")
127 """Create the CancelledError to raise if the Future is cancelled.
147 """Cancel the future and schedule callbacks.
149 If the future is already done or cancelled, return False. Otherwise,
150 change the future's state to cancelled, schedule the callbacks and
176 """Return True if the future was cancelled."""
182 """Return True if the future is done.
185 future was cancelled.
190 """Return the result this future represents.
192 If the future has been cancelled, raises CancelledError. If the
193 future's result isn't yet available, raises InvalidStateError. If
194 the future is done and has an exception set, this exception is raised.
207 """Return the exception that was set on this future.
210 the future is done. If the future has been cancelled, raises
211 CancelledError. If the future isn't done yet, raises
223 """Add a callback to be run when the future becomes done.
225 The callback is called with a single argument - the future object. If
226 the future is already done when this is called, the callback is
254 """Mark the future done and set its result.
256 If the future is already done when this method is called, raises
266 """Mark the future done and set an exception.
268 If the future is already done when this method is called, raises
277 "and cannot be raised into a Future")
289 raise RuntimeError("await wasn't used with future")
296 _PyFuture = Future
300 # Tries to call Future.get_loop() if it's available.
312 """Helper setting the result only if the future was not cancelled."""
331 """Copy state from a future to a concurrent.futures.Future."""
346 """Internal helper to copy state from another Future.
348 The other Future may be a concurrent.futures.Future.
370 Compatible with both asyncio.Future and concurrent.futures.Future.
373 concurrent.futures.Future):
374 raise TypeError('A future is required for source argument')
376 concurrent.futures.Future):
377 raise TypeError('A future is required for destination argument')
381 def _set_state(future, other): argument
382 if isfuture(future):
383 _copy_future_state(other, future)
385 _set_concurrent_future_state(future, other)
409 def wrap_future(future, *, loop=None): argument
410 """Wrap concurrent.futures.Future object."""
411 if isfuture(future):
412 return future
413 assert isinstance(future, concurrent.futures.Future), \
414 f'concurrent.futures.Future is expected, got {future!r}'
418 _chain_future(future, new_future)
428 Future = _CFuture = _asyncio.Future variable