e>SrSSKrSSKrSSKrSSKrSSKrSSKJr SSKJr SSKJ r SSKJ r SSKJ r "S S \R5r "S S 5rSSS .SjrSrg))RunnerrunN) coroutines)events) exceptions)tasks) constantsc \rSrSrSrSrSrSrg)_Statecreated initializedclosedN)__name__ __module__ __qualname____firstlineno__CREATED INITIALIZEDCLOSED__static_attributes__r5/opt/imh/python3.13/lib/python3.13/asyncio/runners.pyr r sGK Frr cZ\rSrSrSrSSS.SjrSrSrSrS r SS .S jr S r S r Sr g)raA context manager that controls event loop life cycle. The context manager always creates a new event loop, allows to run async functions inside it, and properly finalizes the loop at the context manager exit. If debug is True, the event loop will be run in debug mode. If loop_factory is passed, it is used for new event loop creation. asyncio.run(main(), debug=True) is a shortcut for with asyncio.Runner(debug=True) as runner: runner.run(main()) The run() method can be called multiple times within the runner's context. This can be useful for interactive console (e.g. IPython), unittest runners, console tools, -- everywhere when async code is called from existing sync framework and where the preferred single asyncio.run() call doesn't work. Ndebug loop_factoryc~[RUlXlX lSUlSUlSUlSUlg)NrF) r r_state_debug _loop_factory_loop_context_interrupt_count_set_event_loop)selfrr s r__init__Runner.__init__0s6nn  )  !$rc&UR5 U$N) _lazy_initr)s r __enter__Runner.__enter__9s  rc$UR5 gr-)close)r)exc_typeexc_valexc_tbs r__exit__Runner.__exit__=s  rc`UR[RLagURn[ U5 UR UR 55 UR UR[R55 UR(a[R"S5 UR5 SUl[RUlg!UR(a[R"S5 WR5 SUl[RUlf=f)zShutdown and close event loop.N)r"r rr%_cancel_all_tasksrun_until_completeshutdown_asyncgensshutdown_default_executorr THREAD_JOIN_TIMEOUTr(rset_event_loopr3r)r)loops rr3 Runner.close@s ;;f00 0  (::D d #  # #D$;$;$= >  # #..y/L/LM O##%%d+ JJLDJ --DK ##%%d+ JJLDJ --DKs A$CAD-c:UR5 UR$)zReturn embedded event loop.)r.r%r/s rget_loopRunner.get_loopQs zzrcontextc[R"U5(d[SRU55e[R "5b [ S5eUR5 Uc URnURRXS9n[R"5[R"5La{[R"[R 5[R"LaF[$R&"UR(US9n[R"[R U5 OSnSUlURR-U5Ub\[R"[R 5ULa4[R"[R [R"5 $$$![a SnNf=f![.R0a7 UR*S:a%[3USS5nUbU"5S:Xa [55eef=f!Ub\[R"[R 5ULa4[R"[R [R"5 fff=f)z/Run a coroutine inside the embedded event loop.z"a coroutine was expected, got {!r}Nz7Runner.run() cannot be called from a running event looprE) main_taskruncancel)r iscoroutine ValueErrorformatr_get_running_loop RuntimeErrorr.r&r% create_task threadingcurrent_thread main_threadsignal getsignalSIGINTdefault_int_handler functoolspartial _on_sigintr'r;rCancelledErrorgetattrKeyboardInterrupt)r)cororFtasksigint_handlerrIs rr Runner.runVs%%d++AHHNO O  # # % 1IK K  ?mmGzz%%d%<  $ $ &)*?*?*A A  /63M3MM&..t$ON & fmm^<"N ! I::006*$$V]]3~E fmmV-G-GHF+% &"&  &(( $$q("4T:'HJ!O+--   *$$V]]3~E fmmV-G-GHF+s,%F9?G 9 GG A HHA!I:c<UR[RLa [S5eUR[RLagUR cS[ R"5UlUR(d'[ R"UR5 SUl OUR 5UlURb%URRUR5 [R"5Ul[RUlg)NzRunner is closedT)r"r rrNrr$rnew_event_loopr%r(r?r# set_debug contextvars copy_contextr&r/s rr.Runner._lazy_inits ;;&-- '12 2 ;;&,, ,     %..0DJ''%%djj1'+$++-DJ ;; " JJ  -#002 (( rcU=RS- slURS:XaBUR5(d-UR5 URR S5 g[ 5e)Nrcgr-rrrr#Runner._on_sigint..sDr)r'donecancelr%call_soon_threadsafer\)r)signumframerHs rrYRunner._on_sigintsW "  A %inn.>.>     JJ + +L 9 !!r)r&r#r'r%r$r(r")rrrr__doc__r*r0r7r3rCrr.rYrrrrrrs=6!%4%(" $(+IZ)&"rrrc[R"5b [S5e[XS9nUR U5sSSS5 $!,(df  g=f)auExecute the coroutine and return the result. This function runs the passed coroutine, taking care of managing the asyncio event loop, finalizing asynchronous generators and closing the default executor. This function cannot be called when another asyncio event loop is running in the same thread. If debug is True, the event loop will be run in debug mode. If loop_factory is passed, it is used for new event loop creation. This function always creates a new event loop and closes it at the end. It should be used as a main entry point for asyncio programs, and should ideally only be called once. The executor is given a timeout duration of 5 minutes to shutdown. If the executor hasn't finished within that duration, a warning is emitted and the executor is closed. Example: async def main(): await asyncio.sleep(1) print('hello') asyncio.run(main()) Nz8asyncio.run() cannot be called from a running event loopr)rrMrNrr)mainrr runners rrrsI:!- FH H e 76zz$ 8 7 7s A Ach[R"U5nU(dgUHnUR5 M UR[R"USS065 UHPnUR 5(aMUR 5cM-URSUR 5US.5 MR g)Nreturn_exceptionsTz1unhandled exception during asyncio.run() shutdown)message exceptionr^)r all_tasksrlr;gather cancelledrxcall_exception_handler)r@ to_cancelr^s rr:r:s%I   ELL)LtLM >>    >>  '  ' 'N!^^-)  r)__all__rdenumrWrPrSrrrr r Enumr rrr:rrrrsW   TYY I"I"X$# Lr