Your IP : 18.119.157.241


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

3


 \+�@s�dddgZddlZddlZddlZddlZddlZddlZddlZddlm	Z	ddlm
Z
ddlmZdd	lmZdd
l
mZejdZejjo�eejjd��ZyejZejZWnek
r�dZdZYnXy
ejZWnek
r�d
d�ZYnXyddlmZ m!Z"Wne#k
�r*dZ Z"YnXdd�Z$e$�Z%[$dd�Z&Gdd�d�Z'dd�Ze(�Z)dd�Zej*e'fZ+e dk	�r�e+e f7Z+edk	�r�efe+Z+dd�Z,dd�Z-dS)�	coroutine�iscoroutinefunction�iscoroutine�N�)�compat)�	constants)�events)�base_futures)�loggerZ
YIELD_FROMZPYTHONASYNCIODEBUGcCsdS)NF�)�funcrr�*/usr/lib64/python3.6/asyncio/coroutines.py�<lambda>/sr)�	Coroutine�	AwaitablecCsFGdd�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)�selfrrr
�__init__;sz*has_yield_from_bug.<locals>.MyGen.__init__cSs|S)Nr)rrrr
�__iter__=sz*has_yield_from_bug.<locals>.MyGen.__iter__cSsdS)N�*r)rrrr
�__next__?sz*has_yield_from_bug.<locals>.MyGen.__next__cWs
||_dS)N)r)rZwhatrrr
�sendAsz&has_yield_from_bug.<locals>.MyGen.sendN)�__name__�
__module__�__qualname__rrrrrrrr
�MyGen:srcss|EdHdS)Nr)�genrrr
�yield_from_genDsz*has_yield_from_bug.<locals>.yield_from_genr��)rrr)�nextrr)rr�valuer�cororrr
�has_yield_from_bug9s

r#cCs
t|d�S)N)�CoroWrapper)rrrr
�
debug_wrapperPsr%c@s�eZdZd%dd�Zdd�Zdd�Zdd	�Zer8d
d�Zndd�Zd&d
d�Z	dd�Z
edd��Zedd��Z
edd��Zejr�dd�Zedd��Zedd��Zedd��Zedd ��Zed!d"��Zd#d$�ZdS)'r$NcCs>||_||_tjtjd��|_t|dd�|_t|dd�|_	dS)Nrrr)
rrr�
extract_stack�sys�	_getframe�_source_traceback�getattrrr)rrrrrr
r[s
zCoroWrapper.__init__cCs@t|�}|jr0|jd}|d|d|df7}d|jj|fS)Nrz, created at %s:%srz<%s %s>���)�_format_coroutiner)�	__class__r)r�	coro_repr�framerrr
�__repr__cs

