AlkantarClanX12

Your IP : 3.143.237.140


Current Path : /opt/alt/python312/lib64/python3.12/asyncio/__pycache__/
Upload File :
Current File : //opt/alt/python312/lib64/python3.12/asyncio/__pycache__/tasks.cpython-312.opt-2.pyc

�

�Q�f����	dZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddlm
Z
ddlmZddlm
Z
ddlmZddlmZdd	lmZdd
lmZej$d�j&Zd.d�Zd.d�Zd
�ZGd�dej0�ZeZ	ddlZej2xZZddd�d�Zej j>Zej j@Z ej jBZ!de!d�d�Z"d�Z#d�Z$d�Z%d�Z&dd�d�Z'ejPd��Z)d.d�Z*dd�d�Z+Gd�dejX�Z-d d!�d"�Z.d#�Z/d$�Z0d%�Z1e1e�Z2e	jf�Z4e5�Z6iZ7d&�Z8d'�Z9d(�Z:d)�Z;d*�Z<d+�Z=d,�Z>eZ?e8Z@e9ZAe=ZBe>ZCe:ZDe;ZEe<ZF	dd-lm8Z8m9Z9m=Z=m>Z>m:Z:m;Z;m<Z<m4Z4m6Z6m7Z7mZeZGe8ZHe9ZIe=ZJe>ZKe:ZLe;ZMe<ZNy#e$rY��wxYw#e$rYywxYw)/)�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)�timeoutsc�Z�	|�tj�}tj|�S�N)r�get_running_loop�_current_tasks�get��loops �4/opt/alt/python312/lib64/python3.12/asyncio/tasks.pyrr$s)��+��|��&�&�(�����d�#�#�c�P�	|�tj�}tt�}d}d}		tt�}	t
j||�D�chc]+}tj|�|ur|j�s|��-c}S#t
$r|dz
}|dk\r�YnwxYw�wcc}w)Nrri�)rr"�list�_eager_tasks�_scheduled_tasks�RuntimeError�	itertools�chainr�	_get_loop�done)r&�eager_tasks�scheduled_tasks�i�ts     r'rr+s���1��|��&�&�(���|�$�K��O�	�A�
�	�"�#3�4�O�
� �����D�>�D�!�� � ��#�t�+�A�F�F�H�
�D�>�>��
�	�
��F�A��D�y���	����>s�B�0B#�B�Bc��|�	|j}||�yy#t$rtjdtd��YywxYw)Nz~Task.set_name() was added in Python 3.8, the method support will be mandatory for third-party task implementations since 3.13.�)�
stacklevel)�set_name�AttributeError�warnings�warn�DeprecationWarning)�task�namer9s   r'�_set_task_namer@FsM����	��}�}�H�
�T�N����	8��M�M�9�)�Q�
8�	8�s��%A�Ac���eZdZ	dZddddd��fd�
Z�fd�Zee�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zdd�d�Zddd�d�Zdd�Zd�Zd�Zd�Zdd�Z�fd�Zd�Z�xZS)rTNF�r&r?�context�eager_startc�F��t�|�|��|jr
|jd=tj|�sd|_t
d|����|�dt���|_nt|�|_d|_
d|_d|_||_
|�tj�|_n||_|r+|j"j%�r|j'�y|j"j)|j*|j ��t-|�y)Nr%���Fza coroutine was expected, got zTask-r�rC)�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&r?rCrD�	__class__s      �r'rIz
Task.__init__os����
���d��#��!�!��&�&�r�*��%�%�d�+�).�D�%��<�T�H�E�F�F��<� �!3�!5� 6�7�D�J��T��D�J�&'��#�!��������
��?�'�4�4�6�D�M�#�D�M��4�:�:�0�0�2���� ��J�J� � ����d�m�m� �D��4� r(c����|jtjk(rG|jr;|dd�}|jr|j|d<|j
j
|�t�|�!�y)Nz%Task was destroyed but it is pending!)r>�message�source_traceback)	�_stater�_PENDINGrLrJrX�call_exception_handlerrH�__del__)r]rCr_s  �r'rfzTask.__del__�sb����;�;�'�*�*�*�t�/H�/H��B��G��%�%�.2�.D�.D��*�+��J�J�-�-�g�6�
���r(c�,�tj|�Sr!)r�
_task_repr�r]s r'�__repr__z
Task.__repr__�s���$�$�T�*�*r(c��|jSr!)rTris r'�get_coroz
Task.get_coro�����z�z�r(c��|jSr!)rWris r'�get_contextzTask.get_context�s���}�}�r(c��|jSr!)rOris r'�get_namez
Task.get_name�rmr(c�$�t|�|_yr!)rPrO)r]�values  r'r9z
Task.set_name�s
����Z��
r(c��td��)Nz*Task does not support set_result operation�r-)r]�results  r'�
set_resultzTask.set_result�s���G�H�Hr(c��td��)Nz-Task does not support set_exception operationru)r]�	exceptions  r'�
set_exceptionzTask.set_exception�s���J�K�Kr()�limitc�0�	tj||�Sr!)r�_task_get_stack)r]r{s  r'�	get_stackzTask.get_stack�s��	�(�)�)�$��6�6r()r{�filec�2�	tj|||�Sr!)r�_task_print_stack)r]r{rs   r'�print_stackzTask.print_stack�s��	��+�+�D�%��>�>r(c���	d|_|j�ry|xjdz
c_|j�|jj	|��ryd|_||_y)NFr��msgT)�_log_tracebackr1rQrS�cancelrR�_cancel_message)r]r�s  r'r�zTask.cancel�sk��	�*$����9�9�;���#�#�q�(�#����'����&�&�3�&�/�� ���"���r(c��	|jSr!�rQris r'�
cancellingzTask.cancelling�s��	�
�*�*�*r(c�d�	|jdkDr|xjdzc_|jS)Nrrr�ris r'�uncancelz
Task.uncancels4��	��&�&��*��'�'�1�,�'��*�*�*r(c�p�t|j|�}	t|�	|jj	|j
d�t
|�		t|j|�}|j�r
d|_d}yt|�y#t
|�wxYw#|j�r
d|_d}wt|�wxYw#	t|j|�}|j�r
d|_d}wt|�w#|j�r
d|_d}wt|�wxYwxYwr!)
�_swap_current_taskrX�_register_eager_taskrW�run�!_Task__step_run_and_handle_result�_unregister_eager_taskr1rTr)r]�	prev_task�curtasks   r'�
__eager_startzTask.__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
�
D5�D�%&D5�'D2�2D5c��|j�rtjd|�d|����|jr1t	|tj
�s|j
�}d|_d|_t|j|�	|j|�t|j|�d}y#t|j|�d}wxYw)Nz_step(): already done: z, F)r1r�InvalidStateErrorrR�
isinstance�CancelledError�_make_cancelled_errorrSrrXr�r)r]�excs  r'�__stepzTask.__step#s����9�9�;��.�.�)�$���C�7�;�=�
=�����c�:�#<�#<�=��0�0�2�� %�D������D�J�J��%�	��-�-�c�2���
�
�D�)��D��
��
�
�D�)��D�s�B1�1Cc����|j}	|�|jd�}n|j|�}t|dd�}|��lt	j
|�|jurGtd|�d|�d��}|jj|j||j��d}y|r�||urCtd|���}|jj|j||j��d}yd|_|j|j|j��||_|j�rN|jj!|j"���r'd|_	d}ytd	|�d
|���}|jj|j||j��	d}y|�4|jj|j|j��d}yt%j&|�rFtd|�d
|���}|jj|j||j��d}ytd|���}|jj|j||j��	d}yd}y#t($rS}|jr"d|_t*�|�A|j"��nt*�|�Y|j.�Yd}~d}yd}~wt0j2$r!}||_t*�|�A�Yd}~d}yd}~wt6t8f$r}t*�|�u|��d}~wt<$r}t*�|�u|�Yd}~d}yd}~wwxYw#d}wxYw)
N�_asyncio_future_blockingzTask z got Future z attached to a different looprGzTask 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: )rT�send�throw�getattrrr0rXr-r[r\rWr��add_done_callback�
_Task__wakeuprSrRr�r��inspect�isgenerator�
StopIterationrHrwrsrr��_cancelled_exc�KeyboardInterrupt�
SystemExitrz�
BaseException)r]r�r^rv�blocking�new_excr_s      �r'�__step_run_and_handle_resultz!Task.__step_run_and_handle_result4se����z�z��G	��{����4������C���$�v�'A�4�H�H��#��$�$�V�,�D�J�J�>�*���x�|�!�*�$A�C�D�G��J�J�(�(����W�d�m�m�)�E�P�D�M���~�".�;�D�8�D�#F���
�
�,�,� �K�K��$�-�-�-�I�D�D�?;@��7��0�0� �M�M�4�=�=�1�B�+1��(��,�,�#�/�/�6�6�(,�(<�(<� 7� >�49�� 1�0�D�-+�#�#'�(�&��
�<�=�G��J�J�(�(����W�d�m�m�)�E�&�D�!���
�
�$�$�T�[�[�$�-�-�$�H��D��$�$�V�,�&�)�)-���v�j�B�C���
�
�$�$��K�K��$�-�-�%�A��D�	'�)=�f�Z�'H�I���
�
�$�$��K�K��$�-�-�%�A��D�4�D��A�	.�� � �$)��!����4�#7�#7��8���"�3�9�9�-��t�D��s�(�(�	�"%�D���G�N���l�D��k"�:�.�	��G�!�#�&����	'��G�!�#�&�&�b�D��e	'��d�D�s��%J�A5M�,AM�5A0M�)AM�03M�&AM�AM�	M�AK�M�M�5L�
M�M�#L3�3M�?M�M�M�M�M!c��	|j�|j�d}y#t$r}|j|�Yd}~d}yd}~wwxYwr!)rvr\r�)r]�futurer�s   r'�__wakeupz
Task.__wakeupsH��	��M�M�O�
�K�K�M�����	��K�K�������	�s�%�	A�A�Ar!)�__name__�
__module__�__qualname__rLrIrf�classmethodr�__class_getitem__rjrlrorqr9rwrzr~r�r�r�r�rZr\r�r��
__classcell__�r_s@r'rrSs����+�. ��%)��d�"�!�>	�$�L�1��+���� �I�L�"&�7�.$(�d�	?�(�T+�
+�)�&�"I�Vr(r�r?rCc��	tj�}|�|j|�}n|j||��}t||�|S)NrG)rr"rr@)r^r?rCr&r>s     r'rr�sP����"�"�$�D�������%������g��6���4����Kr()�timeout�return_whenc��K�	tj|�stj|�r!t	dt|�j����|std��|tttfvrtd|����t|�}td�|D��rt	d��tj�}t||||��d{���S7��w)Nzexpect a list of futures, not zSet of Tasks/Futures is empty.zInvalid return_when value: c3�FK�|]}tj|����y�wr!)rrK)�.0�fs  r'�	<genexpr>zwait.<locals>.<genexpr>�s����
1�b��:�!�!�!�$�b�s�!z6Passing coroutines is forbidden, use tasks explicitly.)r�isfuturerrKrM�typer��
ValueErrorrrr�set�anyrr"�_wait)�fsr�r�r&s    r'rr�s�����������z�5�5�b�9��8��b��9J�9J�8K�L�M�M�
��9�:�:��?�O�]�K�K��6�{�m�D�E�E�	�R��B�
�
1�b�
1�1��P�Q�Q��"�"�$�D��r�7�K��6�6�6�6�s�CC�
C�Cc�H�|j�s|jd�yyr!)r1rw)�waiter�argss  r'�_release_waiterr��s���;�;�=����$��r(c��K�	|�T|dkrOt|�}|j�r|j�St|��d{���	|j�Stj|�4�d{���|�d{���cddd��d{���S7�N#tj
$r}t|�d}~wwxYw7�C7�;7�-#1�d{���7swYyxYw�w�Nr)	r
r1rv�_cancel_and_waitrr��TimeoutErrorrr�)�futr�r�s   r'rr�s������D��w�!�|��C� ���8�8�:��:�:�<���s�#�#�#�	(��:�:�<������(�(��y����
	$���(�(�	(��C�'��	(��)������(�(�(�s��AC�B�C�
B�C�3B7�4C�7B=�=B9�>B=�C�
B;�C�B4�(B/�/B4�4C�9B=�;C�=C�C�C�Cc��2���	�
K�	|j��
d�	|�|j|t�
��	t|�����	�
fd�}|D]}|j	|��	�
�d{����	��	j�|D]}|j
|��	t�t�}}|D]5}|j�r|j|��%|j|��7||fS7��#�	��	j�|D]}|j
|��wxYw�w)Nc�����dz��dks2�tk(s)�tk(rW|j�sF|j��5���j	��j�s�j
d�yyyyy)Nrr)rr�	cancelledryr�r1rw)r��counterr��timeout_handler�s ����r'�_on_completionz_wait.<locals>._on_completionst����1����q�L��?�*��?�*�A�K�K�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�'�D�
���6�6�8��H�H�Q�K��K�K��N�	�
��=��	���%��!�!�#��A�
�"�"�>�2��s1�AD�C(�$C&�%C(�)A=D�&C(�(,D�Dc��4K�	tj�}|j�}tjt
|�}|j
|�	|j�|�d{���|j|�y7�#|j|�wxYw�wr!)	rr"r��	functools�partialr�r�r�r�)r�r&r��cbs    r'r�r�6s~����F��"�"�$�D�
�
�
�
!�F�	�	�	�?�F�	3�B����"��%��
�
������ � ��$�	��� � ��$�s0�AB�B�)B�*B�.B�B�B�B)r�c#�
��	�
�K�	tj|�stj|�r!t	dt|�j����ddlm}|��	tj�}t|�D�chc]}t||����c}�d�
��	�fd�}�	�
�fd���	fd�}�D]}|j����r|�|j||��
tt!���D]}|����
ycc}w�w)Nz#expect an iterable of futures, not r)�Queuer%c�x���D]$}|j���jd��&�j�yr!)r��
put_nowait�clear)r�r�r1�todos ���r'�_on_timeoutz!as_completed.<locals>._on_timeoutds2����A�
�"�"�>�2��O�O�D�!��	
�
�
�r(c�|���sy�j|��j|��s���j�yyyr!)�remover�r�)r�r1r�r�s ���r'r�z$as_completed.<locals>._on_completionjs;��������A���������2��!�!�#�3�tr(c���K��j��d{���}|�tj�|j�S7�&�wr!)r$rr�rv)r�r1s �r'�
_wait_for_onez#as_completed.<locals>._wait_for_oners7������(�(�*����9��)�)�)��x�x�z��	
�s�A�>�'A)rr�rrKrMr�r��queuesr�r�get_event_loopr�r
r�r��ranger�)r�r�r�r&r�r�r��_r�r1r�r�s        @@@@r'r	r	Hs�������"�����z�5�5�b�9��=�d�2�h�>O�>O�=P�Q�R�R���7�D�� � �"�D�14�R��9��A�M�!�$�'��9�D��N��$����	���N�+����#�����+�>��
�3�t�9�
���o����9:�s�A;D�C>�A.Dc#�K�	d��y�wr!�r�r(r'�__sleep0r��s�����
�s�	c��2K�	|dkrt��d{���|Stj�}|j�}|j	|t
j||�}	|�d{���|j�S7�g7�#|j�wxYw�wr�)r�rr"r�r�r�_set_result_unless_cancelledr�)�delayrvr&r��hs     r'r
r
�s�����C���z��j����
��"�"�$�D�
�
�
�
!�F������<�<���	(�A���|�	���
�	����	���
�s:�B�A>�AB�$B�)B�*B�-B�B�B�Br%c��	tj|�r&|�"|tj|�urtd��|Sd}t	j
|�s.t
j|�rd�}||�}d}ntd��|�tj�}	|j|�S#t$r|r|j��wxYw)NzRThe future belongs to a different loop than the one specified as the loop argumentTc��"K�|�d{���S7��wr!r�)�	awaitables r'�_wrap_awaitablez&ensure_future.<locals>._wrap_awaitable�s����&��&��s��
�Fz:An asyncio.Future, a coroutine or an awaitable is required)rr�r0r�rrKr��isawaitablerMrr�rr-�close)�coro_or_futurer&�should_closer�s    r'r
r
�s��������'����G�,=�,=�n�,M� M��E�F�
F����L��!�!�.�1����~�.�
'�-�^�<�N� �L��*�+�
+��|��$�$�&�������/�/������ � �"�
��s�B*�*Cc�(��eZdZ	�fd�Zdd�Z�xZS)�_GatheringFuturec�B��t�|�|��||_d|_y)Nr%F)rHrI�	_children�_cancel_requested)r]�childrenr&r_s   �r'rIz_GatheringFuture.__init__�s"���
���d��#�!���!&��r(c��|j�ryd}|jD]}|j|��s�d}�|rd|_|S)NFr�T)r1rr�r)r]r��ret�childs    r'r�z_GatheringFuture.cancel�sH���9�9�;�����^�^�E��|�|��|�$���$��&*�D�"��
r(r!)r�r�r�rIr�r�r�s@r'rr�s����'�r(rF)�return_exceptionsc����	�
��	|s7tj�}|j���jg��S��	�
��fd�}i}g�d�
d�	g}d}d�|D]�}||vrmt	||��}|�tj|�}||urd|_�
dz
�
|||<|j�r|j|�n|j|�n||}�j|���t�|���|D]
}||���S)Nc����dz
����j�r!|j�s|j�y�sV|j�r"|j�}�j	|�y|j�}|��j	|�y��k(r�g}�D]s}|j�r.tj|j�dn|j�}n"|j�}|�|j�}|j|��u�jr"|j�}�j	|�y�j|�yy)Nr�)r1r�ryr�rzrr�r�rv�appendrrw)	r�r��results�resr�	nfinished�nfuts�outerr	s	    �����r'�_done_callbackzgather.<locals>._done_callback�s,����Q��	��=�E�J�J�L��=�=�?��
�
��� ��}�}���/�/�1���#�#�C�(���m�m�o���?��'�'��,������G����=�=�?�%�3�3�!�1�1�9���+�+�-�C��-�-�/�C��{�!�j�j�l�����s�#� �"�&�&��/�/�1���#�#�C�(�� � ��)�;r(rr%Fr)rr�r�rwr
rr0rLr1r
r�r)r	�coros_or_futuresr&r�
arg_to_fut�	done_futs�argr�rrrrs`       @@@@r'rr�s%����:��$�$�&���"�"�$��
�������5*�5*�n�J��H�
�E��I��I��D��E����j� ���$�/�C��|��(�(��-���#�~�
,1��(��Q�J�E�!�J�s�O��x�x�z�� � ��%��%�%�n�5��S�/�C������/ �2
�X�D�1�E����s����Lr(c������	t|���j�r�Stj��}|j	���fd����fd�}�j���j|��S)Nc�0���j�r!|j�s|j�y|j�r�j�y|j�}|��j|�y�j	|j��yr!)r�ryr�rzrwrv)�innerr�rs  �r'�_inner_done_callbackz$shield.<locals>._inner_done_callback�sj����?�?���?�?�$����!���?�?���L�L�N��/�/�#�C����#�#�C�(�� � �����0r(c�J���j�s�j��yyr!)r1r�)rrrs ��r'�_outer_done_callbackz$shield.<locals>._outer_done_callback�s ����z�z�|��&�&�';�<�r()r
r1rr0r�r�)rr&rrrrs   @@@r'rrasp����@
�#��E��z�z�|������U�#�D���� �E�1�"=�
���0�1�	���0�1��Lr(c�����	tj��std��tjj�����fd�}�j
|��S)NzA coroutine object is requiredc����	tjt������y#ttf$r�t
$r'}�j
�r�j|��d}~wwxYw)Nr%)r�
_chain_futurer
r�r�r��set_running_or_notify_cancelrz)r�r^r�r&s ���r'�callbackz*run_coroutine_threadsafe.<locals>.callback�s]���	��!�!�-��4�"@�&�I���-�.�	���	��2�2�4��$�$�S�)���	�s�!%�A$�"A�A$)rrKrM�
concurrentr�Future�call_soon_threadsafe)r^r&r"r�s`` @r'rr�sR�����!�!�$�'��8�9�9�
�
�
�
&�
&�
(�F��	���h�'��Mr(c���	ddd��fd�
}|S)Nr�c����||||d��S)NTrBr�)r&r^r?rC�custom_task_constructors    �r'�factoryz*create_eager_task_factory.<locals>.factory�s���&��t�$��T�K�	Kr(r�)r(r)s` r'rr�s����$%)�$�K��Nr(c�0�	tj|�yr!)r,r��r>s r'rr�s��E�����r(c�0�	tj|�yr!)r+r�r+s r'r�r��s��@����T�r(c�h�tj|�}|�td|�d|�d���|t|<y)NzCannot enter into task z while another task z is being executed.�r#r$r-�r&r>rs   r'rr�sL��!�%�%�d�+�L����4�T�H�=#�#/�"2�2E�G�H�	H��N�4�r(c�h�tj|�}||urtd|�d|�d���t|=y)Nz
Leaving task z! does not match the current task �.r.r/s   r'rr�sJ��!�%�%�d�+�L��4���]�4�(�3/�/;�.>�a�A�B�	B��t�r(c�X�tj|�}|�	t|=|S|t|<|Sr!)r#r$)r&r>r�s   r'r�r��s9���"�"�4�(�I��|��4� ��� $��t���r(c�0�	tj|�yr!)r,�discardr+s r'rrs��1����T�"r(c�0�	tj|�yr!)r+r4r+s r'r�r�
s��@�����r()rr�rr�rrr�r,r+r#rr!)O�__all__�concurrent.futuresr#rUr�r�r.�typesr;�weakrefrrrrrrrr�count�__next__rNrrr@�	_PyFuturer�_PyTask�_asyncio�_CTask�ImportErrorrrrrrr�rr�r�r	�	coroutiner�r
r
r$rrr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_taskr�r(r'�<module>rSsM��6������������������
%�Y�_�_�Q�'�0�0��$�>�6
�z�7���z�z	��"��
�M�M�!�D�6�#�D�
�$�$�$�4�4���$�$�4�4���"�"�0�0�
�#�
�7�@ �
0�d)�X%�$!%�6�r���
��
��"+/��@�w�~�~��:16�C�L?�D�.�4/�t�4��#�7�?�?�$���u�����
�
 ���#�
�
 ��"��.��&��2������*��.�(�(�(�(�#�O�%��1��)��5���M��M�-���i�	��	��T�	��	�s$�
F4�	G�4F=�<F=�G�G