Your IP : 52.14.7.53


Current Path : /opt/alt/python35/lib64/python3.5/asyncio/__pycache__/
Upload File :
Current File : //opt/alt/python35/lib64/python3.5/asyncio/__pycache__/coroutines.cpython-35.pyc



��Yf�)�@s(dddgZddlZddlZddlZddlZddlZddlZddlZddlm	Z	ddlm
Z
ddlmZdd	lm
Z
ejd
Zejjo�eejjd��ZyejZejZWnek
rdZdZYnXy
ejZWnek
r9dd
�ZYnXyddlmZm Z!Wne"k
rrdZZ!YnXdd�Z#e#�Z$[#dd�Z%Gdd�d�Z&dd�Ze'�Z(dd�Zej)e&fZ*edk	r�e*ef7Z*edk	refe*Z*dd�Z+dd�Z,dS)�	coroutine�iscoroutinefunction�iscoroutine�N�)�compat)�events)�futures)�loggerZ
YIELD_FROMZPYTHONASYNCIODEBUGcCsdS)NF�)�funcr
r
�7/opt/alt/python35/lib64/python3.5/asyncio/coroutines.py�<lambda>.sr
)�	Coroutine�	AwaitablecCsaGdd�d�}dd�}d}|�}||�}t|�|j|�|j|fkS)	Nc@s@eZdZdd�Zdd�Zdd�Zdd�Zd	S)
z!has_yield_from_bug.<locals>.MyGencSs
d|_dS)N)�	send_args)�selfr
r
r�__init__:sz*has_yield_from_bug.<locals>.MyGen.__init__cSs|S)Nr
)rr
r
r�__iter__<sz*has_yield_from_bug.<locals>.MyGen.__iter__cSsdS)N�*r
)rr
r
r�__next__>sz*has_yield_from_bug.<locals>.MyGen.__next__cWs
||_dS)N)r)rZwhatr
r
r�send@s	z&has_yield_from_bug.<locals>.MyGen.sendN)�__name__�
__module__�__qualname__rrrrr
r
r
r�MyGen9srcss
|EdHdS)Nr
)�genr
r
r�yield_from_genCsz*has_yield_from_bug.<locals>.yield_from_genr��)rrr)�nextrr)rr�valuer�coror
r
r�has_yield_from_bug8s
	

r"cCs
t|d�S)N)�CoroWrapper)rr
r
r�
debug_wrapperOsr$c@s3eZdZddd�Zdd�Zdd�Zdd	�ZerTd
d�Zndd�Zddd
d�Z	dd�Z
edd��Zedd��Z
edd��Zejr#dd�Zedd��Zedd��Zedd��Zedd ��Zed!d"��Zd#d$�ZdS)%r#NcCs�tj|�s*tj|�s*t|��||_||_tjtj	d��|_
t|dd�|_t|dd�|_
dS)Nrrr)�inspect�isgeneratorr�AssertionErrorrr�	traceback�
extract_stack�sys�	_getframe�_source_traceback�getattrrr)rrrr
r
rrZs*		zCoroWrapper.__init__cCsRt|�}|jr>|jd}|d|d|df7}d|jj|fS)Nrz, created at %s:%srz<%s %s>���)�_format_coroutiner,�	__class__r)r�	coro_repr�framer
r
r�__repr__bs
	
