Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes14kdownloads
tasks.cpython-314.pyc371 linesDownload Raw Back to __pycache__
1+
2��i3�����RtR.t^RIt^RIt^RIt^RIt^RIt^RIt^RI	t	^RI4t5^RI	Ht^RIH
t
^RIHt^RIHt^RIHt^RIHt^R	IHt^R6IHt]P(!^4P*tR/RltR/Rlt!R
R]P24t]t^RIt]P4;ttRt]P"P@t ]P"PBt!]P"PDt"RRR]"/Rlt#Rt$Rt%Rt&Rt'!RR4t(RR/Rlt)]	PTR4t+R/Rlt,RR/Rlt-!RR]P\4t/RR /R!lt0R"t1R#t2R$t3R%t4]4!]4t5]7Pl!4t7]8!4t9/t:R&t;R't<R(t=R)t>R*t?R+t@R,tA]tB];tC]<tD]@tE]AtF]=tG]>tH]?tI]tJ^R-IH;t;H<t<H@t@HAtAH=t=H>t>H?t?HtHt]tK];tL]<tM]@tN]AtO]=tP]>tQ]?tR]tSR# ]dEL/i;i ]dR#i;i)0z0Support for tasks, coroutines and the scheduler.�TaskN)�GenericAlias)�8base_tasks)�9coroutines)�events)�10exceptions)�futures)�queues)�timeoutsc�^�Vf\P!4p\PV4#)z!Return a currently executed task.)r�get_running_loop�_current_tasks�get��loops&�Lib\asyncio\tasks.py�current_taskr%s&���|��&�&�(�����d�#�#�c��Vf\P!4p\\4p\P11!\V4Uu0uF9p\P!V4VJgKVP4'dK7VkK;	up#uupi)z'Return a set of all tasks for the loop.)12rr�list�_eager_tasks�	itertools�chain�_scheduled_tasksr�	_get_loop�done)r�eager_tasks�ts&  r�	all_tasksr,su���|��&�&�(���|�$�K� ���'7��E�>�E�!�� � ��#�t�+�
�45�F�F�H�
�A�E�>�>��>s�B�'B�?Bc��aa�]tRt^8toRtRtRRRRRRRR/V3R	lltV3R13lt]!]	4t14RtRtR
t
RtRtRtRtRR/RltRRRR/RltRRltRtRtRtRRltV3RltRtRtVtV;t#)rz A coroutine wrapped in a Future.TrN�name�context�eager_startFc�<�\SV`VR7VP'dVPR\P!V4'gRVn\
RV:24hVfR\42VnM\V4Vn^Vn15RVnRVnWn
Vf\P!4VnMW@nV'd3VP"P%4'dVP'4R#VP"P)VP*VP R7\-V4R#)rFza coroutine was expected, got NzTask-�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�16is_running�_Task__eager_start�	call_soon�_Task__step�_py_register_task)�self�cororr r!r"�	__class__s&&$$$$�rr'�
Task.__init__Ts����
���d��#��!�!�!��&�&�r�*��%�%�d�+�+�).�D�%��<�T�H�E�F�F��<� �!3�!5� 6�7�D�J��T��D�J�&'��#�!�������17��?�'�4�4�6�D�M�#�M��4�:�:�0�0�2�2���� ��J�J� � ����d�m�m� �D��d�#rc�18<�VP\P8XdUVP'dCRVRR/pVP'dVPVR&VP19P
V4\SV`!4R#)�task�messagez%Task was destroyed but it is pending!�source_tracebackN)	�_stater�_PENDINGr*r(r6�call_exception_handlerr&�__del__)r<r!r>s& �rrG�Task.__del__ssm����;�;�'�*�*�*�t�/H�/H�/H����B��G��%�%�%�.2�.D�.D��*�+��J�J�-�-�g�6�
���rc�.�\P!V4#�N)r�20_task_repr�r<s&r�__repr__�
Task.__repr__�s���$�$�T�*�*rc��VP#rJ)r2rLs&r�get_coro�
Task.get_coro�����z�z�rc��VP#rJ)r5rLs&r�get_context�Task.get_context�s���}�}�rc��VP#rJ)r-rLs&r�get_name�
Task.get_name�rRrc�&�\V4VnR#rJ)r.r-)r<�values&&r�set_name�
Task.set_name�s
����Z��21rc��\R4h)z*Task does not support set_result operation��RuntimeError)r<�results&&r�22set_result�Task.set_result�s���G�H�Hrc��\R4h)z-Task does not support set_exception operationr^)r<�	exceptions&&r�
set_exception�Task.set_exception�s���J�K�Kr�limitc�.�\P!W4#)a%Return the list of stack frames for this task's coroutine.23 24If the coroutine is not done, this returns the stack where it is25suspended.  If the coroutine has completed successfully or was26cancelled, this returns an empty list.  If the coroutine was27terminated by an exception, this returns the list of traceback28frames.29 30The frames are always ordered from oldest to newest.31 32The optional limit gives the maximum number of frames to33return; by default all available frames are returned.  Its34meaning differs depending on whether a stack or a traceback is35returned: the newest frames of a stack are returned, but the36oldest frames of a traceback are returned.  (This matches the37behavior of the traceback module.)38 39For reasons beyond our control, only one stack frame is40returned for a suspended coroutine.41)r�_task_get_stack)r<rgs&$r�	get_stack�Task.get_stack�s��*�)�)�$�6�6r�filec�0�\P!WV4#)a>Print the stack or traceback for this task's coroutine.42 43This produces output similar to that of the traceback module,44for the frames retrieved by get_stack().  The limit argument45is passed to get_stack().  The file argument is an I/O stream46to which the output is written; by default output is written47to sys.stderr.48)r�_task_print_stack)r<rgrls&$$r�print_stack�Task.print_stack�s���+�+�D��>�>rc���RVnVP4'dR#V;P^,
unVPe%VPP	VR7'dR#RVnWnR#)aJRequest that this task cancel itself.49 50This arranges for a CancelledError to be thrown into the51wrapped coroutine on the next cycle through the event loop.52The coroutine then has a chance to clean up or even deny53the request using try/except/finally.54 55Unlike Future.cancel, this does not guarantee that the56task will be cancelled: the exception might be caught and57acted upon, delaying cancellation of the task or preventing58cancellation completely.  The task may also return a value or59raise a different exception.60 61Immediately after this method is called, Task.cancelled() will62not return True (unless the task was already cancelled).  A63task will be marked as cancelled when the wrapped coroutine64terminates with a CancelledError exception (even if cancel()65was not called).66 67This also increases the task's count of cancellation requests.68F��msgT)�_log_tracebackrr/r1�cancelr0�_cancel_message)r<rss&&rru�Task.cancel�si��,$����9�9�;�;���#�#�q�(�#����'����&�&�3�&�/�/�� ���"��rc��VP#)z�Return the count of the task's cancellation requests.69 70This count is incremented when .cancel() is called71and may be decremented using .uncancel().72)r/rLs&r�73cancelling�Task.cancelling�s���*�*�*rc��VP^8�d2V;P^,unVP^8XdRVnVP#)z�Decrement the task's count of cancellation requests.74 75This should be called by the party that called `cancel()` on the task76beforehand.77 78Returns the remaining number of cancellation requests.79F)r/r0rLs&r�uncancel�
Task.uncancel�sE���&�&��*��'�'�1�,�'��*�*�a�/�$)��!��*�*�*rc���\VPV4p\V4VPP	VP80R4\
V4\VPV4pW JgQhVP4'dRVnRpR#\V4R# \
T4i;i TP4'dRTnRpi\T4i;i \TPT4pY JgQhTP4'dRTnRpi\T4i TP4'dRTnRpi\T4i;i;irJ)81�_py_swap_current_taskr6�_py_register_eager_taskr5�run�!_Task__step_run_and_handle_result�_py_unregister_eager_taskrr2r;)r<�	prev_task�curtasks&  r�
__eager_start�Task.__eager_start�s��)�$�*�*�d�;�	�	,�#�D�)�
0��
�
�!�!�$�"C�"C�T�J�)�$�/�
,�/��82�83�I�F����&���9�9�;�;�!%�D�J��D�%�d�+��*�$�/���9�9�;�;�!%�D�J��D�%�d�+��
,�/��84�85�I�F����&���9�9�;�;�!%�D�J��D�%�d�+��	�9�9�;�;�!%�D�J��D�%�d�+�sL�C#�&B#�86C#�B3�#
B0�0C#�3-C �#E�%D/�E�E�/-E�Ec���VP4'd\P!RV:RV:24hVP'd8\	V\P874'gVP
4pRVnRVn\VPV4VPV4\VPV4RpR# \TPT4Rpi;i)z__step(): already done: z, FN)rr�InvalidStateErrorr0�88isinstance�CancelledError�_make_cancelled_errorr1�_py_enter_taskr6r��_py_leave_task)r<�excs&&r�__step�Task.__step89s����9�9�;�;��.�.�*�4�(�"�S�G�<�>�
>������c�:�#<�#<�=�=��0�0�2�� %�D������t�z�z�4�(�	��-�-�c�2��4�:�:�t�,��D��
�4�:�:�t�,��D�s�C�C!c�6<�VPpVfVPR4pMVPV4p\VRR4pVEe�\P90!V4VPJdH\RV:RV:R24pVPPVPWPPR7EM�V'd�W0JdC\RV:24pVPPVPWPPR7EM�\P!W04RVnVPVPVPR7W0nVP 'd4VPP#VP$R7'dRVnEM\R	V:R91V:24pVPPVPWPPR7M�Vf3VPPVPVPR7M�\&P(!V4'dF\RV:R92V:24pVPPVPWPPR7MA\RV:24pVPPVPWPPR7RpR# \*d\pTP 'd'RTn\,ST`ETP$R7Rp?LG\,ST`]TP04Rp?LeRp?i\2P4dpYn\,ST`E4Rp?L�Rp?i\8\:3dp\,ST`yT4hRp?i\>dp\,ST`yT4Rp?L�Rp?ii;i Rpi;i)
N�_asyncio_future_blockingzTask z got Future z attached to a different loopr$zTask cannot await on itself: Frrz-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: ) r2�send�throw�getattrrrr6r_r9r:r5�future_add_to_awaited_byr��add_done_callback�
_Task__wakeupr1r0rurv�inspect�isgenerator�
StopIterationr&rarZrr��_cancelled_exc�KeyboardInterrupt�93SystemExitre�
BaseException)r<r�r=r`�blocking�new_excr>s&&    �r�__step_run_and_handle_result�!Task.__step_run_and_handle_results ����z�z��H	��{����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���94�95�,�,� �K�K��-�-�-�I� �8�8��F�:?��7��0�0� �M�M�4�=�=�1�B�+1�(��,�,�,�#�/�/�6�6�(,�(<�(<� 7� >� >�49�� 1��*�#�#'�(�&��96�<�=�G��J�J�(�(����W�m�m�)�E����97�98�$�$�T�[�[�$�-�-�$�H��$�$�V�,�,�&�)�)-���v�j�B�C���99�100�$�$��K�K��-�-�%�A�'�)=�f�Z�'H�I���101�102�$�$��K�K��-�-�%�A��D��C�	.�� � � �$)��!����4�#7�#7��8�8���"�3�9�9�-�-���(�(�	�"%���G�N����!�:�.�	��G�!�#�&����	'��G�!�#�&�&��	'��f�D�s��'J4�BN�;CN�103BN�*BN�4N�?3L�2N�7L�N�N�,N�-M�N�N�N�M*�*N�7N�8N�N�N�N�Nc���\P!W4VP4VP4RpR# \dpTPT4Rp?RpR#Rp?ii;irJ)r�future_discard_from_awaited_byr`r:r�)r<�futurer�s&& r�__wakeup�
Task.__wakeupgsV���.�.�v�<�	��M�M�O�
�K�K�M�����	��K�K�������	�s�<�A%�A � A%)104rvr�r5r2r1r*rtr0r-r/rJ)�__name__�105__module__�__qualname__�__firstlineno__�__doc__r*r'rG�classmethodr�__class_getitem__rMrPrTrWr[rarerjroruryr|r8r:r�r��__static_attributes__�__classdictcell__�
__classcell__�r>�
__classdict__s@@rrr8s�����+�. ��$�T�$��$�d�$�"�$�>	�$�L�1��+���� �I�L�7��7�.	?�4�	?�d�	?�(�T+�+�,�&�"J�X�rc�R�\P!4pVP!V3/VB#)zUSchedule the execution of a coroutine object in a spawn task.106 107Return a Task object.108)rr�create_task)r=�kwargsrs&, rr�r��s(��109�"�"�$�D����D�+�F�+�+r�timeout�return_whenc�� "�\P!V4'g\P!V4'd"\	R\V4P24hV'g\R4hV\\\39d\RV24h\V4p\;QJdRV4F'gKRM	RM
!RV44'd\	R4h\P!4p\WW#4GRjx�L110#L5i)	a7Wait for the Futures or Tasks given by fs to complete.111 112The fs iterable must not be empty.113 114Returns two sets of Future: (done, pending).115 116Usage:117 118    done, pending = await asyncio.wait(fs)119 120Note: This does not raise TimeoutError! Futures that aren't done121when the timeout occurs are returned in the second set.122zexpect a list of futures, not zSet of Tasks/Futures is empty.zInvalid return_when value: c3�N"�TFp\P!V4x�K	R#5irJ)rr))�.0�fs& r�	<genexpr>�wait.<locals>.<genexpr>�s���1231�b��:�!�!�!�$�$�b�s�#%TFz6Passing coroutines is forbidden, use tasks explicitly.N)r�isfuturerr)r+�typer��124ValueError�FIRST_COMPLETED�FIRST_EXCEPTION�
ALL_COMPLETED�set�anyrr�_wait)�fsr�r�rs&$$ r�waitr��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�125�s�1261�b�1271�s�s�s�1281�b�1291�1�1��P�Q�Q��"�"�$�D��r�K�6�6�6�6�s)�8D�(D�$AD�=D�/D�D�Dc�X�VP4'gVPR4R#R#rJ)rra)�waiter�argss&*r�_release_waiterr��s ���;�;�=�=����$��rc���"�Ve]V^8:dV\V4pVP4'dVP4#\V4GRjx�L130VP4#\P!V4;_uu_4GRjx�L131VGRjx�L132uuRRR4GRjx�L133#LX \P134d
p\ThRp?ii;iLFL>L/ +GRjx�L135'giR#;i5i)a�Wait for the single Future or coroutine to complete, with timeout.136 137Coroutine will be wrapped in Task.138 139Returns result of the Future or coroutine.  When a timeout occurs,140it cancels the task and raises TimeoutError.  To avoid the task141cancellation, wrap it in shield().142 143If the wait is cancelled, the task is also cancelled.144 145If the task suppresses the cancellation and returns a value instead,146that value is returned.147 148This function is a coroutine.149N)	�
ensure_futurerr`�_cancel_and_waitrr��TimeoutErrorr150r�)�futr�r�s&& r�wait_forr��s����F��w�!�|��C� ���8�8�:�:��:�:�<���s�#�#�#�	(��:�:�<������(�(�(��y�)�(�(�
	$���(�(�	(��C�'��	(��)��)�(�(�(�s��AC/�
B&�C/�B(�"#C/�C�C/�	C�C�C�
C/� C�!C/�(C	�=C�C	�	C/�C�C/�C,	�C�151C,	�$C,	�&	C/c��aaa	a152a"�V'gQR4hVP4oRo153VeVPV\S4o154\V4o\	4o	VV	VV155V3RlpVF+pVPV4\P!VS	4K-	SGRjx�L156S157eS158P4VFpVPV4K	\4\4rvVF=pVP4'dVPV4K,VPV4K?	Wg3#L� S159eS160P4TFpTPT4K	i;i5i)zNInternal helper for wait().161 162The fs argument must be a collection of Futures.163zSet of Futures is empty.Nc�H<�S^,oS^8:g?S\8Xg4S\8XddVP4'gNVP4e<SeSP	4SP4'gSP
R4\P!VS4R#)�N)	r�r��	cancelledrdrurrarr�)r��counter�cur_taskr��timeout_handler�s&�����r�_on_completion�_wait.<locals>._on_completion�st����1����q�L��?�*��?�*�A�K�K�M�M�01���
�0I��)��%�%�'��;�;�=�=��!�!�$�'��.�.�q�(�;r)
�
create_future�164call_laterr��lenrr�rr�ru�remove_done_callbackr�r�add)r�r�r�rr�r�r�pendingr�r�r�r�s&&f&    @@@@rr�r��s-����165�)�)�)�2�
�
�
�
!�F��N�������/�6�J���"�g�G��~�H�<�<���	���N�+��(�(��H�5��3�����%��!�!�#��A�
�"�"�>�2���E�3�5�'�
���6�6�8�8��H�H�Q�K��K�K��N�	�166�=��	���%��!�!�#��A�
�"�"�>�2��s1�B
E�D(�D&�D(�BE�&D(�(0E�Ec��8"�\P!4pVP4p\P!\167V4pVP
V4VP4VGRjx�L168VPV4R#L TPT4i;i5i)z<Cancel the *fut* future or task and wait until it completes.N)	rrr��	functools�partialr�r�rur�)r�rr��cbs&   rr�r�s|����"�"�$�D�
�
�
�
!�F�	�	�	�?�F�	3�B����"��%��169�170������ � ��$�	��� � ��$�s0�AB�B�*B�+B�/B�B�B�Bc�Xa�]tRtRtoRtRtRtRtRtRt	Rt171R	tR
R172ltRt
VtR#)�_AsCompletedIteratori*a173Iterator of awaitables representing tasks of asyncio.as_completed.174 175As an asynchronous iterator, iteration yields futures as they finish. As a176plain iterator, new coroutines are yielded that will return or raise the177result of the next underlying future to complete.178c��\P!4VnRVn\P179!4p\
V4Uu0uFp\WCR7kK	ppVFpVPVP4K 	V'd%Ve!VPW P4VnWPn\V4VnR#uupi)Nr)r	�Queue�_done�_timeout_handler�get_event_loopr�r�r��_handle_completionr��_handle_timeout�_todor��180_todo_left)r<�awsr�r�aw�todor�s&&&    rr'�_AsCompletedIterator.__init__1s����\�\�^��181�#����$�$�&��7:�3�x�@�x��
�b�,�x��@��A�
���� 7� 7�8���G�'�����)=�)=�>�
� ��182��d�)����As�Cc��V#rJ�rLs&r�	__aiter__�_AsCompletedIterator.__aiter__@����rc��V#rJr�rLs&r�__iter__�_AsCompletedIterator.__iter__Cr�rc���"�VP'g\hVP^8�gQhV;P^,unVP4GRjx�L183#L5i)�N)r��StopAsyncIteration�
_wait_for_onerLs&r�	__anext__�_AsCompletedIterator.__anext__FsI�������$�$�����"�"�"����1����'�'�)�)�)�)�s�AA!�A�A!c��VP'g\hVP^8�gQhV;P^,unVPRR7#)rT)�resolve)r�r�rrLs&r�__next__�_AsCompletedIterator.__next__MsE������������"�"�"����1����!�!�$�!�/�/rc���VPF9pVPVP4VPP	R4K;	VPP4R#rJ)r�r�r�r��184put_nowait�clear�r<r�s& rr��$_AsCompletedIterator._handle_timeoutTsH�����A�
�"�"�4�#:�#:�;��J�J�!�!�$�'��	
�185�186���rc��VP'gR#VPPV4VPPV4VP'g-VPeVPP4R#R#R#rJ)r��remover�rr�rur
s&&rr��'_AsCompletedIterator._handle_completionZs_���z�z�z���187�188���!���189�190���a� ��z�z�z�d�2�2�>�� � �'�'�)�?�zrc��"�VPP4GRjx�L191pVf\PhV'dVP	4#T#L25irJ)r�rrr�r`)r<rr�s&& rr�"_AsCompletedIterator._wait_for_onebsC����*�*�.�.�"�"���9��)�)�)�$�q�x�x�z�+�!�+�	
#�s�A�A�A�A)r�r�r�r�N)F)r�r�r�r�r�r'r�r�rrr�r�rr�r�)r�s@rr�r�*s7�����
$���*�0��*�,�,rr�c��\P!V4'd"\R\V4P24h\W4#)a�Create an iterator of awaitables or their results in completion order.192 193Run the supplied awaitables concurrently. The returned object can be194iterated to obtain the results of the awaitables as they finish.195 196The object returned can be iterated as an asynchronous iterator or a plain197iterator. When asynchronous iteration is used, the originally-supplied198awaitables are yielded if they are tasks or futures. This makes it easy to199correlate previously-scheduled tasks with their results:200 201    ipv4_connect = create_task(open_connection("127.0.0.1", 80))202    ipv6_connect = create_task(open_connection("::1", 80))203    tasks = [ipv4_connect, ipv6_connect]204 205    async for earliest_connect in as_completed(tasks):206        # earliest_connect is done. The result can be obtained by207        # awaiting it or calling earliest_connect.result()208        reader, writer = await earliest_connect209 210        if earliest_connect is ipv6_connect:211            print("IPv6 connection established.")212        else:213            print("IPv4 connection established.")214 215During asynchronous iteration, implicitly-created tasks will be yielded for216supplied awaitables that aren't tasks or futures.217 218When used as a plain iterator, each iteration yields a new coroutine that219returns the result or raises the exception of the next completed awaitable.220This pattern is compatible with Python versions older than 3.13:221 222    ipv4_connect = create_task(open_connection("127.0.0.1", 80))223    ipv6_connect = create_task(open_connection("::1", 80))224    tasks = [ipv4_connect, ipv6_connect]225 226    for next_connect in as_completed(tasks):227        # next_connect is not one of the original task objects. It must be228        # awaited to obtain the result value or raise the exception of the229        # awaitable that finishes next.230        reader, writer = await next_connect231 232A TimeoutError is raised if the timeout occurs before all awaitables are233done. This is raised by the async for loop during asynchronous iteration or234by the coroutines yielded during plain iteration.235z'expects an iterable of awaitables, not )r��isawaitabler+r�r�r�)r�r�s&$r�as_completedrmsE��\���2����5�d�2�h�6G�6G�5H�I�236�	237� ��,�,rc#�"�Rx�R#5i)z�Skip one event loop run cycle.238 239This is a private helper for 'asyncio.sleep()', used240when the 'delay' is set to 0.  It uses a bare 'yield'241expression (which Task.__step knows how to handle)242instead of creating a Future object.243Nr�r�rr�__sleep0r�s244���245�s�	c��"�V^8:d\4GRjx�L246V#\P!V4'd\R4h\P247!4pVP
4pVPV\PW14pVGRjx�L248VP4#L�L TP4i;i5i)z9Coroutine that completes after a given time (in seconds).Nz!Invalid delay: NaN (not a number))r�math�isnanr�rrr�r�r�_set_result_unless_cancelledru)�delayr`rr��hs&&   r�sleepr�s������z��j����
��z�z�%����<�=�=��"�"�$�D�
�
�
�
!�F������<�<��	(�A���|�	���249�	���	���250�s?�B?�B&�!B?�AB?�B*�B(�B*�B?�(B*�*B<�<B?rc���\P!V4'd,Ve&V\P!V4Jd\R4hV#Rp\P251!V4'g6\P!V4'dRpV!V4pRpM\R4hVf\P!4pVPV4# \dT'dTP4hi;i)zeWrap a coroutine or an awaitable in a future.252 253If the argument is a Future, it is returned directly.254zRThe future belongs to a different loop than the one specified as the loop argumentTc��""�VGRjx�L255#L5irJr�)�	awaitables&r�_wrap_awaitable�&ensure_future.<locals>._wrap_awaitable�s���&��&��s��
�Fz:An asyncio.Future, a coroutine or an awaitable is required)rr�rr�rr)r�rr+rr�r�r_�close)�coro_or_futurer�should_closer#s&$  rr�r��s���256����'�'����G�,=�,=�n�,M� M��E�F�
F����L��!�!�.�1�1����~�.�.�
'�-�^�<�N� �L��*�+�
+��|��$�$�&�������/�/������ � �"�
��s�5C�C+�C+c�@aa�]tRtRtoRtV3RltRRltRtVtV;t	#)�_GatheringFuturei�z�Helper for gather().257 258This overrides cancel() to cancel all the children and act more259like Task.cancel(), which doesn't immediately mark itself as260cancelled.261c�N<�VfQh\SV`VR7WnRVnR#)NrF)r&r'�	_children�_cancel_requested)r<�childrenrr>s&&$�rr'�_GatheringFuture.__init__�s,�������
���d��#�!��!&��rc��VP4'dR#RpVPFpVPVR7'gKRpK!	V'dRVnV#)FrrT)rr+rur,)r<rs�ret�childs&&  rru�_GatheringFuture.cancel�sM���9�9�;�;�����^�^�E��|�|��|�$�$���$��&*�D�"��262r)r,r+rJ)263r�r�r�r�r�r'rur�r�r�r�s@@rr)r)�s�����'��rr)�return_exceptionsFc��aa	a264aa�V'g9\P!4pVP4oSP.4S#\P!4pVe
\V4pMRpV3V	V265VVV3Rllp/p.o	^o^o266.pRoVF�pWu9d�\
WrR7pVf\P!V4pW�JdRVn	S^,
oW�V&VP4'dVPV4M4Ve\P!W�4VPV4MWW,pS	PV4K�	\S	VR7oVFpV!V4K
	S#)aMReturn a future aggregating results from the given coroutines/futures.267 268Coroutines will be wrapped in a future and scheduled in the event269loop. They will not necessarily be scheduled in the same order as270passed in.271 272All futures must share the same event loop.  If all the tasks are273done successfully, the returned future's result is the list of274results (in the order of the original sequence, not necessarily275the order of results arrival).  If *return_exceptions* is True,276exceptions in the tasks are treated the same as successful277results, and gathered in the result list; otherwise, the first278raised exception will be immediately propagated to the returned279future.280 281Cancellation: if the outer Future is cancelled, all children (that282have not completed yet) are also cancelled.  If any child is283cancelled, this is treated as if it raised CancelledError --284the outer Future is *not* cancelled in this case.  (This is to285prevent the cancellation of one child to cause other children to286be cancelled.)287 288If *return_exceptions* is False, cancelling gather() after it289has been marked done won't cancel any submitted awaitables.290For instance, gather can be marked done after propagating an291exception to the caller, therefore, calling ``gather.cancel()``292after catching an exception (raised by one of the awaitables) from293gather won't cancel any other awaitables.294Nc�N<�S^,
