a DOg]"@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"tjjp tjj o ttjdS)NZPYTHONASYNCIODEBUG)sysflagsdev_modeignore_environmentboolosenvirongetrr7/opt/alt/python39/lib64/python3.9/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|}|jr4|jd}|d|dd|d7}d|jjd|dS) Nz , created at r:r< >)_format_coroutiner __class__r)r coro_reprframerrr__repr__/s  zCoroWrapper.__repr__cCs|SNrr rrr__iter__7szCoroWrapper.__iter__cCs |jdSr,rsendr-rrr__next__:szCoroWrapper.__next__cCs |j|Sr,r/)r valuerrrr0=szCoroWrapper.sendcCs|j|||Sr,)rthrow)r typer2 tracebackrrrr3@szCoroWrapper.throwcCs |jSr,)rcloser-rrrr6CszCoroWrapper.closecCs|jjSr,)rgi_framer-rrrr7FszCoroWrapper.gi_framecCs|jjSr,)r gi_runningr-rrrr8JszCoroWrapper.gi_runningcCs|jjSr,)rgi_coder-rrrr9NszCoroWrapper.gi_codecCs|Sr,rr-rrr __await__RszCoroWrapper.__await__cCs|jjSr,)r gi_yieldfromr-rrrr;UszCoroWrapper.gi_yieldfromcCst|dd}t|dd}|dur||jdkr||d}t|dd}|rrdt|}|dtjd 7}||7}t |dS) Nrr7r"z was never yielded fromrrzB Coroutine object created at (most recent call last, truncated to z last lines): ) rf_lastijoinr5 format_listrZDEBUG_STACK_DEPTHrstripr error)r rr*msgtbrrr__del__Ys      zCoroWrapper.__del__)N)NN)r __module__rr!r+r.r1r0r3r6propertyr7r8r9r:r;rDrrrrr$s"      rcsztjdtddtrStr.ntfddt t sX}ntfdd}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?st|i|}t|s,t|s,t|tr8|EdH}n8z |j}WntyTYn0t|tj j rp|EdH}|Sr,) rZisfuturerr isinstancerr:AttributeError collectionsabc Awaitable)argskwresZ await_methrrrcorozs    zcoroutine..corocsDt|i|d}|jr$|jd=tdd|_tdd|_|S)NrQr"rr)rrrrr)rNkwdswrRrrrwrappers zcoroutine..wrapper) warningswarnDeprecationWarningrrisgeneratorfunction functoolswrapstypesr_DEBUG _is_coroutine)rrVrrUrris"    rcCst|pt|ddtuS)z6Return True if func is a decorated coroutine function.r_N)rrrr_rQrrrrs rcCs@t|tvrdSt|tr8ttdkr4tt|dSdSdS)z)Return True if obj is a coroutine object.TdFN)r4_iscoroutine_typecacherI_COROUTINE_TYPESlenadd)objrrrrs   rc stt|s Jt|tfdd}dd}d}t|drF|jrF|j}nt|dr\|jr\|j}||}|s~||rz|dS|Sd}t|dr|jr|j}nt|d r|jr|j}|jpd }d }r0|j dur0t |j s0t |j }|dur|\}}|dur|d |d |} n|d|d |} n@|durV|j}|d|d |} n|j}|d |d |} | S)Ncs`rt|jdiSt|dr,|jr,|j}n*t|drD|jrD|j}ndt|jd}|dS)Nrrrr$z without __name__>z())rZ_format_callbackrhasattrrrr4)rR coro_nameZis_corowrapperrrget_namesz#_format_coroutine..get_namec SsDz|jWSty>z |jWYSty8YYdS0Yn0dS)NF) cr_runningrJr8)rRrrr is_runnings   z%_format_coroutine..is_runningcr_coder9z runningr7cr_framezrz done, defined at r#z running, defined at z running at )rrIrrfrlr9r7rm co_filenamerrrZrZ_get_function_sourcef_linenoco_firstlineno) rRrirkZ coro_codergZ coro_framefilenamelinenosourcer)rrhrr'sL          r') __all__collections.abcrKr[rrr r5r]rWr<rrrlogr rr^rrobjectr_r CoroutineType GeneratorTyperL Coroutinerbsetrarr'rrrrs0    E8