Your IP : 18.191.200.151


Current Path : /opt/alt/python34/lib64/python3.4/asyncio/__pycache__/
Upload File :
Current File : //opt/alt/python34/lib64/python3.4/asyncio/__pycache__/coroutines.cpython-34.pyc

�
j fC%�@s�dddgZddlZddlZddlZddlZddlZddlZddlZddlm	Z	ddlm
Z
ddlmZdd	lm
Z
ejd
Zejjo�eejjd��Zy
ejZWnek
r�dZYnXy
ejZWnek
r*dd
�ZYnXyddlmZmZWne k
rcdZZYnXdd�Z!e!�Z"[!dd�Z#Gdd�d�Z$dd�Zdd�Zej%e$fZ&edk	r�e&ef7Z&ndd�Z'dd�Z(dS)�	coroutine�iscoroutinefunction�iscoroutine�N�)�compat)�events)�futures)�loggerZ
YIELD_FROMZPYTHONASYNCIODEBUGcCsdS)NF�)�funcr
r
�7/opt/alt/python34/lib64/python3.4/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__6sz*has_yield_from_bug.<locals>.MyGen.__init__cSs|S)Nr
)rr
r
r�__iter__8sz*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�MyGen5srcss
|DdHdS)Nr
)�genr
r
r�yield_from_gen?sz*has_yield_from_bug.<locals>.yield_from_genr��)rrr)�nextrr)rr�valuer�coror
r
r�has_yield_from_bug4s
	

r"cCs
t|d�S)N)�CoroWrapper)rr
r
r�
debug_wrapperKsr$c@s0eZdZddd�Zdd�Zdd�Zdd	�ZerTd
d�Zndd�Zd
d�Z	dd�Z
edd��Zedd��Z
edd��Zejr dd�Zedd��Zedd��Zedd��Zedd ��Zed!d"��Znd#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rVs*		zCoroWrapper.__init__cCsUt|�}|jrA|jd}|d|d|df7}nd|jj|fS)Nrz, created at %s:%srz<%s %s>���)�_format_coroutiner,�	__class__r)r�	coro_repr�framer
r
r�__repr__^s
	
zCoroWrapper.__repr__cCs|S)Nr
)rr
r
rreszCoroWrapper.__iter__cCs|jjd�S)N)rr)rr
r
rrhszCoroWrapper.__next__cGs`tj�}|j}|jdks*t�|jj|jtkrP|d}n|jj	|�S)Nr)
r*r+�f_back�f_lastir'�f_code�co_code�_YIELD_FROMrr)rr r2Zcallerr
r
rrps	
zCoroWrapper.sendcCs|jj|�S)N)rr)rr r
r
rrxscCs|jj|�S)N)r�throw)r�excr
r
rr9{szCoroWrapper.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_codecCsCt|jdd�}|dk	r?tdj|j|���n|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�}|dkrEt|dd�}n|dk	r�|jd	kr�d|}t|df�}|r�djtj|��}|d7}||j�7}ntj|�ndS)
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#Ss(	r#cs�t��r�Stj��r(��n!tj���fdd���tsstdkrd�}q�t��}n$tj����fdd��}d|_|S)z�Decorator to mark coroutines.

    If the coroutine is not yielded from before it is destroyed,
    an error message is logged.
    c?s��||�}t|tj�s0tj|�r>|DdH}nQtdk	r�y
|j}Wntk
rkYq�Xt|t�r�|�DdH}q�n|S)N)�
isinstancerZFuturer%r&�
_AwaitableABCrB�AttributeError)�args�kw�resZ
await_meth)rr
rr!�s!

zcoroutine.<locals>.coroNcs_t�||�d��}|jr1|jd=nt�dd�|_t�dd�|_|S)Nrrrrr.)r#r,r-rr)rT�kwds�w)r!rr
r�wrapper�s	
zcoroutine.<locals>.wrapperT)�_inspect_iscoroutinefunctionr%�isgeneratorfunction�	functools�wraps�_DEBUG�_types_coroutine�
_is_coroutine)rrYr
)r!rrr�s	!	$
	cCst|dd�pt|�S)z6Return True if func is a decorated coroutine function.r`F)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	Cs�t|�st�d}t|t�rZ|j}|j}|dk	r`dj|�}q`n|}|dkr�tj|f�}ny
|j	}Wnt
k
r�|j}YnXy
|j}Wnt
k
r�|j
}YnX|j}d}t|t�r|tj|j�r||jdk	r|tj|j�}|dk	rD|\}}n|dkrfd|||f}q�d|||f}nG|dk	r�|j}d|||f}n|j}d|||f}|S)Nz{}()rz%s done, defined at %s:%sz%s running, defined at %s:%sz%s running at %s:%s)rr'rQr#rrrArZ_format_callbackr>rSrEr<rF�co_filenamer%r[Z_get_function_source�f_lineno�co_firstlineno)	r!Z	coro_namerZ	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_rSrrZZcollections.abcrZ
_CoroutineABCrrR�ImportErrorr"rOr$r#�
GeneratorTyperarr/r
r
r
r�<module>sN






	i8

?>