(
main: Coroutine[Any, Any, _T],
*,
debug: bool = False,
loop_factory: Callable[[], asyncio.AbstractEventLoop] | None = None,
)
| 19 | elif 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 | |
| 32 | else: |
| 33 | # modified version of asyncio.run from Python 3.10 to add loop_factory kwarg |