zCoroWrapper.__repr__cCs|S)Nr
)rr
r
rriszCoroWrapper.__iter__cCs|jjd�S)N)rr)rr
r
rrlszCoroWrapper.__next__cGs]tj�}|j}|jdks*t�|jj|jtkrM|d}|jj	|�S)Nr)
r*r+�f_back�f_lastir'�f_code�co_code�_YIELD_FROMrr)rr r2Zcallerr
r
rrts	
zCoroWrapper.sendcCs|jj|�S)N)rr)rr r
r
rr|scCs|jj|||�S)N)r�throw)r�typer r(r
r
rr9szCoroWrapper.throwcCs
|jj�S)N)r�close)rr
r
rr;�szCoroWrapper.closecCs
|jjS)N)r�gi_frame)rr
r
rr<�szCoroWrapper.gi_framecCs
|jjS)N)r�
gi_running)rr
r
rr=�szCoroWrapper.gi_runningcCs
|jjS)N)r�gi_code)rr
r
rr>�szCoroWrapper.gi_codecCs@t|jdd�}|dk	r<tdj|j|���|S)N�cr_awaitz;Cannot await on coroutine {!r} while it's awaiting for {!r})r-r�RuntimeError�format)rr?r
r
r�	__await__�szCoroWrapper.__await__cCs
|jjS)N)r�gi_yieldfrom)rr
r
rrC�szCoroWrapper.gi_yieldfromcCs
|jjS)N)rr?)rr
r
rr?�szCoroWrapper.cr_awaitcCs
|jjS)N)r�
cr_running)rr
r
rrD�szCoroWrapper.cr_runningcCs
|jjS)N)r�cr_code)rr
r
rrE�szCoroWrapper.cr_codecCs
|jjS)N)r�cr_frame)rr
r
rrF�szCoroWrapper.cr_framecCs�t|dd�}t|dd�}|dkrBt|dd�}|dk	r�|jd	kr�d|}t|df�}|r�djtj|��}|d7}||j�7}tj|�dS)
Nrr<rFrz%r was never yielded fromr,�z6
Coroutine object created at (most recent call last):
r.)r-r5�joinr(�format_list�rstripr	�error)rrr2�msg�tbr
r
r�__del__�s

zCoroWrapper.__del__)rrrrr3rr�_YIELD_FROM_BUGrr9r;�propertyr<r=r>rZPY35rBrCr?rDrErFrNr
r
r
rr#Ws(	r#cs�t��r�Stj��r(��n!tj���fdd���tsstdkrd�}q�t��}n$tj����fdd��}t|_|S)z�Decorator to mark coroutines.

    If the coroutine is not yielded from before it is destroyed,
    an error message is logged.
    c?s��||�}tj|�s<tj|�s<t|t�rJ|EdH}nKtdk	r�y
|j}Wntk
rwYnXt|t�r�|�EdH}|S)N)	rZisfuturer%r&�
isinstancer#�
_AwaitableABCrB�AttributeError)�args�kw�resZ
await_meth)rr
rr!�s

zcoroutine.<locals>.coroNcs\t�||�d��}|jr.|jd=t�dd�|_t�dd�|_|S)Nrrrrr.)r#r,r-rr)rT�kwds�w)r!rr
r�wrapper�s	
zcoroutine.<locals>.wrapper)�_inspect_iscoroutinefunctionr%�isgeneratorfunction�	functools�wraps�_DEBUG�_types_coroutine�
_is_coroutine)rrYr
)r!rrr�s	!	$
	cCs"t|dd�tkp!t|�S)z6Return True if func is a decorated coroutine function.r`N)r-r`rZ)rr
r
rr�scCs
t|t�S)z)Return True if obj is a coroutine object.)rQ�_COROUTINE_TYPES)�objr
r
rrsc
"Csxt|�st�t|d�r�t|d�r�t|dt|dt|�j��}dj|�}d}y
|j}Wn4tk
r�y
|j	}Wntk
r�YnXYnX|r�dj|�S|Sd}t
|t�r|j}|j
}|dk	rdj|�}n|}|dkr5tj|fi�}y
|j}Wntk
r_|j}YnXy
|j}Wntk
r�|j}YnX|j}d}t
|t�r-tj|j�r-|jdk	r-tj|j�}|dk	r�|\}}|dkrd	|||f}	qtd
|||f}	nG|dk	rX|j}d|||f}	n|j}d	|||f}	|	S)NrEr>rrz{}()Fz
{} runningrz%s done, defined at %s:%sz%s running, defined at %s:%sz%s running at %s:%s)rr'�hasattrr-r:rrArDrSr=rQr#rrrZ_format_callbackr>rEr<rF�co_filenamer%r[Z_get_function_source�f_lineno�co_firstlineno)
r!Z	coro_nameZrunningrZ	coro_codeZ
coro_frame�filename�lineno�sourcer1r
r
rr/sn 





		



			r/)-�__all__r\r%Zopcode�osr*r(�typesrGrrr�logr	Zopmapr8�flags�ignore_environment�bool�environ�getr^rr_�
CoroutineTypeZ_types_CoroutineTyperSrrZ�collections.abcrZ
_CoroutineABCrrR�ImportErrorr"rOr$r#�objectr`�
GeneratorTyperarr/r
r
r
r�<module>sX

	




	i:	



?>