o ?Og]"@sdZddlZddlZddlZddlZddlZddlZddlZddl Z ddl m Z ddl m Z ddl m Z ddlmZdd ZeZGd d d Zd d ZeZddZejejejjefZeZddZddZdS)) coroutineiscoroutinefunction iscoroutineN) base_futures) constants)format_helpers)loggercCs"tjjptjj ottjdS)NZPYTHONASYNCIODEBUG)sysflagsdev_modeignore_environmentboolosenvirongetrr9/opt/alt/python310/lib64/python3.10/asyncio/coroutines.py_is_debug_modes rc@seZdZdddZddZddZdd Zd d Zdd d ZddZ e ddZ e ddZ e ddZ ddZe ddZddZdS) CoroWrapperNcCsZt|st|sJ|||_||_ttd|_ t |dd|_ t |dd|_ dS)Nr__name__ __qualname__) inspect isgeneratorrgenfuncr extract_stackr _getframe_source_tracebackgetattrrr)selfrrrrr__init__'s zCoroWrapper.__init__cCsJt|}|jr|jd}|d|dd|d7}d|jjd|dS) Nz , created at r:r< >)_format_coroutiner __class__r)r coro_reprframerrr__repr__/s  zCoroWrapper.__repr__cC|SNrr rrr__iter__7zCoroWrapper.__iter__cCs |jdSr-rsendr.rrr__next__: zCoroWrapper.__next__cCs |j|Sr-r1)r valuerrrr2=r4zCoroWrapper.sendcCs|j|||Sr-)rthrow)r typer5 tracebackrrrr6@szCoroWrapper.throwcCs |jSr-)rcloser.rrrr9Cs zCoroWrapper.closecC|jjSr-)rgi_framer.rrrr;FzCoroWrapper.gi_framecCr:r-)r gi_runningr.rrrr=Jr<zCoroWrapper.gi_runningcCr:r-)rgi_coder.rrrr>Nr<zCoroWrapper.gi_codecCr,r-rr.rrr __await__Rr0zCoroWrapper.__await__cCr:r-)r gi_yieldfromr.rrrr@Ur<zCoroWrapper.gi_yieldfromcCst|dd}t|dd}|dur@|jdkrB|d}t|dd}|r9dt|}|dtjd 7}||7}t |dSdSdS) Nrr;r"z was never yielded fromrrzB Coroutine object created at (most recent call last, truncated to z last lines): ) rf_lastijoinr8 format_listrZDEBUG_STACK_DEPTHrstripr error)r rr*msgtbrrr__del__Ys     zCoroWrapper.__del__r-)NN)r __module__rr!r+r/r3r2r6r9propertyr;r=r>r?r@rIrrrrr$s$       rcsztjdtddtrStrn tfddt t s,}n tfdd}t |_ |S)zDecorator 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?sz|i|}t|st|st|tr|EdH}|Sz|j}Wn ty-Y|Swt|tj j r;|EdH}|Sr-) rZisfuturerr isinstancerr?AttributeError collectionsabc Awaitable)argskwresZ await_methrrrcorozs      zcoroutine..corocsDt|i|d}|jr|jd=tdd|_tdd|_|S)NrVr"rr)rrrrr)rSkwdswrWrrrwrappers zcoroutine..wrapper) warningswarnDeprecationWarningrrisgeneratorfunction functoolswrapstypesr_DEBUG _is_coroutine)rr[rrZrris"    rcCst|p t|ddtuS)z6Return True if func is a decorated coroutine function.rdN)rrrrdrVrrrrs rcCs<t|tvrdSt|trttdkrtt|dSdS)z)Return True if obj is a coroutine object.TdF)r7_iscoroutine_typecacherN_COROUTINE_TYPESlenadd)objrrrrs   rc spt|sJt|tfdd}dd}d}t|dr#|jr#|j}n t|dr.|jr.|j}||}|s?||r=|dS|Sd}t|drM|jrM|j}n t|d rX|jrX|j}|jp\d }d }r|j durt |j st |j }|durz|\}}|dur|d |d |} | S|d|d |} | S|dur|j}|d|d |} | S|j}|d |d |} | S)Ncs`r t|jdiSt|dr|jr|j}nt|dr"|jr"|j}n dt|jd}|dS)Nrrrr$z without __name__>z())rZ_format_callbackrhasattrrrr7)rW coro_nameZis_corowrapperrrget_names z#_format_coroutine..get_namec Ss<z|jWStyz|jWYStyYYdSww)NF) cr_runningrOr=)rWrrr is_runnings   z%_format_coroutine..is_runningcr_coder>z runningr;cr_framezrz done, defined at r#z running, defined at z running at )rrNrrkrqr>r;rr co_filenamerrr_rZ_get_function_sourcef_linenoco_firstlineno) rWrnrpZ coro_coderlZ coro_framefilenamelinenosourcer)rrmrr'sP           r') __all__Zcollections.abcrPr`rrr r8rbr\rArrrlogr rrcrrobjectrdr CoroutineType GeneratorTyperQ Coroutinergsetrfrr'rrrrs2    E8