oVe\P!W4SeSP4'd)VP4'gVP	4R#S	'gaVP4'd$VP4pSP
V4R#VP	4pVeSP
V4R#SS8Xd�.pSFpVP4'd2\P!VPfRMVP4pM$VP	4pVfVP4pVPV4K�	SP'd$VP4pSP
V4R#SPV4R#R#)r�N�)rr�rr�rdr�rerr�rvr`�appendr,ra)295r�r�r��results�resr-�	nfinished�nfuts�outerr3s296&&   �����r�_done_callback�gather.<locals>._done_callback*sK����Q��	����2�2�3�A��=�E�J�J�L�L��=�=�?�?��
�
��� ��}�}����/�/�1���#�#�C�(���m�m�o���?��'�'��,������G����=�=�?�?�%�3�3�!�1�1�9���+�+�-�C��-�-�/�C��{�!�j�j�l�����s�#� �"�&�&�&��/�/�1���#�#�C�(�� � ��)�;rrF)rr�r�ra�_get_running_looprr�rrr*rr7r�r�r))
r3�coros_or_futuresrr�r=�297arg_to_fut�	done_futs�argr�r-r:r;r<s
d*       @@@@r�gatherrDsM���<��$�$�&���"�"�$��
��������#�#�%�D�����%����%-�8*�8*�t�J��H�
�E��I��I��E���� ���/�C��|��(�(��-���~�298,1��(��Q�J�E�!�s�O��x�x�z�z�� � ��%��'��4�4�S�C��%�%�n�5��/�C������1 �4
�X�D�1�E����s����Lrc��VP4'dR#VP4pVfR#RVPPR2RVRV/pVP'dVPVR&VP299P
V4R#)NrBz exception in shielded futurerdr�rC)r�rdr>r�r(r6rF)r�r�r!s&  r�_log_on_exceptionrF�s���300�}�}����301
�-�-�/�C�302�{��	��=�=�!�!�303"�"?�@��S��#�	�G�����&)�&;�&;��"�#��I�I�$�$�W�-rc�aaaa�\V4oSP4'dS#\P!S4pVP	4oVe(\V4;oe\P!SS4MRoV3RlpV3RloVV3RlpSeSPV4SPS4SPV4S#)a-Wait for a future, shielding it from cancellation.304 305The statement306 307    task = asyncio.create_task(something())308    res = await shield(task)309 310is exactly equivalent to the statement311 312    res = await something()313 314*except* that if the coroutine containing it is cancelled, the315task running in something() is not cancelled.  From the POV of316something(), the cancellation did not happen.  But its caller is317still cancelled, so the yield-from expression still raises318CancelledError.  Note: If something() is cancelled by other means319this will still cancel shield().320 321If you want to completely ignore cancellation (not recommended)322you can combine shield() with a try/except clause, as follows:323 324    task = asyncio.create_task(something())325    try:326        res = await shield(task)327    except CancelledError:328        res = None329 330Save a reference to tasks passed to this function, to avoid331a task disappearing mid-execution. The event loop only keeps332weak references to tasks. A task that isn't referenced elsewhere333may get garbage collected at any time, even before it's done.334Nc�6<�\P!VS4R#rJ)rr�)�innerr�s&�r�_clear_awaited_by_callback�*shield.<locals>._clear_awaited_by_callback�s����.�.�u�h�?rc�<�SP4'dR#VP4'dSP4R#VP4pVeSPV4R#SP	VP44R#rJ)r�rurdrerar`)rIr�r<s& �r�_inner_done_callback�$shield.<locals>._inner_done_callback�s\����?�?�����?�?����L�L�N��/�/�#�C����#�#�C�(�� � �����0rc�<�SP4'g>SPS4SP\4SP\4R#R#rJ)rr�rFr�)r<rMrIs&��r�_outer_done_callback�$shield.<locals>._outer_done_callback�s@����z�z�|�|��&�&�';�<��&�&�'8�9��#�#�$5�6�	r)r�rrrr�rr�r�)rCrrJrPrMr�rIr<s&   @@@@r�shieldrR�s����B
�#��E��z�z�|�|������U�#�D���� �E����d�);�;�X�H��(�(���9���@�1�7���
��� :�;�335���0�1�	���0�1��Lrc��aaa�\P!S4'g\R4h\PP4oVVV3RlpSP
V4S#)zkSubmit a coroutine object to a given event loop.336 337Return a concurrent.futures.Future to access the result.338zA coroutine object is requiredc��<�\P!\SSR7S4R# \\3dh\339d.pSP
4'dSPT4hRp?ii;i)rN)r�
_chain_futurer�r�r�r��set_running_or_notify_cancelre)r�r=r�rs ���r�callback�*run_coroutine_threadsafe.<locals>.callback�s`���	��!�!�-��4�"@�&�I���-�.�	���	��2�2�4�4��$�$�S�)���	�s�"'�A0�A0�(A+�+A0)rr)r+�340concurrentr�Future�call_soon_threadsafe)r=rrWr�sff @r�run_coroutine_threadsafer\�sP���341�!�!�$�'�'��8�9�9�
�
�
�
&�
&�
(�F��	���h�'��Mrc�a�RR/V3RllpV#)a�Create a function suitable for use as a task factory on an event-loop.342 343Example usage:344 345    loop.set_task_factory(346        asyncio.create_eager_task_factory(my_task_constructor))347 348Now, tasks created will be started immediately (rather than being first349scheduled to an event loop). The constructor argument can be any callable350that returns a Task-compatible object and has a signature compatible351with `Task.__init__`; it must have the `eager_start` keyword argument.352 353Most applications will use `Task` for `custom_task_constructor` and in354this case there's no need to call `create_eager_task_factory()`355directly. Instead the  global `eager_task_factory` instance can be356used. E.g. `loop.set_task_factory(asyncio.eager_task_factory)`.357r"Tc�<�S!V3RVRV/VB#)rr"r�)rr=r"r��custom_task_constructors&&$,�r�factory�*create_eager_task_factory.<locals>.factorys0���&��@��@�)4�@�8>�@�	@rr�)r_r`sf r�create_eager_task_factoryrbs���&@�4�@��Nrc�0�\PV4R#)z;Register an asyncio Task scheduled to run on an event loop.N)rr��rAs&r�_register_taskre.s������rc�0�\PV4R#)z6Register an asyncio Task about to be eagerly executed.N)rr�rds&r�_register_eager_taskrg3s�����T�rc�r�\PV4pVe\RV:RV:R24hV\V&R#)NzCannot enter into task z while another task z is being executed.�r
rr_�rrArs&& r�_enter_taskrk8sL��!�%�%�d�+�L����4�T�H�=#�#/�"2�2E�G�H�	H��N�4�rc�p�\PV4pW!Jd\RV:RV:R24h\VR#)z
Leaving task z! does not match the current task �.Nrirjs&& r�_leave_taskrn@sH��!�%�%�d�+�L����]�4�(�3/�/;�.>�a�A�B�	B��t�rc�\�\PV4pVf358\VV#V\V&V#rJ)r
r)rrAr�s&& r�_swap_current_taskrpHs9���"�"�4�(�I��|��4� ��� $��t���rc�0�\PV4R#)z'Unregister a completed, scheduled Task.N)r�discardrds&r�_unregister_taskrsQs�����T�"rc�0�\PV4R#)z6Unregister a task which finished its first eager step.N)rrrrds&r�_unregister_eager_taskruVs������r)	rergrsrurkrnrprr)rr�r�r�r�r�r�rrrDrRr�r\rrrb�eager_task_factoryrersrkrnrJ)Tr��__all__�concurrent.futuresrYr3r�r�rr�types�weakrefrr6rrrrrr	r359�countrr,rr�	_PyFuturer�_PyTask�_asyncio�_CTask�ImportErrorr�r�r�r�r�r�r�r�r�r�r�	coroutinerrr�rZr)rDrFrRr\rbrv�WeakSetrr�rr
rergrkrnrprsru�_py_current_taskr;r��_py_unregister_taskr�r�r�r�
_py_all_tasks�_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_task�_c_all_tasksr�rr�<module>r�se��6�������������������360�_�_�Q�'�0�0��$�	>�~�7���~�B361��"��362�M�M�!�D�6�,��$�$�4�4���$�$�4�4���"�"�0�0�
�7�d�7�
�7�< �3630�d,�^%�"@,�@,�F3-��3-�l���364��365��(�$��@�w�~�~��:L��L�^.�&J�Z�.�4/�t�4���?�?�$���u�����366�367 ���#�368�369 ��"��.��&��2������*���
��3�3�3�#�O�%��1��)��5���M��M�-���L��o�	��	��X�	��	�s$�G370� G�371G�G�G#�"G#
codekingpro/portable-devtools · Team Ai