Your IP : 3.137.181.48


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

�

1}gM�����SrSrSSKrSSKrSSKrSSKrSSKrSSKrSSK	r	SSK
r
SSK	Jr SSKJ
r
 SSKJr SSKJr SS	KJr SS
KJr SSKJr SSKJr \R("S5R*rS1S
jrS1Sjr"SS\R25r\rSSKr\R4=rrSSS.Sjr\R"R@r \R"RBr!\R"RDr"S\"S.Sjr#Sr$Sr%Sr&Sr'"SS5r(SS.Sjr)\	RTS5r+S1Sjr,SS.S jr-"S!S"\R\5r/S#S$.S%jr0S&r1S'r2S(r3\3"\5r4\
Rj"5r6\7"5r80r9S)r:S*r;S+r<S,r=S-r>S.r?S/r@\rA\:rB\;rC\?rD\@rE\<rF\=rG\>rHSS0KJ:r:J;r;J?r?J@r@J<r<J=r=J>r>J6r6J8r8J9r9Jr \rI\:rJ\;rK\?rL\@rM\<rN\=rO\>rPg!\a GN.f=f!\a gf=f)2z0Support for tasks, coroutines and the scheduler.)�Task�create_task�FIRST_COMPLETED�FIRST_EXCEPTION�
ALL_COMPLETED�wait�wait_for�as_completed�sleep�gather�shield�
ensure_future�run_coroutine_threadsafe�current_task�	all_tasks�create_eager_task_factory�eager_task_factory�_register_task�_unregister_task�_enter_task�_leave_task�N)�GenericAlias�)�
base_tasks)�
coroutines)�events)�
exceptions)�futures)�queues)�timeoutsc�^�Uc[R"5n[R"U5$)z!Return a currently executed task.)r�get_running_loop�_current_tasks�get��loops �4/opt/alt/python313/lib64/python3.13/asyncio/tasks.pyrr%s&���|��&�&�(�����d�#�#�c�t�Uc[R"5n[[5nSnSn[[5n[R"X!5Vs1sH7n[R"U5ULdMUR5(aM5UiM9 sn$![
a US-
nUS:�aeOf=fM�s snf)z'Return a set of all tasks for the loop.Nrri�)rr"�list�_eager_tasks�_scheduled_tasks�RuntimeError�	itertools�chainr�	_get_loop�done)r&�eager_tasks�scheduled_tasks�i�ts     r'rr,s����|��&�&�(���|�$�K��O�	�A�
�	�"�#3�4�O�
� ����D�>�D�!�� � ��#�t�+�
�45�F�F�H�
�D�>�>��
�	�
��F�A��D�y���	����>s#�B�B5�7B5�B5�B0�/B0c��^�\rSrSrSrSrSSSSS.U4SjjrU4Sjr\"\	5r
S	rS
rSr
SrS
rSrSrSS.SjrSSS.SjrSSjrSrSrSrSSjrU4SjrSrSrU=r$)r�Gz A coroutine wrapped in a Future.TNF�r&�name�context�eager_startc�h>�[TU]US9 UR(a
URS	[R"U5(dSUl[
SU<35eUcS[53UlO[U5UlSUl
SUlSUlXl
Uc[R"5UlOX@lU(a0UR"R%5(aUR'5 gUR"R)UR*UR S9 [-U5 g)Nr%���Fza coroutine was expected, got zTask-r�r:)�super�__init__�_source_tracebackr�iscoroutine�_log_destroy_pending�	TypeError�_task_name_counter�_name�str�_num_cancels_requested�_must_cancel�_fut_waiter�_coro�contextvars�copy_context�_context�_loop�
is_running�_Task__eager_start�	call_soon�_Task__stepr)�self�coror&r9r:r;�	__class__s      �r'r@�
Task.__init__cs����
���d��#��!�!��&�&�r�*��%�%�d�+�+�).�D�%��<�T�H�E�F�F��<� �!3�!5� 6�7�D�J��T��D�J�&'��#�!�������
��?�'�4�4�6�D�M�#�M��4�:�:�0�0�2�2���� ��J�J� � ����d�m�m� �D��4� r(c�>�UR[R:XaQUR(a@USS.nUR(aURUS'UR
R
U5 [TU]!5 g)Nz%Task was destroyed but it is pending!)�task�message�source_traceback)	�_stater�_PENDINGrCrArO�call_exception_handlerr?�__del__)rTr:rVs  �r'r_�Task.__del__�sb����;�;�'�*�*�*�t�/H�/H��B��G��%�%�.2�.D�.D��*�+��J�J�-�-�g�6�
���r(c�.�[R"U5$�N)r�
_task_repr�rTs r'�__repr__�
Task.__repr__�s���$�$�T�*�*r(c��UR$rb)rKrds r'�get_coro�
Task.get_coro�����z�z�r(c��UR$rb)rNrds r'�get_context�Task.get_context�s���}�}�r(c��UR$rb)rFrds r'�get_name�
Task.get_name�rjr(c�$�[U5Ulgrb)rGrF)rT�values  r'�set_name�
Task.set_name�s
����Z��
r(c��[S5e)Nz*Task does not support set_result operation�r-)rT�results  r'�
set_result�Task.set_result�s���G�H�Hr(c��[S5e)Nz-Task does not support set_exception operationrv)rT�	exceptions  r'�
set_exception�Task.set_exception�s���J�K�Kr()�limitc�.�[R"X5$)a%Return the list of stack frames for this task's coroutine.

If the coroutine is not done, this returns the stack where it is
suspended.  If the coroutine has completed successfully or was
cancelled, this returns an empty list.  If the coroutine was
terminated by an exception, this returns the list of traceback
frames.

The frames are always ordered from oldest to newest.

The optional limit gives the maximum number of frames to
return; by default all available frames are returned.  Its
meaning differs depending on whether a stack or a traceback is
returned: the newest frames of a stack are returned, but the
oldest frames of a traceback are returned.  (This matches the
behavior of the traceback module.)

For reasons beyond our control, only one stack frame is
returned for a suspended coroutine.
)r�_task_get_stack)rTr~s  r'�	get_stack�Task.get_stack�s��*�)�)�$�6�6r()r~�filec�0�[R"XU5$)a>Print the stack or traceback for this task's coroutine.

This produces output similar to that of the traceback module,
for the frames retrieved by get_stack().  The limit argument
is passed to get_stack().  The file argument is an I/O stream
to which the output is written; by default output is written
to sys.stderr.
)r�_task_print_stack)rTr~r�s   r'�print_stack�Task.print_stack�s���+�+�D��>�>r(c���SUlUR5(agU=RS-
slURbURR	US9(agSUlXlg)aJRequest that this task cancel itself.

