Your IP : 3.133.141.201


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

�

�Q�f08��h�	dZddlZddlZddlZddlZddlmZddlm	Z	ddlm
Z
ddlmZddlmZe	jZ
e	jZe	jZe	j Zej"dz
ZGd	�d
�ZeZd�Zd�Zd
�Zd�Zd�Zd�Zdd�d�Z	ddlZej&xZZy#e$rYywxYw))�Future�wrap_future�isfuture�N)�GenericAlias�)�base_futures)�events)�
exceptions)�format_helpersc���eZdZ	eZdZdZdZdZdZ	dZ
dZdZdd�d�Z
d�Zd�Zee�Zed��Zej*d��Zd	�Zd
�Zdd�Zd�Zd
�Zd�Zd�Zd�Zdd�d�Zd�Zd�Z d�Z!d�Z"e"Z#y)rNF��loopc���	|�tj�|_n||_g|_|jj	�r.tjtjd��|_	yy)Nr)
r	�get_event_loop�_loop�
_callbacks�	get_debugr�
extract_stack�sys�	_getframe�_source_traceback��selfrs  �6/opt/alt/python312/lib64/python3.12/asyncio/futures.py�__init__zFuture.__init__Hs`��	��<��.�.�0�D�J��D�J�����:�:���!�%3�%A�%A��
�
�a� �&"�D�"�"�c�,�tj|�S�N)r�_future_repr�rs r�__repr__zFuture.__repr__Xs���(�(��.�.rc���|jsy|j}|jj�d�||d�}|jr|j|d<|j
j
|�y)Nz exception was never retrieved)�message�	exception�future�source_traceback)�_Future__log_traceback�
_exception�	__class__�__name__rr�call_exception_handler)r�exc�contexts   r�__del__zFuture.__del__[sl���#�#�
��o�o���>�>�*�*�+�+I�J���	
���!�!�*.�*@�*@�G�&�'��
�
�)�)�'�2rc��|jSr)r'r s r�_log_tracebackzFuture._log_tracebackms���#�#�#rc�,�|rtd��d|_y)Nz'_log_traceback can only be set to FalseF)�
ValueErrorr')r�vals  rr0zFuture._log_tracebackqs����F�G�G�$��rc�:�	|j}|�td��|S)Nz!Future object is not initialized.)r�RuntimeErrorrs  r�get_loopzFuture.get_loopws$��;��z�z���<��B�C�C��rc��	|j�|j}d|_|S|j�tj�}ntj|j�}|j|_d|_|Sr)�_cancelled_exc�_cancel_messager
�CancelledError�__context__�rr,s  r�_make_cancelled_errorzFuture._make_cancelled_error~sw��	�
���*��%�%�C�"&�D���J����'��+�+�-�C��+�+�D�,@�,@�A�C��-�-���"����
rc��	d|_|jtk7ryt|_||_|j�y)NFT)r'�_state�_PENDING�
_CANCELLEDr9�_Future__schedule_callbacks)r�msgs  r�cancelz
Future.cancel�s>��	� %����;�;�(�"�� ���"����!�!�#�rc��	|jdd}|syg|jdd|D]#\}}|jj|||���%y�N�r-)rr�	call_soon)r�	callbacks�callback�ctxs    r�__schedule_callbackszFuture.__schedule_callbacks�sR��	�
�O�O�A�&�	���������&�M�H�c��J�J� � ��4�� �=�'rc�*�	|jtk(Sr)r?rAr s r�	cancelledzFuture.cancelled�s��6��{�{�j�(�(rc�*�	|jtk7Sr)r?r@r s r�donezFuture.done�s��	�
�{�{�h�&�&rc�&�	|jtk(r|j�}|�|jtk7rt	j
d��d|_|j�%|jj|j��|jS)NzResult is not ready.F)r?rAr=�	_FINISHEDr
�InvalidStateErrorr'r(�with_traceback�
_exception_tb�_resultr<s  r�resultz
Future.result�s}��	��;�;�*�$��,�,�.�C��I��;�;�)�#��.�.�/E�F�F�$����?�?�&��/�/�0�0��1C�1C�D�D��|�|�rc���	|jtk(r|j�}|�|jtk7rt	j
d��d|_|jS)NzException is not set.F)r?rAr=rRr
rSr'r(r<s  rr$zFuture.exception�sX��	��;�;�*�$��,�,�.�C��I��;�;�)�#��.�.�/F�G�G�$������rrGc���	|jtk7r|jj|||��y|�t	j
�}|jj||f�yrF)r?r@rrH�contextvars�copy_contextr�append)r�fnr-s   r�add_done_callbackzFuture.add_done_callback�sW��	��;�;�(�"��J�J� � ��T�7� �;���%�2�2�4���O�O�"�"�B��=�1rc���	|jD��cgc]\}}||k7r||f��}}}t|j�t|�z
}|r||jdd|Scc}}wr)r�len)rr]�frK�filtered_callbacks�
removed_counts      r�remove_done_callbackzFuture.remove_done_callback�ss��	�
/3�o�o�*�.=�(�1�c�!"�b�� !�#�h�.=�	�*��D�O�O�,�s�3E�/F�F�
��!3�D�O�O�A�����
*s�Ac��	|jtk7r$tj|j�d|����||_t
|_|j
�y)N�: )r?r@r
rSrVrRrB)rrWs  r�
set_resultzFuture.set_result�sO��	�
�;�;�(�"��.�.�$�+�+��b���/I�J�J��������!�!�#rc�l�	|jtk7r$tj|j�d|����t	|t
�r|�}t	|t�rtd�}||_||_	|}||_
|j|_t|_|j�d|_y)NrfzPStopIteration interacts badly with generators and cannot be raised into a FutureT)r?r@r
rS�
isinstance�type�
StopIterationr5�	__cause__r;r(�
__traceback__rUrRrBr')rr$�new_excs   r�
set_exceptionzFuture.set_exception	s���	�
�;�;�(�"��.�.�$�+�+��b���/I�J�J��i��&�!��I��i��/�"�$,�-�G�!*�G��"+�G���I�#���&�4�4�������!�!�#�#��rc#�K�|j�sd|_|��|j�std��|j�S�w)NTzawait wasn't used with future)rP�_asyncio_future_blockingr5rWr s r�	__await__zFuture.__await__ s=�����y�y�{�,0�D�)��J��y�y�{��>�?�?��{�{�}��s�AA	r)$r*�
__module__�__qualname__r@r?rVr(rrr9r8rqr'rr!r.�classmethodr�__class_getitem__�propertyr0�setterr6r=rDrBrNrPrWr$r^rdrgrorr�__iter__�rrrrs����&�F��G��J��E����O��N� %���O�#�"� /�3� $�L�1��
�$��$����%��%�
��(
�>�)�'��"� 04�2� �
$�$�.��Hrrc�^�	|j}|�S#t$rY|jSwxYwr)r6�AttributeErrorr)�futr6s  r�	_get_loopr~/s:����<�<���z����
���9�9��	
�s��	,�,c�J�	|j�ry|j|�yr)rNrg)r}rWs  r�_set_result_unless_cancelledr�;s��I�
�}�}����N�N�6�rc�l�t|�}|tjjurt	j|j
�S|tjjurt	j|j
�S|tjjurt	j|j
�S|Sr)rj�
concurrent�futuresr:r
�args�TimeoutErrorrS)r,�	exc_classs  r�_convert_future_excr�Bs����S�	�I��J�&�&�5�5�5��(�(�#�(�(�3�3�	�j�(�(�5�5�	5��&�&����1�1�	�j�(�(�:�:�	:��+�+�S�X�X�6�6��
rc��	|j�r|j�|j�sy|j�}|�|jt|��y|j
�}|j|�yr)rNrD�set_running_or_notify_cancelr$ror�rWrg)r��sourcer$rWs    r�_set_concurrent_future_stater�Nsu��B�
�����
����2�:�2�2�4��� � �"�I��� �
� � �!4�Y�!?�@�������
���f�%rc��	|j�ry|j�r|j�y|j�}|�|jt	|��y|j�}|j
|�yr)rNrDr$ror�rWrg)r��destr$rWs    r�_copy_future_stater�]sj���
�~�~���
�������
��$�$�&�	�� ����2�9�=�>��]�]�_�F��O�O�F�#rc�������	t��s/t�tjj�std��t��s/t�tjj�std��t��rt
��nd�t��rt
��nd�d�����fd�}����fd�}�j|��j|�y)Nz(A future is required for source argumentz-A future is required for destination argumentc�L�t|�r
t||�yt||�yr)rr�r�)r%�others  r�
_set_statez!_chain_future.<locals>._set_state�s���F���u�f�-�(���7rc���|j�r3����ur�j�y�j�j�yyr)rNrD�call_soon_threadsafe)�destination�	dest_loopr��source_loops ���r�_call_check_cancelz)_chain_future.<locals>._call_check_cancel�s<���� � �"��"�k�Y�&>��
�
���0�0����?�	#rc����j�r���j�ry����ur
��|�y�j�ry�j��|�yr)rN�	is_closedr�)r�r�r�r�r�s ����r�_call_set_statez&_chain_future.<locals>._call_set_state�s[����!�!�#��%�)�*=�*=�*?����	�[� 8��{�F�+��"�"�$���*�*�:�{�F�Kr)rrir�r�r�	TypeErrorr~r^)r�r�r�r�r�r�r�s``  @@@r�
_chain_futurer�qs������F��J�v�/9�/A�/A�/H�/H�%J��B�C�C��K� ��K�4>�4F�4F�4M�4M�*O��G�H�H�'/��'7�)�F�#�T�K�*2�;�*?�	�+�&�T�I�8�@�	L��!�!�"4�5�
���_�-rr
c��	t|�r|S|�tj�}|j�}t	||�|Sr)rr	r�
create_futurer�)r%r�
new_futures   rrr�sE��0�����
��|��$�$�&���#�#�%�J��&�*�%��r)�__all__�concurrent.futuresr�rZ�loggingr�typesr�rr	r
rrr@rArR�DEBUG�STACK_DEBUGr�	_PyFuturer~r�r�r�r�r�r�_asyncio�_CFuture�ImportErrorrzrr�<module>r�s���4������
������� � ��� � ��
�
$�
$�
��"�"�	��m�m�a���J�J�\
�	�	��	�&�$�().�X!%�
�(��
!���'�F�X��	�	��	�s�B)�)B1�0B1

?>