MCPcopy
hub / github.com/encode/uvicorn / asyncio_run

Function asyncio_run

uvicorn/_compat.py:21–30  ·  view source on GitHub ↗
(
        main: Coroutine[Any, Any, _T],
        *,
        debug: bool = False,
        loop_factory: Callable[[], asyncio.AbstractEventLoop] | None = None,
    )

Source from the content-addressed store, hash-verified

19elif sys.version_info >= (3, 11):
20
21 def asyncio_run(
22 main: Coroutine[Any, Any, _T],
23 *,
24 debug: bool = False,
25 loop_factory: Callable[[], asyncio.AbstractEventLoop] | None = None,
26 ) -> _T:
27 # asyncio.run from Python 3.12
28 # https://docs.python.org/3/license.html#psf-license
29 with asyncio.Runner(debug=debug, loop_factory=loop_factory) as runner:
30 return runner.run(main)
31
32else:
33 # modified version of asyncio.run from Python 3.10 to add loop_factory kwarg

Calls 3

_cancel_all_tasksFunction · 0.85
runMethod · 0.45
closeMethod · 0.45