
Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­
<!DOCTYPE html>
<html>
U
    ¡ê,a]"  ã                   @   sÔ   d Z ddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
mZ ddl
mZ ddl
mZ ddlmZ dd	„ Zeƒ ZG d
d„ dƒZdd„ Zeƒ Zdd„ ZejejejjefZeƒ Zdd„ Zdd„ ZdS ))Ú	coroutineÚiscoroutinefunctionÚiscoroutineé    Né   )Úbase_futures)Ú	constants)Úformat_helpers)Úloggerc                   C   s"   t jjp t jj o ttj d¡ƒS )NZPYTHONASYNCIODEBUG)ÚsysÚflagsÚdev_modeÚignore_environmentÚboolÚosÚenvironÚget© r   r   ú7/opt/alt/python38/lib64/python3.8/asyncio/coroutines.pyÚ_is_debug_mode   s    ÿr   c                   @   sˆ   e Zd Zddd„Zdd„ Zdd„ Zdd	„ Zd
d„ Zddd„Zdd„ Z	e
dd„ ƒZe
dd„ ƒZe
dd„ ƒZdd„ Ze
dd„ ƒZdd„ ZdS )ÚCoroWrapperNc                 C   sZ   t  |¡st  |¡st|ƒ‚|| _|| _t t 	d¡¡| _
t|dd ƒ| _t|dd ƒ| _d S )Nr   Ú__name__Ú__qualname__)ÚinspectÚisgeneratorr   ÚAssertionErrorÚgenÚfuncr   Úextract_stackr
   Ú	_getframeÚ_source_tracebackÚgetattrr   r   )Úselfr   r   r   r   r   Ú__init__'   s    zCoroWrapper.__init__c                 C   sJ   t | ƒ}| jr4| jd }|d|d › d|d › �7 }d| jj› d|› d�S )	Néÿÿÿÿz, created at r   ú:r   ú<ú ú>)Ú_format_coroutiner   Ú	__class__r   )r!   Ú	coro_reprÚframer   r   r   Ú__repr__/   s
    
zCoroWrapper.__repr__c                 C   s   | S ©Nr   ©r!   r   r   r   Ú__iter__7   s    zCoroWrapper.__iter__c                 C   s   | j  d ¡S r-   ©r   Úsendr.   r   r   r   Ú__next__:   s    zCoroWrapper.__next__c                 C   s   | j  |¡S r-   r0   )r!   Úvaluer   r   r   r1   =   s    zCoroWrapper.sendc                 C   s   | j  |||¡S r-   )r   Úthrow)r!   Útyper3   Ú	tracebackr   r   r   r4   @   s    zCoroWrapper.throwc                 C   s
   | j  ¡ S r-   )r   Úcloser.   r   r   r   r7   C   s    zCoroWrapper.closec                 C   s   | j jS r-   )r   Úgi_framer.   r   r   r   r8   F   s    zCoroWrapper.gi_framec                 C   s   | j jS r-   )r   Ú
gi_runningr.   r   r   r   r9   J   s    zCoroWrapper.gi_runningc                 C   s   | j jS r-   )r   Úgi_coder.   r   r   r   r:   N   s    zCoroWrapper.gi_codec                 C   s   | S r-   r   r.   r   r   r   Ú	__await__R   s    zCoroWrapper.__await__c                 C   s   | j jS r-   )r   Úgi_yieldfromr.   r   r   r   r<   U   s    zCoroWrapper.gi_yieldfromc                 C   s€   t | dd ƒ}t |dd ƒ}|d k	r||jdkr|| ›d�}t | ddƒ}|rrd t |¡¡}|dtj› d	�7 }|| ¡ 7 }t 	|¡ d S )
Nr   r8   r#   z was never yielded fromr   r   Ú zB
Coroutine object created at (most recent call last, truncated to z last lines):
)
r    Úf_lastiÚjoinr6   Úformat_listr   ZDEBUG_STACK_DEPTHÚrstripr	   Úerror)r!   r   r+   ÚmsgÚtbr   r   r   Ú__del__Y   s    
zCoroWrapper.__del__)N)NN)r   Ú
__module__r   r"   r,   r/   r2   r1   r4   r7   Úpropertyr8   r9   r:   r;   r<   rE   r   r   r   r   r   $   s"   