This arranges for a CancelledError to be thrown into the
wrapped coroutine on the next cycle through the event loop.
The coroutine then has a chance to clean up or even deny
the request using try/except/finally.

Unlike Future.cancel, this does not guarantee that the
task will be cancelled: the exception might be caught and
acted upon, delaying cancellation of the task or preventing
cancellation completely.  The task may also return a value or
raise a different exception.

Immediately after this method is called, Task.cancelled() will
not return True (unless the task was already cancelled).  A
task will be marked as cancelled when the wrapped coroutine
terminates with a CancelledError exception (even if cancel()
was not called).

This also increases the task's count of cancellation requests.
Fr��msgT)�_log_tracebackr1rHrJ�cancelrI�_cancel_message)rTr�s  r'r��Task.cancel�sf��,$����9�9�;�;���#�#�q�(�#����'����&�&�3�&�/�� ���"��r(c��UR$)z�Return the count of the task's cancellation requests.

This count is incremented when .cancel() is called
and may be decremented using .uncancel().
)rHrds r'�
cancelling�Task.cancelling�s���*�*�*r(c��URS:�a,U=RS-slURS:XaSUlUR$)z�Decrement the task's count of cancellation requests.

This should be called by the party that called `cancel()` on the task
beforehand.

Returns the remaining number of cancellation requests.
rrF)rHrIrds r'�uncancel�
Task.uncancel�sE���&�&��*��'�'�1�,�'��*�*�a�/�$)��!��*�*�*r(c��[URU5n[U5 URR	UR
S5 [
U5 [URU5nUR5(a
SUlSng[U5 g![
U5 f=f!UR5(a
SUlSnf[U5 f=f![URU5nUR5(a
SUlSnf[U5 f!UR5(a
SUlSnf[U5 f=f=frb)
�_swap_current_taskrO�_register_eager_taskrN�run�!_Task__step_run_and_handle_result�_unregister_eager_taskr1rKr)rT�	prev_task�curtasks   r'�
__eager_start�Task.__eager_starts��&�t�z�z�4�8�	�	)� ��&�
-��
�
�!�!�$�"C�"C�T�J�&�t�,�
)�,�T�Z�Z��C���9�9�;�;�!%�D�J��D�"�4�(��'�t�,���9�9�;�;�!%�D�J��D�"�4�(��
)�,�T�Z�Z��C���9�9�;�;�!%�D�J��D�"�4�(��	�9�9�;�;�!%�D�J��D�"�4�(�sF�C�&B�
C�B(�
B%�%C�(,C�E	�D�/+E	�,E�E	c��UR5(a[R"SU<SU<35eUR(a6[	U[R
5(dUR
5nSUlSUl[URU5 URU5 [URU5 Sng![URU5 Snf=f)Nz_step(): already done: z, F)r1r�InvalidStateErrorrI�
isinstance�CancelledError�_make_cancelled_errorrJrrOr�r)rT�excs  r'�__step�Task.__steps����9�9�;�;��.�.�)�$���C�7�;�=�
=�����c�:�#<�#<�=�=��0�0�2�� %�D������D�J�J��%�	��-�-�c�2���
�
�D�)��D��
��
�
�D�)��D�s�C�Cc�>�URnUcURS5nOURU5n[USS5nUGbf[R
"U5URLaD[SU<SU<S35nURRURXPRS9 GO�U(a�X0La?[SU<35nURRURXPRS9 GO�SUlURURURS9 X0lUR(a/URR!UR"S9(aSUlGO[S	U<S
U<35nURRURXPRS9 O�Uc/URRURURS9 O�[$R&"U5(aB[SU<S
U<35nURRURXPRS9 O>[SU<35nURRURXPRS9 Sng![(aWnUR(a#SUl[*TU]AUR"S9 SnANA[*TU]YUR.5 SnAN_SnAf[0R2anXl[*TU]A5 SnAN�SnAf[6[84an[*TU]uU5 eSnAf[<an[*TU]uU5 SnAN�SnAff=f!Snf=f)
N�_asyncio_future_blockingzTask z got Future z attached to a different loopr>zTask cannot await on itself: Fr�z-yield was used instead of yield from in task z with z;yield was used instead of yield from for generator in task zTask got bad yield: )rK�send�throw�getattrrr0rOr-rRrSrNr��add_done_callback�
_Task__wakeuprJrIr�r��inspect�isgenerator�
StopIterationr?rxrrrr��_cancelled_exc�KeyboardInterrupt�
SystemExitr|�
BaseException)rTr�rUrw�blocking�new_excrVs      �r'�__step_run_and_handle_result�!Task.__step_run_and_handle_result*s����z�z��G	��{����4������C���$�v�'A�4�H�H��#��$�$�V�,�D�J�J�>�*���x�|�!�*�$A�C�D�G��J�J�(�(����W�m�m�)�E���~�".�;�D�8�D�#F���
�
�,�,� �K�K��-�-�-�I�;@��7��0�0� �M�M�4�=�=�1�B�+1�(��,�,�#�/�/�6�6�(,�(<�(<� 7� >�49�� 1��*�#�#'�(�&��
�<�=�G��J�J�(�(����W�m�m�)�E����
�
�$�$�T�[�[�$�-�-�$�H��$�$�V�,�,�&�)�)-���v�j�B�C���
�
�$�$��K�K��-�-�%�A�'�)=�f�Z�'H�I���
�
�$�$��K�K��-�-�%�A��D��A�	.�� � �$)��!����4�#7�#7��8���"�3�9�9�-�-���(�(�	�"%���G�N����!�:�.�	��G�!�#�&����	'��G�!�#�&�&��	'��d�D�sk�&I<�IM�<
M�/K�5M�:K�M�M�/L�M�M�L+�+
M�8M�M�M�M�Mc��UR5 UR5 Sng![anURU5 SnASngSnAff=frb)rwrSr�)rT�futurer�s   r'�__wakeup�
Task.__wakeupusH��	��M�M�O�
�K�K�M�����	��K�K�������	�s�%�
A�A�A)
r�r�rNrKrJrCr�rIrFrHrb)�__name__�
__module__�__qualname__�__firstlineno__�__doc__rCr@r_�classmethodr�__class_getitem__rerhrlrorsrxr|r�r�r�r�r�rQrSr�r��__static_attributes__�
__classcell__�rVs@r'rrGs����+�. ��%)��d�"�!�!�>	�$�L�1��+���� �I�L�"&�7�.$(�d�	?�(�T+�+�)�&�"I�V�r(r�r9r:c�x�[R"5nUcURXS9nU$URXUS9nU$)zUSchedule the execution of a coroutine object in a spawn task.

Return a Task object.
)r9r�)rr"r)rUr9r:r&rYs     r'rr�sM��
�"�"�$�D��������0���K�������A���Kr()�timeout�return_whenc���# �[R"U5(d[R"U5(a![	S[U5R35eU(d[S5eU[[[4;a[SU35e[U5n[SU55(a[	S5e[R"5n[XX#5IShv�N$N7f)a7Wait for the Futures or Tasks given by fs to complete.

The fs iterable must not be empty.

Returns two sets of Future: (done, pending).

Usage:

    done, pending = await asyncio.wait(fs)

Note: This does not raise TimeoutError! Futures that aren't done
when the timeout occurs are returned in the second set.
zexpect a list of futures, not zSet of Tasks/Futures is empty.zInvalid return_when value: c3�N# �UHn[R"U5v� M g7frb)rrB)�.0�fs  r'�	<genexpr>�wait.<locals>.<genexpr>�s���
1�b��:�!�!�!�$�$�b�s�#%z6Passing coroutines is forbidden, use tasks explicitly.N)r�isfuturerrBrD�typer��
ValueErrorrrr�set�anyrr"�_wait)�fsr�r�r&s    r'rr�s����������z�5�5�b�9�9��8��b��9J�9J�8K�L�M�M�
��9�:�:��?�O�]�K�K��6�{�m�D�E�E�	�R��B�
�
1�b�
1�1�1��P�Q�Q��"�"�$�D��r�K�6�6�6�6�s�CC'� C%�!C'c�R�UR5(dURS5 ggrb)r1rx)�waiter�argss  r'�_release_waiterr��s ���;�;�=�=����$��r(c���# �UbZUS::aT[U5nUR5(aUR5$[U5IShv�N UR5$[R"U5IShv�N UIShv�NsSSS5IShv�N $NO![R
an[UeSnAff=fNDN<N.!,IShv�N(df   g=f7f)a�Wait for the single Future or coroutine to complete, with timeout.

Coroutine will be wrapped in Task.

Returns result of the Future or coroutine.  When a timeout occurs,
it cancels the task and raises TimeoutError.  To avoid the task
cancellation, wrap it in shield().

If the wait is cancelled, the task is also cancelled.

If the task suppresses the cancellation and returns a value instead,
that value is returned.

This function is a coroutine.
Nr)	r
r1rw�_cancel_and_waitrr��TimeoutErrorr r�)�futr�r�s   r'rr�s����F��w�!�|��C� ���8�8�:�:��:�:�<���s�#�#�#�	(��:�:�<������(�(��y�)�(�(�
	$���(�(�	(��C�'��	(��)��)�(�(�(�s��AC�
B�C�B�C�:B?�;C�>C�C�C�C�C�C�B<�0B7�7B<�<C�C�C�C�C�C�Cc��N^^^	^
# �UR5m
Sm	UbURU[T
5m	[U5mUUU	U
4SjnUHnUR	U5 M T
IShv�N T	bT	R5 UHnUR
U5 M [5[5pvUH<nUR5(aURU5 M+URU5 M> Xg4$N�!T	bT	R5 UHnUR
U5 M f=f7f)zNInternal helper for wait().

The fs argument must be a collection of Futures.
Nc�
>�TS-mTS::d:T[:Xd0T[:XacUR5(dMUR5b;TbTR	5 TR5(dTR
S5 ggggg)Nrr)rr�	cancelledr{r�r1rx)r��counterr��timeout_handler�s ����r'�_on_completion�_wait.<locals>._on_completion	sx����1����q�L��?�*��?�*�A�K�K�M�M�01���
�0I��)��%�%�'��;�;�=�=��!�!�$�'�!�1J�5B�*r()
�
create_future�
call_laterr��lenr�r��remove_done_callbackr�r1�add)r�r�r�r&r�r�r1�pendingr�r�r�s  `     @@@r'r�r��s�����
�
�
!�F��N�������/�6�J���"�g�G�
(�
(���	���N�+��3�����%��!�!�#��A�
�"�"�>�2���E�3�5�'�
���6�6�8�8��H�H�Q�K��K�K��N�	�
�=��	���%��!�!�#��A�
�"�"�>�2��s1�AD%�"C3�'C1�(C3�,BD%�1C3�3/D"�"D%c��6# �[R"5nUR5n[R"[
U5nUR
U5 UR5 UIShv�N URU5 gN!URU5 f=f7f)z<Cancel the *fut* future or task and wait until it completes.N)	rr"r��	functools�partialr�r�r�r�)r�r&r��cbs    r'r�r�)s|����"�"�$�D�
�
�
�
!�F�	�	�	�?�F�	3�B����"��%��
�
������ � ��$�	��� � ��$�s0�AB�B�*B�+B�/B�B�B�Bc�L�\rSrSrSrSrSrSrSrSr	Sr
S	rS
S
jrSr
g)�_AsCompletedIteratori:a
Iterator of awaitables representing tasks of asyncio.as_completed.

As an asynchronous iterator, iteration yields futures as they finish. As a
plain iterator, new coroutines are yielded that will return or raise the
result of the next underlying future to complete.
c��[R"5UlSUl[R
"5n[
U5Vs1sHn[XCS9iM nnUHnURUR5 M  U(a#Ub URX R5UlXPl[U5Ulgs snf�Nr%)r�Queue�_done�_timeout_handler�get_event_loopr�r
r��_handle_completionr��_handle_timeout�_todor��
_todo_left)rT�awsr�r&�aw�todor�s       r'r@�_AsCompletedIterator.__init__As����\�\�^��
�#����$�$�&��7:�3�x�@�x��
�b�,�x��@��A�
���� 7� 7�8���G�'�����)=�)=�>�
� ��
��d�)����As�B>c��U$rb�rds r'�	__aiter__�_AsCompletedIterator.__aiter__P����r(c��U$rbrrds r'�__iter__�_AsCompletedIterator.__iter__Srr(c��# �UR(d[eU=RS-slUR5IShv�N$N7f)Nr)r��StopAsyncIteration�
_wait_for_onerds r'�	__anext__�_AsCompletedIterator.__anext__Vs5������$�$����1����'�'�)�)�)�)�s�AA	�A�A	c�x�UR(d[eU=RS-slURSS9$)NrT)�resolve)r�r�rrds r'�__next__�_AsCompletedIterator.__next__]s1����������1����!�!�$�!�/�/r(c���URH9nURUR5 URR	S5 M; URR5 grb)r�r�r�r��
put_nowait�clear�rTr�s  r'r��$_AsCompletedIterator._handle_timeoutdsH�����A�
�"�"�4�#:�#:�;��J�J�!�!�$�'��	
�
�
���r(c��UR(dgURRU5 URRU5 UR(d)URbURR5 gggrb)r��remover�rr�r�rs  r'r��'_AsCompletedIterator._handle_completionjs[���z�z���
�
���!���
�
���a� ��z�z�d�2�2�>�� � �'�'�)�?�zr(c��# �URR5IShv�NnUc[ReU(aUR	5$U$N07frb)r�r$rr�rw)rTrr�s   r'r�"_AsCompletedIterator._wait_for_onersC����*�*�.�.�"�"���9��)�)�)�$�q�x�x�z�+�!�+�	
#�s�A�A�1A)r�r�r�r�N)F)r�r�r�r�r�r@rrrrr�r�rr�rr(r'r�r�:s/���
$���*�0��*�,r(r�)r�c��[R"U5(a![S[U5R35e[X5$)a�Create an iterator of awaitables or their results in completion order.

Run the supplied awaitables concurrently. The returned object can be
iterated to obtain the results of the awaitables as they finish.

The object returned can be iterated as an asynchronous iterator or a plain
iterator. When asynchronous iteration is used, the originally-supplied
awaitables are yielded if they are tasks or futures. This makes it easy to
correlate previously-scheduled tasks with their results:

    ipv4_connect = create_task(open_connection("127.0.0.1", 80))
    ipv6_connect = create_task(open_connection("::1", 80))
    tasks = [ipv4_connect, ipv6_connect]

    async for earliest_connect in as_completed(tasks):
        # earliest_connect is done. The result can be obtained by
        # awaiting it or calling earliest_connect.result()
        reader, writer = await earliest_connect

        if earliest_connect is ipv6_connect:
            print("IPv6 connection established.")
        else:
            print("IPv4 connection established.")

During asynchronous iteration, implicitly-created tasks will be yielded for
supplied awaitables that aren't tasks or futures.

When used as a plain iterator, each iteration yields a new coroutine that
returns the result or raises the exception of the next completed awaitable.
This pattern is compatible with Python versions older than 3.13:

    ipv4_connect = create_task(open_connection("127.0.0.1", 80))
    ipv6_connect = create_task(open_connection("::1", 80))
    tasks = [ipv4_connect, ipv6_connect]

    for next_connect in as_completed(tasks):
        # next_connect is not one of the original task objects. It must be
        # awaited to obtain the result value or raise the exception of the
        # awaitable that finishes next.
        reader, writer = await next_connect

A TimeoutError is raised if the timeout occurs before all awaitables are
done. This is raised by the async for loop during asynchronous iteration or
by the coroutines yielded during plain iteration.
z'expects an iterable of awaitables, not )r��isawaitablerDr�r�r�)r�r�s  r'r	r	}sE��\���2����5�d�2�h�6G�6G�5H�I�
�	
� ��,�,r(c#�# �Sv� g7f)z�Skip one event loop run cycle.

This is a private helper for 'asyncio.sleep()', used
when the 'delay' is set to 0.  It uses a bare 'yield'
expression (which Task.__step knows how to handle)
instead of creating a Future object.
Nrrr(r'�__sleep0r�s
���
�s�c��~# �US::a[5IShv�N U$[R"U5(a[S5e[R
"5nUR
5nURU[RX15nUIShv�NUR5 $N�N!UR5 f=f7f)z9Coroutine that completes after a given time (in seconds).rNz!Invalid delay: NaN (not a number))r�math�isnanr�rr"r�r�r�_set_result_unless_cancelledr�)�delayrwr&r��hs     r'r
r
�s������z��j����
��z�z�%����<�=�=��"�"�$�D�
�
�
�
!�F������<�<��	(�A���|�	���
�	���	���
�s:�B=�B$�A2B=�
B(�B&�B(�B=�&B(�(B:�:B=r%c���[R"U5(a)Ub$U[R"U5La[S5eU$Sn[R
"U5(d4[R"U5(aSnU"U5nSnO[S5eUc[R"5nURU5$![a U(aUR5 ef=f)zeWrap a coroutine or an awaitable in a future.

If the argument is a Future, it is returned directly.
zRThe future belongs to a different loop than the one specified as the loop argumentTc��"# �UIShv�N$N7frbr)�	awaitables r'�_wrap_awaitable�&ensure_future.<locals>._wrap_awaitable�s���&��&��s��
�Fz:An asyncio.Future, a coroutine or an awaitable is required)rr�r0r�rrBr�rrDrr�rr-�close)�coro_or_futurer&�should_closer)s    r'r
r
�s���
����'�'����G�,=�,=�n�,M� M��E�F�
F����L��!�!�.�1�1����~�.�.�
'�-�^�<�N� �L��*�+�
+��|��$�$�&�������/�/������ � �"�
��s�/C�#C#c�6^�\rSrSrSrU4SjrSSjrSrU=r$)�_GatheringFuturei�z�Helper for gather().

This overrides cancel() to cancel all the children and act more
like Task.cancel(), which doesn't immediately mark itself as
cancelled.
c�:>�[TU]US9 XlSUlg)Nr%F)r?r@�	_children�_cancel_requested)rT�childrenr&rVs   �r'r@�_GatheringFuture.__init__�s ���
���d��#�!��!&��r(c��UR5(agSnURHnURUS9(dMSnM U(aSUlU$)NFr�T)r1r1r�r2)rTr��ret�childs    r'r��_GatheringFuture.cancelsM���9�9�;�;�����^�^�E��|�|��|�$�$���$��&*�D�"��
r()r2r1rb)	r�r�r�r�r�r@r�r�r�r�s@r'r/r/�s����'��r(r/F)�return_exceptionsc�^^^	^
^�U(d8[R"5nUR5mTR/5 T$UU	U
UU4Sjn0n/mSm
Sm	/nSnSmUH�nXd;ao[	XbS9nUc[
R"U5nXvLaSUlT
S-
m
XtU'UR5(aURU5 OURU5 OXFnTRU5 M� [TUS9mUHnU"U5 M
 T$)aMReturn a future aggregating results from the given coroutines/futures.

Coroutines will be wrapped in a future and scheduled in the event
loop. They will not necessarily be scheduled in the same order as
passed in.

All futures must share the same event loop.  If all the tasks are
done successfully, the returned future's result is the list of
results (in the order of the original sequence, not necessarily
the order of results arrival).  If *return_exceptions* is True,
exceptions in the tasks are treated the same as successful
results, and gathered in the result list; otherwise, the first
raised exception will be immediately propagated to the returned
future.

Cancellation: if the outer Future is cancelled, all children (that
have not completed yet) are also cancelled.  If any child is
cancelled, this is treated as if it raised CancelledError --
the outer Future is *not* cancelled in this case.  (This is to
prevent the cancellation of one child to cause other children to
be cancelled.)

If *return_exceptions* is False, cancelling gather() after it
has been marked done won't cancel any submitted awaitables.
For instance, gather can be marked done after propagating an
exception to the caller, therefore, calling ``gather.cancel()``
after catching an exception (raised by one of the awaitables) from
gather won't cancel any other awaitables.
c��>�TS-
mTbTR5(a&UR5(dUR5 gT(d\UR5(a"UR5nTR	U5 gUR5nUbTR	U5 gTT:Xa�/nTH|nUR5(a0[
R"URcSOUR5nO#UR5nUcUR5nURU5 M~ TR(a"UR5nTR	U5 gTRU5 gg)Nr�)r1r�r{r�r|rr�r�rw�appendr2rx)	r�r��results�resr3�	nfinished�nfuts�outerr9s	    �����r'�_done_callback�gather.<locals>._done_callback4s4����Q��	��=�E�J�J�L�L��=�=�?�?��
�
��� ��}�}����/�/�1���#�#�C�(���m�m�o���?��'�'��,������G����=�=�?�?�%�3�3�!�1�1�9���+�+�-�C��-�-�/�C��{�!�j�j�l�����s�#� �"�&�&��/�/�1���#�#�C�(�� � ��)�;r(rNr%Fr)rr�r�rxr
rr0rCr1r=r�r/)r9�coros_or_futuresr&rC�
arg_to_fut�	done_futs�argr�r3r@rArBs`       @@@@r'rrs���<��$�$�&���"�"�$��
�������5*�5*�n�J��H�
�E��I��I��D��E���� ���/�C��|��(�(��-���~�
,1��(��Q�J�E�!�s�O��x�x�z�z�� � ��%��%�%�n�5��/�C������/ �2
�X�D�1�E����s����Lr(c�^^^�[U5mTR5(aT$[R"T5nUR	5mU4SjmUU4SjnTRT5 TRU5 T$)a-Wait for a future, shielding it from cancellation.

The statement

    task = asyncio.create_task(something())
    res = await shield(task)

is exactly equivalent to the statement

    res = await something()

*except* that if the coroutine containing it is cancelled, the
task running in something() is not cancelled.  From the POV of
something(), the cancellation did not happen.  But its caller is
still cancelled, so the yield-from expression still raises
CancelledError.  Note: If something() is cancelled by other means
this will still cancel shield().

If you want to completely ignore cancellation (not recommended)
you can combine shield() with a try/except clause, as follows:

    task = asyncio.create_task(something())
    try:
        res = await shield(task)
    except CancelledError:
        res = None

Save a reference to tasks passed to this function, to avoid
a task disappearing mid-execution. The event loop only keeps
weak references to tasks. A task that isn't referenced elsewhere
may get garbage collected at any time, even before it's done.
c�P>�TR5(a&UR5(dUR5 gUR5(aTR5 gUR5nUbTRU5 gTR	UR55 grb)r�r{r�r|rxrw)�innerr�rBs  �r'�_inner_done_callback�$shield.<locals>._inner_done_callback�ss����?�?����?�?�$�$����!���?�?����L�L�N��/�/�#�C����#�#�C�(�� � �����0r(c�T>�TR5(dTRT5 ggrb)r1r�)rBrLrKs ��r'�_outer_done_callback�$shield.<locals>._outer_done_callback�s"����z�z�|�|��&�&�';�<�r()r
r1rr0r�r�)rHr&rOrLrKrBs   @@@r'rr�sm���B
�#��E��z�z�|�|������U�#�D���� �E�1�"=�
���0�1�	���0�1��Lr(c��^^^�[R"T5(d[S5e[RR5mUUU4SjnTR
U5 T$)zkSubmit a coroutine object to a given event loop.

Return a concurrent.futures.Future to access the result.
zA coroutine object is requiredc��>�[R"[TTS9T5 g![[4a e[
a,nTR
5(aTRU5 eSnAff=fr�)r�
_chain_futurer
r�r�r��set_running_or_notify_cancelr|)r�rUr�r&s ���r'�callback�*run_coroutine_threadsafe.<locals>.callback�s`���	��!�!�-��4�"@�&�I���-�.�	���	��2�2�4�4��$�$�S�)���	�s�#�A)�'A$�$A))rrBrD�
concurrentr�Future�call_soon_threadsafe)rUr&rUr�s`` @r'rr�sP���
�!�!�$�'�'��8�9�9�
�
�
�
&�
&�
(�F��	���h�'��Mr(c�^�SSS.U4SjjnU$)a�Create a function suitable for use as a task factory on an event-loop.

Example usage:

    loop.set_task_factory(
        asyncio.create_eager_task_factory(my_task_constructor))

Now, tasks created will be started immediately (rather than being first
scheduled to an event loop). The constructor argument can be any callable
that returns a Task-compatible object and has a signature compatible
with `Task.__init__`; it must have the `eager_start` keyword argument.

Most applications will use `Task` for `custom_task_constructor` and in
this case there's no need to call `create_eager_task_factory()`
directly. Instead the  global `eager_task_factory` instance can be
used. E.g. `loop.set_task_factory(asyncio.eager_task_factory)`.
Nr�c�>�T"XX#SS9$)NTr8r)r&rUr9r:�custom_task_constructors    �r'�factory�*create_eager_task_factory.<locals>.factorys���&��$�T�K�	Kr(r)r\r]s` r'rr�s���&%)�$�K�K��Nr(c�0�[R"U5 g)z;Register an asyncio Task scheduled to run on an event loop.N)r,r��rYs r'rrs������r(c�0�[R"U5 g)z6Register an asyncio Task about to be eagerly executed.N)r+r�r`s r'r�r�s�����T�r(c�p�[R"U5nUb[SU<SU<S35eU[U'g)NzCannot enter into task z while another task z is being executed.�r#r$r-�r&rYrs   r'rr!sL��!�%�%�d�+�L����4�T�H�=#�#/�"2�2E�G�H�	H��N�4�r(c�n�[R"U5nX!La[SU<SU<S35e[U	g)Nz
Leaving task z! does not match the current task �.rcrds   r'rr)sH��!�%�%�d�+�L����]�4�(�3/�/;�.>�a�A�B�	B��t�r(c�\�[R"U5nUc	[U	U$U[U'U$rb)r#r$)r&rYr�s   r'r�r�1s9���"�"�4�(�I��|��4� ��� $��t���r(c�0�[R"U5 g)z'Unregister a completed, scheduled Task.N)r,�discardr`s r'rr:s�����T�"r(c�0�[R"U5 g)z6Unregister a task which finished its first eager step.N)r+rir`s r'r�r�?s������r()rr�rr�rrr�r,r+r#rrb)Qr��__all__�concurrent.futuresrWrLr�r�r.r!�types�weakrefrr<rrrrrrr �countrrErr�	_PyFuturer�_PyTask�_asyncio�_CTask�ImportErrorrrrrrr�rr�r�r�r	�	coroutinerr
r
rXr/rrrrr�WeakSetr,r�r+r#rr�rrr�rr��_py_current_task�_py_register_task�_py_register_eager_task�_py_unregister_task�_py_unregister_eager_task�_py_enter_task�_py_leave_task�_py_swap_current_task�_c_current_task�_c_register_task�_c_register_eager_task�_c_unregister_task�_c_unregister_eager_task�
_c_enter_task�
_c_leave_task�_c_swap_current_taskrr(r'�<module>r�sS��6�������������������
�_�_�Q�'�0�0��$�>�6|�7���|�~	��"��
�M�M�!�D�6�#�D��"�$�$�4�4���$�$�4�4���"�"�0�0�
�#�
�7�< �
0�d)�X%�"@,�@,�F!%�3-�l���
��
��(+/��@�w�~�~��:16�C�L?�D�.�4/�t�4���?�?�$���u�����
�
 ���#�
�
 ��"��.��&��2������*��.�(�(�(�(�#�O�%��1��)��5���M��M�-���g�	��	��R�	��	�s$�G
�G�
G�G�G �G 

?>