Your IP : 18.118.1.4


Current Path : /opt/alt/python313/lib64/python3.13/asyncio/__pycache__/
Upload File :
Current File : //opt/alt/python313/lib64/python3.13/asyncio/__pycache__/runners.cpython-313.opt-1.pyc

�

1}g����SrSSKrSSKrSSKrSSKrSSKrSSKJr SSKJr SSKJ	r	 SSKJ
r
 SSKJr "S	S
\R5r
"SS5rSSS
.SjrSrg))�Runner�run�N�)�
coroutines)�events)�
exceptions)�tasks)�	constantsc� �\rSrSrSrSrSrSrg)�_State��created�initialized�closed�N)�__name__�
__module__�__qualname__�__firstlineno__�CREATED�INITIALIZED�CLOSED�__static_attributes__r��6/opt/alt/python313/lib64/python3.13/asyncio/runners.pyrrs���G��K�
�Frrc�Z�\rSrSrSrSSS.SjrSrSrSrS	r	SS
.Sjr
SrS
rSr
g)r�a�A 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.

N��debug�loop_factoryc�~�[RUlXlX lSUlSUlSUlSUlg)NrF)	rr�_state�_debug�
_loop_factory�_loop�_context�_interrupt_count�_set_event_loop)�selfrr s   r�__init__�Runner.__init__0s6���n�n�����)����
���
� !���$��rc�&�UR5 U$�N)�
_lazy_init�r)s r�	__enter__�Runner.__enter__9s�������rc�$�UR5 gr-)�close)r)�exc_type�exc_val�exc_tbs    r�__exit__�Runner.__exit__=s���
�
�rc�`�UR[RLagURn[	U5 URUR
55 URUR[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_tasks�run_until_complete�shutdown_asyncgens�shutdown_default_executorr
�THREAD_JOIN_TIMEOUTr(r�set_event_loopr3r)r)�loops  rr3�Runner.close@s����;�;�f�0�0�0��	(��:�:�D��d�#��#�#�D�$;�$;�$=�>��#�#��.�.�y�/L�/L�M�
O��#�#��%�%�d�+��J�J�L��D�J� �-�-�D�K��	�#�#��%�%�d�+��J�J�L��D�J� �-�-�D�K�s
�A$C�AD-c�:�UR5 UR$)zReturn embedded event loop.)r.r%r/s r�get_loop�Runner.get_loopQs�������z�z�r��contextc��[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 SnN�f=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_taskr�uncancel)r�iscoroutine�
ValueError�formatr�_get_running_loop�RuntimeErrorr.r&r%�create_task�	threading�current_thread�main_thread�signal�	getsignal�SIGINT�default_int_handler�	functools�partial�
_on_sigintr'r;r�CancelledError�getattr�KeyboardInterrupt)r)�cororF�task�sigint_handlerrIs      rr�
Runner.runVs����%�%�d�+�+��A�H�H��N�O�O��#�#�%�1��I�K�
K�	
�����?��m�m�G��z�z�%�%�d�%�<���$�$�&�)�*?�*?�*A�A�� � ����/�6�3M�3M�M�&�.�.�t���$�O�N�
&��
�
�f�m�m�^�<�"�N� !���	I��:�:�0�0��6��*��$�$�V�]�]�3�~�E��
�
�f�m�m�V�-G�-G�H�F�+��%�
&�"&��	
&���(�(�	��$�$�q�(�"�4��T�:���'�H�J�!�O�+�-�-��	���*��$�$�V�]�]�3�~�E��
�
�f�m�m�V�-G�-G�H�F�+�s,�%F9�?G�9G�G�AH�H�A!I:c�<�UR[RLa[S5eUR[RLagUR
cS[R"5UlUR(d'[R"UR5 SUl	OUR5UlURb%URRUR5 [R"5Ul[RUlg)NzRunner is closedT)r"rrrNrr$r�new_event_loopr%r(r?r#�	set_debug�contextvars�copy_contextr&r/s rr.�Runner._lazy_init�s����;�;�&�-�-�'��1�2�2��;�;�&�,�,�,�����%��.�.�0�D�J��'�'��%�%�d�j�j�1�'+��$���+�+�-�D�J��;�;�"��J�J� � ����-�#�0�0�2��
��(�(��rc���U=RS-
slURS:XaBUR5(d-UR5 URR	S5 g[5e)Nrc��gr-rrrr�<lambda>�#Runner._on_sigint.<locals>.<lambda>�s��Dr)r'�done�cancelr%�call_soon_threadsafer\)r)�signum�framerHs    rrY�Runner._on_sigint�sW������"��� � �A�%�i�n�n�.>�.>������J�J�+�+�L�9���!�!r)r&r#r'r%r$r(r")rrrr�__doc__r*r0r7r3rCrr.rYrrrrrrs=���6!%�4�%���(�"�
$(�+I�Z)�&"rrrc��[R"5b[S5e[XS9nUR	U5sSSS5 $!,(df   g=f)a2Execute 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.

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    rrr�sI��8���!�-��F�H�	H�
�e�	7�6��z�z�$��
8�	7�	7�s�A�
Ac�h�[R"U5nU(dgUHnUR5 M UR[R"USS065 UHPnUR5(aMUR
5cM-URSUR
5US.5 MR g)N�return_exceptionsTz1unhandled exception during asyncio.run() shutdown)�message�	exceptionr^)r	�	all_tasksrlr;�gather�	cancelledrx�call_exception_handler)r@�	to_cancelr^s   rr:r:�s�������%�I��������
��	���E�L�L�)�L�t�L�M����>�>�����>�>��'��'�'�N�!�^�^�-��)�
�	r)�__all__rd�enumrWrPrS�rrrr	r
�Enumrrrr:rrr�<module>r�sW��
������
�������T�Y�Y��I"�I"�X�$�" �Jr

?>