AlkantarClanX12

Your IP : 18.188.113.185


Current Path : /usr/lib64/python3.6/asyncio/__pycache__/
Upload File :
Current File : //usr/lib64/python3.6/asyncio/__pycache__/futures.cpython-36.opt-2.pyc

3


 \>�@sddddddgZddlZddlZddlZddlZdd	lmZdd
lmZddlm	Z	ej
Z
ejZejZej
Z
ejZejZejZejdZGdd
�d
�ZGdd�d�ZeZdd�Zdd�Zdd�Zdd�Zdd�dd�ZyddlZWnek
r�YnXejZZdS)�CancelledError�TimeoutError�InvalidStateError�Future�wrap_future�isfuture�N�)�base_futures)�compat)�eventsc@s0eZdZdZdd�Zdd�Zd	d
�Zdd�Zd
S)�_TracebackLogger�loop�source_traceback�exc�tbcCs |j|_|j|_||_d|_dS)N)�_loopr
�_source_tracebackrrr)�self�futurer�r�'/usr/lib64/python3.6/asyncio/futures.py�__init__Rsz_TracebackLogger.__init__cCs,|j}|dk	r(d|_tj|j||j�|_dS)N)r�	traceback�format_exception�	__class__�
__traceback__r)rrrrr�activateXs

z_TracebackLogger.activatecCsd|_d|_dS)N)rr)rrrr�clear_sz_TracebackLogger.clearcCsb|jr^d}|jr:djtj|j��}|d7}|d|j�7}|dj|j�j�7}|jjd|i�dS)Nz*Future/Task exception was never retrieved
�z0Future/Task created at (most recent call last):
z%s
�message)rr�joinr�format_list�rstripr
�call_exception_handler)r�msg�srcrrr�__del__csz_TracebackLogger.__del__N)r
rrr)�__name__�
__module__�__qualname__�	__slots__rrrr&rrrrrs
2rc@s�eZdZeZdZdZdZdZdZ	dZ
dd�dd�Zej
Zdd�ZejrNdd	�Zd
d�Zdd
�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zejr�eZdS) rNF)r
cCs@|dkrtj�|_n||_g|_|jj�r<tjtjd��|_dS)Nr)	r�get_event_loopr�
_callbacksZ	get_debug�
extract_stack�sys�	_getframer)rr
rrrr�s
zFuture.__init__cCsd|jjdj|j��fS)Nz<%s %s>� )rr'r �
_repr_info)rrrr�__repr__�szFuture.__repr__cCsD|js
dS|j}d|jj||d�}|jr4|j|d<|jj|�dS)Nz %s exception was never retrieved)r�	exceptionrr)�_log_traceback�
_exceptionrr'rrr#)rr�contextrrrr&�s
zFuture.__del__cCs&d|_|jtkrdSt|_|j�dS)NFT)r4�_state�_PENDING�
_CANCELLED�_schedule_callbacks)rrrr�cancel�s
z
Future.cancelcCsD|jdd�}|sdSg|jdd�<x|D]}|jj||�q*WdS)N)r,r�	call_soon)rZ	callbacks�callbackrrrr:�s
zFuture._schedule_callbackscCs
|jtkS)N)r7r9)rrrr�	cancelled�szFuture.cancelledcCs
|jtkS)N)r7r8)rrrr�done�szFuture.donecCs<|jtkrt�|jtkr td��d|_|jdk	r6|j�|jS)NzResult is not ready.F)r7r9r�	_FINISHEDrr4r5�_result)rrrr�result�s


z
Future.resultcCs,|jtkrt�|jtkr td��d|_|jS)NzException is not set.F)r7r9rr@rr4r5)rrrrr3�s

zFuture.exceptioncCs*|jtkr|jj||�n|jj|�dS)N)r7r8rr<r,�append)r�fnrrr�add_done_callbacks
zFuture.add_done_callbackcs<�fdd�|jD�}t|j�t|�}|r8||jdd�<|S)Ncsg|]}|�kr|�qSrr)�.0�f)rDrr�
<listcomp>sz/Future.remove_done_callback.<locals>.<listcomp>)r,�len)rrDZfiltered_callbacksZ
removed_countr)rDr�remove_done_callbacks
zFuture.remove_done_callbackcCs4|jtkrtdj|j|���||_t|_|j�dS)Nz{}: {!r})r7r8r�formatrAr@r:)rrBrrr�
set_result s

zFuture.set_resultcCs�|jtkrtdj|j|���t|t�r,|�}t|�tkr@td��||_t	|_|j
�tjrbd|_
nt||�|_|jj|jj�dS)Nz{}: {!r}zPStopIteration interacts badly with generators and cannot be raised into a FutureT)r7r8rrK�
isinstance�type�
StopIteration�	TypeErrorr5r@r:r
�PY34r4rZ
_tb_loggerrr<r)rr3rrr�
set_exception,s

zFuture.set_exceptionccs|j�sd|_|V|j�S)NT)r?�_asyncio_future_blockingrB)rrrr�__iter__DszFuture.__iter__) r'r(r)r8r7rAr5rrrSr4rr	Z_future_repr_infor1r2r
rQr&r;r:r>r?rBr3rErJrLrRrTZPY35�	__await__rrrrrns2

cCs|j�rdS|j|�dS)N)r>rL)ZfutrBrrr�_set_result_unless_cancelledSsrVcCsN|j�r|j�|j�sdS|j�}|dk	r8|j|�n|j�}|j|�dS)N)r>r;Zset_running_or_notify_cancelr3rRrBrL)�
concurrent�sourcer3rBrrr�_set_concurrent_future_stateZsrYcCsP|j�rdS|j�r|j�n.|j�}|dk	r:|j|�n|j�}|j|�dS)N)r>r;r3rRrBrL)rX�destr3rBrrr�_copy_future_stateis
r[cs�t��r"t�tjj�r"td��t��rDt�tjj�rDtd��t��rR�jnd�t��rd�jnd�dd�����fdd�}����fdd�}�j|��j|�dS)	Nz(A future is required for source argumentz-A future is required for destination argumentcSs"t|�rt||�n
t||�dS)N)rr[rY)r�otherrrr�
_set_state�sz!_chain_future.<locals>._set_statecs2|j�r.�dks��kr"�j�n�j�j�dS)N)r>r;�call_soon_threadsafe)�destination)�	dest_looprX�source_looprr�_call_check_cancel�s
z)_chain_future.<locals>._call_check_cancelcsJ�j�r�dk	r�j�rdS�dks,��kr8��|�n�j��|�dS)N)r>Z	is_closedr^)rX)r]r`r_rarr�_call_set_state�sz&_chain_future.<locals>._call_set_state)rrMrWZfuturesrrPrrE)rXr_rbrcr)r]r`r_rXrar�
_chain_future}s	
rd)r
cCs2t|�r|S|dkrtj�}|j�}t||�|S)N)rrr+Z
create_futurerd)rr
Z
new_futurerrrr�s
)�__all__Zconcurrent.futuresrWZloggingr.rrr	r
rrrrrr8r9r@�DEBUGZSTACK_DEBUGrrZ	_PyFuturerVrYr[rdrZ_asyncio�ImportErrorZ_CFuturerrrr�<module>s<

Pc*