U e5d]"ã@sÔdZddlZddlZddlZddlZddlZddlZddlZddl Z ddl m Z ddl m Z ddl m Z ddlmZdd „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ú*/usr/lib64/python3.8/asyncio/coroutines.pyÚ_is_debug_modes ÿrc@sˆeZdZddd„Zdd„Zdd„Zdd „Zd d „Zdd d „Zdd„Z e dd„ƒZ e 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__7szCoroWrapper.__iter__cCs |j d¡Sr-©rÚsendr.rrrÚ__next__:szCoroWrapper.__next__cCs |j |¡Sr-r0)r!Úvaluerrrr1=szCoroWrapper.sendcCs|j |||¡Sr-)rÚthrow)r!Útyper3Ú tracebackrrrr4@szCoroWrapper.throwcCs |j ¡Sr-)rÚcloser.rrrr7CszCoroWrapper.closecCs|jjSr-)rÚgi_framer.rrrr8FszCoroWrapper.gi_framecCs|jjSr-)rÚ gi_runningr.rrrr9JszCoroWrapper.gi_runningcCs|jjSr-)rÚgi_coder.rrrr:NszCoroWrapper.gi_codecCs|Sr-rr.rrrÚ __await__RszCoroWrapper.__await__cCs|jjSr-)rÚ gi_yieldfromr.rrrr<UszCoroWrapper.gi_yieldfromcCs€t|ddƒ}t|ddƒ}|dk r||jdkr||›d�}t|ddƒ}|rrd t |¡¡}|dtj›d �7}|| ¡7}t  |¡dS) Nrr8r#z was never yielded fromrrÚzB Coroutine object created at (most recent call last, truncated to z last lines): ) r Úf_lastiÚjoinr6Ú format_listrZDEBUG_STACK_DEPTHÚrstripr Úerror)r!rr+ÚmsgÚtbrrrÚ__del__Ys     zCoroWrapper.__del__)N)NN)rÚ __module__rr"r,r/r2r1r4r7Úpropertyr8r9r:r;r<rErrrrr$s"      rcsztjdtdd�t ˆ¡rˆSt ˆ¡r.ˆ‰nt ˆ¡‡fdd„ƒ‰t  ˆ¡‰t sXˆ}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. zN"@coroutine" decorator is deprecated since Python 3.8, use "async def" insteadé)Ú stacklevelc?srˆ||Ž}t |¡s(t |¡s(t|tƒr4|EdH}n:z |j}Wntk rRYnXt|tj j ƒrn|ƒEdH}|Sr-) rZisfuturerrÚ isinstancerr;ÚAttributeErrorÚ collectionsÚabcÚ Awaitable)ÚargsÚkwÚresZ await_meth©rrrÚcorozs ÿ   zcoroutine..corocs@tˆ||Žˆd�}|jr |jd=tˆddƒ|_tˆddƒ|_|S)NrRr#rr)rrr rr)rOÚkwdsÚw©rSrrrÚwrapper�s zcoroutine..wrapper) ÚwarningsÚwarnÚDeprecationWarningrrÚisgeneratorfunctionÚ functoolsÚwrapsÚtypesrÚ_DEBUGÚ _is_coroutine)rrWrrVrris"þ    rcCst |¡pt|ddƒtkS)z6Return True if func is a decorated coroutine function.r`N)rrr r`rRrrrr¤s ÿrcCs@t|ƒtkrdSt|tƒr8ttƒdkr4t t|ƒ¡dSdSdS)z)Return True if obj is a coroutine object.TédFN)r5Ú_iscoroutine_typecacherJÚ_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Úhasattrrrr5)rSÚ coro_name©Zis_corowrapperrrÚget_nameÆsz#_format_coroutine..get_namec SsHz|jWStk rBz |jWYStk r<YYdSXYnXdS)NF)Ú cr_runningrKr9)rSrrrÚ is_running×s z%_format_coroutine..is_runningÚcr_coder:z runningr8Úcr_framezrz done, defined at r$z running, defined at z running at )rrrJrrgrmr:r8rnÚ co_filenamerrr[rZ_get_function_sourceÚf_linenoÚco_firstlineno) rSrjrlZ coro_coderhZ coro_frameÚfilenameÚlinenoÚsourcer*rrirr(ÁsL      ÿ þ   r() Ú__all__Zcollections.abcrLr\rrr r6r^rXr=rrrÚlogr rr_rrÚobjectr`rÚ CoroutineTypeÚ GeneratorTyperMÚ CoroutinercÚsetrbrr(rrrrÚs2    E8ÿ