AlkantarClanX12

Your IP : 3.15.17.60


Current Path : /opt/alt/python310/lib64/python3.10/asyncio/__pycache__/
Upload File :
Current File : //opt/alt/python310/lib64/python3.10/asyncio/__pycache__/futures.cpython-310.opt-2.pyc

o

6��fk7�@s	dZddlZddlZddlZddlZddlmZddlm	Z	ddlm
Z
ddlmZddlmZe	j
Z
e	jZe	jZe	jZejdZGd	d
�d
�ZeZdd�Zd
d�Zdd�Zdd�Zdd�Zdd�Zdd�dd�ZzddlZWn
eyzYdSwejZZdS))�Future�wrap_future�isfuture�N)�GenericAlias�)�base_futures)�events)�
exceptions)�format_helpersc@s�eZdZ	eZdZdZdZdZdZ	dZ
dZdZdd�dd�Z
ejZdd�Zdd	�Zee�Zed
d��Zejdd��Zd
d�Zdd�Zd(dd�Zdd�Zdd�Zdd�Zdd�Zdd�Z dd�dd�Z!d d!�Z"d"d#�Z#d$d%�Z$d&d'�Z%e%Z&dS))rNF��loopcCsF	|durt��|_n||_g|_|j��r!t�t�d��|_	dSdS)Nr)
r�_get_event_loop�_loop�
_callbacksZ	get_debugr
�
extract_stack�sys�	_getframe�_source_traceback��selfr�r�6/opt/alt/python310/lib64/python3.10/asyncio/futures.py�__init__Hs

��zFuture.__init__cCsd�|jjd�|����S)Nz<{} {}>� )�format�	__class__�__name__�join�
_repr_info�rrrr�__repr__Zs
�zFuture.__repr__cCsF|jsdS|j}|jj�d�||d�}|jr|j|d<|j�|�dS)Nz exception was never retrieved)�message�	exception�futureZsource_traceback)�_Future__log_traceback�
_exceptionrrrrZcall_exception_handler)r�exc�contextrrr�__del__^s�
zFuture.__del__cCs|jS�N)r$rrrr�_log_tracebackpszFuture._log_tracebackcCs|rtd��d|_dS)Nz'_log_traceback can only be set to FalseF)�
ValueErrorr$)r�valrrrr*ts
cCs	|j}|durtd��|S)Nz!Future object is not initialized.)r�RuntimeErrorrrrr�get_loopzs
zFuture.get_loopcCs4	|jdurt��}nt�|j�}|j|_d|_|Sr))�_cancel_messager	�CancelledError�_cancelled_exc�__context__�rr&rrr�_make_cancelled_error�s

zFuture._make_cancelled_errorcCs.	d|_|jtkrdSt|_||_|��dS)NFT)r$�_state�_PENDING�
_CANCELLEDr/�_Future__schedule_callbacks)r�msgrrr�cancel�s
z
Future.cancelcCsJ	|jdd�}|sdSg|jdd�<|D]
\}}|jj|||d�qdS�N�r')rr�	call_soon)rZ	callbacks�callback�ctxrrrZ__schedule_callbacks�s�zFuture.__schedule_callbackscCs	|jtkSr))r5r7rrrr�	cancelled�s
zFuture.cancelledcCs	|jtkSr))r5r6rrrr�done�s
zFuture.donecCsP	|jtkr|��}|�|jtkrt�d��d|_|jdur%|j�|j	��|j
S)NzResult is not ready.F)r5r7r4�	_FINISHEDr	�InvalidStateErrorr$r%�with_traceback�
_exception_tb�_resultr3rrr�result�s



z
Future.resultcCs8	|jtkr|��}|�|jtkrt�d��d|_|jS)NzException is not set.F)r5r7r4rBr	rCr$r%r3rrrr"�s