zCoroWrapper.__repr__cCs|S)Nr)rrrr
rjszCoroWrapper.__iter__cCs|jjd�S)N)rr)rrrr
rmszCoroWrapper.__next__cGs4tj�}|j}|jj|jtkr(|d}|jj|�S)Nr)	r'r(�f_back�f_code�co_code�f_lasti�_YIELD_FROMrr)rr!r/Zcallerrrr
rus
zCoroWrapper.sendcCs|jj|�S)N)rr)rr!rrr
r}scCs|jj|||�S)N)r�throw)r�typer!�	tracebackrrr
r6�szCoroWrapper.throwcCs
|jj�S)N)r�close)rrrr
r9�szCoroWrapper.closecCs|jjS)N)r�gi_frame)rrrr
r:�szCoroWrapper.gi_framecCs|jjS)N)r�
gi_running)rrrr
r;�szCoroWrapper.gi_runningcCs|jjS)N)r�gi_code)rrrr
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=rrr
�	__await__�szCoroWrapper.__await__cCs|jjS)N)r�gi_yieldfrom)rrrr
rA�szCoroWrapper.gi_yieldfromcCs|jjS)N)rr=)rrrr
r=�szCoroWrapper.cr_awaitcCs|jjS)N)r�
cr_running)rrrr
rB�szCoroWrapper.cr_runningcCs|jjS)N)r�cr_code)rrrr
rC�szCoroWrapper.cr_codecCs|jjS)N)r�cr_frame)rrrr
rD�szCoroWrapper.cr_framecCs�t|dd�}t|dd�}|dkr,t|dd�}|dk	r�|jd
kr�d|}t|df�}|r�djtj|��}|dtj�d	�7}||j�7}tj	|�dS)Nrr:rDrz%r was never yielded fromr)�zB
Coroutine object created at (most recent call last, truncated to z last lines):
r+)
r*r4�joinr8�format_listrZDEBUG_STACK_DEPTH�rstripr
�error)rrr/�msg�tbrrr
�__del__�szCoroWrapper.__del__)N)NN)rrrrr0rr�_YIELD_FROM_BUGrr6r9�propertyr:r;r<rZPY35r@rAr=rBrCrDrLrrrr
r$Xs(


r$cspt��r�Stj��r��ntj���fdd���tsNtdkrD�}qft��}ntj����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?sv�||�}tj|�s(tj|�s(t|t�r4|EdH}n>tdk	rry
|j}Wntk
rZYnXt|t�rr|�EdH}|S)N)	r	Zisfuture�inspectZisgenerator�
isinstancer$�
_AwaitableABCr@�AttributeError)�args�kw�resZ
await_meth)rrr
r"�s



zcoroutine.<locals>.coroNcs@t�||��d�}|jr |jd=t�dd�|_t�dd�|_|S)N)rrrrr+)r$r)r*rr)rS�kwds�w)r"rrr
�wrapper�szcoroutine.<locals>.wrapper)�_inspect_iscoroutinefunctionrO�isgeneratorfunction�	functools�wraps�_DEBUG�_types_coroutine�
_is_coroutine)rrXr)r"rr
r�s


cCst|dd�tkpt|�S)z6Return True if func is a decorated coroutine function.r_N)r*r_rY)rrrr
r�scCs
t|t�S)z)Return True if obj is a coroutine object.)rP�_COROUTINE_TYPES)�objrrr
rsc
Cst|d�r�t|d�r�t|dt|dt|�j��}dj|�}d}y
|j}Wn4tk
r~y
|j}Wntk
rxYnXYnX|r�dj|�S|Sd}t|t	�r�|j
}|j}|dk	r�dj|�}n|}|dkr�tj
|fi�}d}t|d�r�|jr�|j}nt|d��r|j�r|j}d}t|d��r0|j�r0|j}nt|d	��rJ|j�rJ|j}d
}|�rb|j�rb|j}d}|}t|t	��r�tj|j
��r�|j
dk	�r�tj|j
�}	|	dk	�r�|	\}}|dk�r�d|||f}nd
|||f}n:|dk	�r�|j}d|||f}n|�r|j}d|||f}|S)NrCr<rrz{}()Fz
{} runningrDr:z<empty co_filename>rz%s done, defined at %s:%sz%s running, defined at %s:%sz%s running at %s:%s)�hasattrr*r7rr?rBrRr;rPr$rrrZ_format_callbackrCr<rDr:�co_filenamerOrZZ_get_function_source�f_lineno�co_firstlineno)
r"Z	coro_nameZrunningrZ	coro_codeZ
coro_frame�filename�linenor.�sourcerrr
r,sx







r,).�__all__r[rOZopcode�osr'r8�typesrErrrr	�logr
Zopmapr5�flags�ignore_environment�bool�environ�getr]rr^�
CoroutineTypeZ_types_CoroutineTyperRrrY�collections.abcrZ
_CoroutineABCrrQ�ImportErrorr#rMr%r$�objectr_�
GeneratorTyper`rr,rrrr
�<module>sZ




j:






?>