MCPcopy
hub / github.com/tornadoweb/tornado / _wrap_awaitable

Function _wrap_awaitable

tornado/gen.py:859–869  ·  view source on GitHub ↗
(awaitable: Awaitable)

Source from the content-addressed store, hash-verified

857
858
859def _wrap_awaitable(awaitable: Awaitable) -> Future:
860 # Convert Awaitables into Futures.
861 # Note that we use ensure_future, which handles both awaitables
862 # and coroutines, rather than create_task, which only accepts
863 # coroutines. (ensure_future calls create_task if given a coroutine)
864 fut = asyncio.ensure_future(awaitable)
865 # See comments on IOLoop._pending_tasks.
866 loop = IOLoop.current()
867 loop._register_task(fut)
868 fut.add_done_callback(lambda f: loop._unregister_task(f))
869 return fut
870
871
872def convert_yielded(yielded: _Yieldable) -> Future:

Callers 1

convert_yieldedFunction · 0.85

Calls 3

currentMethod · 0.80
_register_taskMethod · 0.80
_unregister_taskMethod · 0.80

Tested by

no test coverage detected