Your IP : 52.15.118.202


Current Path : /proc/self/root/opt/alt/python37/lib64/python3.7/asyncio/__pycache__/
Upload File :
Current File : //proc/self/root/opt/alt/python37/lib64/python3.7/asyncio/__pycache__/coroutines.cpython-37.pyc

B

� f�!�@s�dZddlZddlZddlZddlZddlZddlZddlZddl	m
Z
ddl	mZddl	mZddl
mZdd	�Ze�ZGd
d�d�Zdd
�Ze�Zdd�ZejejejjefZe�Zdd�Zdd�ZdS))�	coroutine�iscoroutinefunction�iscoroutine�N�)�base_futures)�	constants)�format_helpers)�loggercCs"tjjp tjjo ttj�d��S)NZPYTHONASYNCIODEBUG)�sys�flags�dev_mode�ignore_environment�bool�os�environ�get�rr�7/opt/alt/python37/lib64/python3.7/asyncio/coroutines.py�_is_debug_modesrc@s�eZdZddd�Zdd�Zdd�Zdd	�Zd
d�Zddd
�Zdd�Z	e
dd��Ze
dd��Ze
dd��Z
dd�Ze
dd��Zdd�ZdS)�CoroWrapperNcCsZt�|�st�|�st|��||_||_t�t�	d��|_
t|dd�|_t|dd�|_
dS)Nr�__name__�__qualname__)�inspect�isgeneratorr�AssertionError�gen�funcr�
extract_stackr
�	_getframe�_source_traceback�getattrrr)�selfrrrrr�__init__&szCoroWrapper.__init__cCsJt|�}|jr4|jd}|d|d�d|d��7}d|jj�d|�d�S)	N���z
, created at r�:r�<� �>)�_format_coroutiner�	__class__r)r!�	coro_repr�framerrr�__repr__.s

zCoroWrapper.__repr__cCs|S)Nr)r!rrr�__iter__6szCoroWrapper.__iter__cCs|j�d�S)N)r�send)r!rrr�__next__9szCoroWrapper.__next__cCs|j�|�S)N)rr.)r!�valuerrrr.<szCoroWrapper.sendcCs|j�|||�S)N)r�throw)r!�typer0�	tracebackrrrr1?szCoroWrapper.throwcCs
|j��S)N)r�close)r!rrrr4BszCoroWrapper.closecCs|jjS)N)r�gi_frame)r!rrrr5EszCoroWrapper.gi_framecCs|jjS)N)r�
gi_running)r!rrrr6IszCoroWrapper.gi_runningcCs|jjS)N)r�gi_code)r!rrrr7MszCoroWrapper.gi_codecCs|S)Nr)r!rrr�	__await__QszCoroWrapper.__await__cCs|jjS)N)r�gi_yieldfrom)r!rrrr9TszCoroWrapper.gi_yieldfromcCs�t|dd�}t|dd�}|dk	r||jdkr||�d�}t|dd�}|rrd�t�|��}|dtj�d	�7}||��7}t�	|�dS)
Nrr5r#z was never yielded fromrr�zB
Coroutine object created at (most recent call last, truncated to z last lines):
)
r �f_lasti�joinr3�format_listrZDEBUG_STACK_DEPTH�rstripr	�error)r!rr+�msg�tbrrr�__del__Xs
zCoroWrapper.__del__)N)NN)r�
__module__rr"r,r-r/r.r1r4�propertyr5r6r7r8r9rBrrrrr#s

rcsjt���r�St���r��nt����fdd���t����tsH�}nt�����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?sr�||�}t�|�s(t�|�s(t|t�r4|EdH}n:y
|j}Wntk
rRYnXt|tj	j
�rn|�EdH}|S)N)rZisfuturerr�
isinstancerr8�AttributeError�collections�abc�	Awaitable)�args�kwZresZ
await_meth)rrr�corovs


zcoroutine.<locals>.corocs@t�||��d�}|jr |jd=t�dd�|_t�dd�|_|S)N)rr#rr)rrr rr)rJ�kwds�w)rLrrr�wrapper�szcoroutine.<locals>.wrapper)	rr�isgeneratorfunction�	functools�wraps�typesr�_DEBUG�
_is_coroutine)rrOr)rLrrrhs



rcCst�|�pt|dd�tkS)z6Return True if func is a decorated coroutine function.rUN)rrr rU)rrrrr�s
rcCs@t|�tkrdSt|t�r8tt�dkr4t�t|��dSdSdS)z)Return True if obj is a coroutine object.T�dFN)r2�_iscoroutine_typecacherE�_COROUTINE_TYPES�len�add)�objrrrr�s
rc
stt|�st�t|t���fdd�}dd�}d}t|d�rF|jrF|j}nt|d�r\|jr\|j}||�}|s~||�rz|�d�S|Sd}t|d�r�|jr�|j}nt|d	�r�|jr�|j}|j	p�d
}d}��r0|j
dk	�r0t�|j
��s0t
�|j
�}|dk	r�|\}}|dk�r|�d|�d
|��}	n|�d|�d
|��}	n@|dk	�rV|j}|�d|�d
|��}	n|j}|�d|�d
|��}	|	S)Ncs`�rt�|jdi�St|d�r,|jr,|j}n*t|d�rD|jrD|j}ndt|�j�d�}|�d�S)Nrrrr%z without __name__>z())rZ_format_callbackr�hasattrrrr2)rL�	coro_name)�is_corowrapperrr�get_name�sz#_format_coroutine.<locals>.get_namecSs<y|jStk
r6y|jStk
r0dSXYnXdS)NF)�
cr_runningrFr6)rLrrr�
is_running�sz%_format_coroutine.<locals>.is_running�cr_coder7z runningr5�cr_framez<empty co_filename>rz done, defined at r$z running, defined at z running at )rrrErr\rbr7r5rc�co_filenamerrrPrZ_get_function_source�f_lineno�co_firstlineno)
rLr_raZ	coro_coder]Z
coro_frame�filename�lineno�sourcer*r)r^rr(�sH
	



r()�__all__Zcollections.abcrGrQrrr
r3rSr:rrr�logr	rrTrr�objectrUr�
CoroutineType�
GeneratorTyperH�	CoroutinerX�setrWrr(rrrr�<module>s,E5

?>