zFuture.exceptionr<cCsF	|jtkr|jj|||d�dS|durt��}|j�||f�dSr;)r5r6rr=�contextvarsZcopy_contextr�append)r�fnr'rrr�add_done_callback�s
zFuture.add_done_callbackcs>	�fdd�|jD�}t|j�t|�}|r||jdd�<|S)Ncs g|]\}}|�kr||f�qSrr)�.0�fr?�rJrr�
<listcomp>�s
�z/Future.remove_done_callback.<locals>.<listcomp>)r�len)rrJZfiltered_callbacksZ
removed_countrrNr�remove_done_callback�s
�zFuture.remove_done_callbackcCs:	|jtkrt�|j�d|����||_t|_|��dS)N�: )r5r6r	rCrFrBr8)rrGrrr�
set_result�s
zFuture.set_resultcCsl	|jtkrt�|j�d|����t|t�r|�}t|�tur#td��||_|j	|_
t|_|��d|_
dS)NrRzPStopIteration interacts badly with generators and cannot be raised into a FutureT)r5r6r	rC�
isinstance�type�
StopIteration�	TypeErrorr%�
__traceback__rErBr8r$)rr"rrr�
set_exceptions


zFuture.set_exceptionccs.�|��sd|_|V|��std��|��S)NTzawait wasn't used with future)rA�_asyncio_future_blockingr-rGrrrr�	__await__s�zFuture.__await__r))'r�
__module__�__qualname__r6r5rFr%rrr/r1rZr$rrZ_future_repr_inforr r(�classmethodr�__class_getitem__�propertyr*�setterr.r4r:r8r@rArGr"rKrQrSrYr[�__iter__rrrrrsD


rcCs&z|j}W|�StyY|jSwr))r.�AttributeErrorr)�futr.rrr�	_get_loop)s��recCs	|��rdS|�|�dSr))r@rS)rdrGrrr�_set_result_unless_cancelled5srfcCsTt|�}|tjjurtj|j�S|tjjurtj|j�S|tjjur(tj|j�S|Sr))rU�
concurrent�futuresr0r	�args�TimeoutErrorrC)r&Z	exc_classrrr�_convert_future_exc<srkcCsV	|��r	|��|��sdS|��}|dur |�t|��dS|��}|�|�dSr))r@r:Zset_running_or_notify_cancelr"rYrkrGrS)rg�sourcer"rGrrr�_set_concurrent_future_stateHsrmcCsZ	|��rdS|��r|��dS|��}|dur"|�t|��dS|��}|�|�dSr))r@r:r"rYrkrGrS)rl�destr"rGrrr�_copy_future_stateWsrocs�	t��st�tjj�std��t��st�tjj�std��t��r't��nd�t��r1t��nd�dd�����fdd�}����fdd�}��|���|�dS)	Nz(A future is required for source argumentz-A future is required for destination argumentcSs$t|�rt||�dSt||�dSr))rrorm)r#�otherrrr�
_set_state{sz!_chain_future.<locals>._set_statecs8|��r�dus��ur���dS���j�dSdSr))r@r:�call_soon_threadsafe)�destination)�	dest_looprl�source_looprr�_call_check_cancel�s
�z)_chain_future.<locals>._call_check_cancelcsX���r�dur���rdS�dus��ur��|�dS���r#dS����|�dSr))r@Z	is_closedrr)rl)rqrtrsrurr�_call_set_state�sz&_chain_future.<locals>._call_set_state)rrTrgrhrrWrerK)rlrsrvrwr)rqrtrsrlrur�
_chain_futureks ��
rxrcCs4	t|�r|S|durt��}|��}t||�|Sr))rrr
Z
create_futurerx)r#rZ
new_futurerrrr�s
r)�__all__Zconcurrent.futuresrgrHZloggingr�typesr�rrr	r
rr6r7rB�DEBUGZSTACK_DEBUGrZ	_PyFuturererfrkrmrorxrZ_asyncio�ImportErrorZ_CFuturerrrr�<module>sB

,
