Lines Matching refs:fut

426 async def wait_for(fut, timeout):
442 return await fut
445 fut = ensure_future(fut, loop=loop)
447 if fut.done():
448 return fut.result()
450 await _cancel_and_wait(fut, loop=loop)
452 return fut.result()
460 fut = ensure_future(fut, loop=loop)
461 fut.add_done_callback(cb)
468 if fut.done():
469 return fut.result()
471 fut.remove_done_callback(cb)
475 await _cancel_and_wait(fut, loop=loop)
478 if fut.done():
479 return fut.result()
481 fut.remove_done_callback(cb)
485 await _cancel_and_wait(fut, loop=loop)
490 return fut.result()
541 async def _cancel_and_wait(fut, loop):
542 """Cancel the *fut* future or task and wait until it completes."""
546 fut.add_done_callback(cb)
549 fut.cancel()
550 # We cannot wait on *fut* directly to make
554 fut.remove_done_callback(cb)
754 def _done_callback(fut):
759 if not fut.cancelled():
761 fut.exception()
765 if fut.cancelled():
766 # Check if 'fut' is cancelled first, as
767 # 'fut.exception()' will *raise* a CancelledError
769 exc = fut._make_cancelled_error()
773 exc = fut.exception()
783 for fut in children:
784 if fut.cancelled():
785 # Check if 'fut' is cancelled first, as 'fut.exception()'
792 '' if fut._cancel_message is None else
793 fut._cancel_message)
795 res = fut.exception()
797 res = fut.result()
804 exc = fut._make_cancelled_error()
817 fut = _ensure_future(arg, loop=loop)
819 loop = futures._get_loop(fut)
820 if fut is not arg:
821 # 'arg' was not a Future, therefore, 'fut' is a new
825 fut._log_destroy_pending = False
828 arg_to_fut[arg] = fut
829 fut.add_done_callback(_done_callback)
833 fut = arg_to_fut[arg]
835 children.append(fut)