r   c                    sz   t jdtdd� t ˆ¡rˆS t ˆ¡r.ˆ‰ nt ˆ¡‡fdd„ƒ‰ t 	ˆ ¡‰ t
sXˆ }nt ˆ¡‡ ‡fdd„ƒ}t|_|S )z„Decorator to mark coroutines.

    If the coroutine is not yielded from before it is destroyed,
    an error message is logged.
    zN"@coroutine" decorator is deprecated since Python 3.8, use "async def" insteadé   )Ú
stacklevelc                  ?   sr   ˆ | |Ž}t  |¡s(t |¡s(t|tƒr4|E d H }n:z
|j}W n tk
rR   Y nX t|tj	j
ƒrn|ƒ E d H }|S r-   )r   Zisfuturer   r   Ú
isinstancer   r;   ÚAttributeErrorÚcollectionsÚabcÚ	Awaitable)ÚargsÚkwÚresZ
await_meth©r   r   r   Úcoroz   s    
ÿ
zcoroutine.<locals>.coroc                     s@   t ˆ | |Žˆd�}|jr |jd= tˆdd ƒ|_tˆdd ƒ|_|S )NrR   r#   r   r   )r   r   r    r   r   )rO   ÚkwdsÚw©rS   r   r   r   Úwrapper�   s    zcoroutine.<locals>.wrapper)ÚwarningsÚwarnÚDeprecationWarningr   r   ÚisgeneratorfunctionÚ	functoolsÚwrapsÚtypesr   Ú_DEBUGÚ_is_coroutine)r   rW   r   rV   r   r   i   s"    þ


r   c                 C   s   t  | ¡pt| ddƒtkS )z6Return True if func is a decorated coroutine function.r`   N)r   r   r    r`   rR   r   r   r   r   ¤   s    
ÿr   c                 C   s@   t | ƒtkrdS t| tƒr8ttƒdk r4t t | ƒ¡ dS dS dS )z)Return True if obj is a coroutine object.Téd   FN)r5   Ú_iscoroutine_typecacherJ   Ú_COROUTINE_TYPESÚlenÚadd)Úobjr   r   r   r   ±   s    
r   c           
         st  t | ƒst‚t| tƒ‰ ‡ fdd„}dd„ }d }t| dƒrF| jrF| j}nt| dƒr\| jr\| j}|| ƒ}|s~|| ƒrz|› d�S |S d }t| dƒrš| jrš| j}nt| d	ƒr°| jr°| j}|j	p¸d
}d}ˆ �r0| j
d k	�r0t | j
¡�s0t | j
¡}|d k	rú|\}}|d k�r|› d|› d|› �}	n|› d|› d|› �}	n@|d k	�rV|j}|› d|› d|› �}	n|j}|› d|› d|› �}	|	S )Nc                    s`   ˆ rt  | jdi ¡S t| dƒr,| jr,| j}n*t| dƒrD| jrD| j}ndt| ƒj› d�}|› d�S )Nr   r   r   r%   z without __name__>z())r   Z_format_callbackr   Úhasattrr   r   r5   )rS   Ú	coro_name©Zis_corowrapperr   r   Úget_nameÆ   s    z#_format_coroutine.<locals>.get_namec                 S   sH   z| j W S  tk
rB   z| jW  Y S  tk
r<   Y Y dS X Y nX d S )NF)Ú
cr_runningrK   r9   )rS   r   r   r   Ú
is_running×   s    z%_format_coroutine.<locals>.is_runningÚcr_coder:   z runningr8   Úcr_framez<empty co_filename>r   z done, defined at r$   z running, defined at z running at )r   r   rJ   r   rg   rm   r:   r8   rn   Úco_filenamer   r   r[   r   Z_get_function_sourceÚf_linenoÚco_firstlineno)
rS   rj   rl   Z	coro_coderh   Z
coro_frameÚfilenameÚlinenoÚsourcer*   r   ri   r   r(   Á   sL    
	

ÿ
þ

r(   ) Ú__all__Zcollections.abcrL   r\   r   r   r
   r6   r^   rX   r=   r   r   r   Úlogr	   r   r_   r   r   Úobjectr`   r   ÚCoroutineTypeÚGeneratorTyperM   Ú	Coroutinerc   Úsetrb   r   r(   r   r   r   r   Ú<module>   s2   E8 ÿ