B  f!@sdZddlZddlZddlZddlZddlZddlZddlZddl m Z ddl m Z ddl m Z ddl mZdd ZeZGd d d Zd d ZeZddZejejejjefZeZddZddZdS)) coroutineiscoroutinefunction iscoroutineN) base_futures) constants)format_helpers)loggercCs"tjjp tjj o ttjdS)NZPYTHONASYNCIODEBUG)sysflagsdev_modeignore_environmentboolosenvirongetrr7/opt/alt/python37/lib64/python3.7/asyncio/coroutines.py_is_debug_modes rc@seZdZdddZddZddZdd Zd d Zdd d ZddZ e ddZ e ddZ e ddZ ddZe ddZddZdS) CoroWrapperNcCsZt|st|st|||_||_tt d|_ t |dd|_ t |dd|_ dS)Nr__name__ __qualname__)inspect isgeneratorrAssertionErrorgenfuncr 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|S)Nr)r!rrr__iter__6szCoroWrapper.__iter__cCs |jdS)N)rsend)r!rrr__next__9szCoroWrapper.__next__cCs |j|S)N)rr.)r!valuerrrr.<szCoroWrapper.sendcCs|j|||S)N)rthrow)r!typer0 tracebackrrrr1?szCoroWrapper.throwcCs |jS)N)rclose)r!rrrr4BszCoroWrapper.closecCs|jjS)N)rgi_frame)r!rrrr5EszCoroWrapper.gi_framecCs|jjS)N)r gi_running)r!rrrr6IszCoroWrapper.gi_runningcCs|jjS)N)rgi_code)r!rrrr7MszCoroWrapper.gi_codecCs|S)Nr)r!rrr __await__QszCoroWrapper.__await__cCs|jjS)N)r gi_yieldfrom)r!rrrr9TszCoroWrapper.gi_yieldfromcCst|dd}t|dd}|dk r||jdkr||d}t|dd}|rrdt|}|dtjd 7}||7}t |dS) Nrr5r#z was never yielded fromrrzB Coroutine object created at (most recent call last, truncated to z last lines): ) r f_lastijoinr3 format_listrZDEBUG_STACK_DEPTHrstripr error)r!rr+msgtbrrr__del__Xs     zCoroWrapper.__del__)N)NN)r __module__rr"r,r-r/r.r1r4propertyr5r6r7r8r9rBrrrrr#s      rcsjtrStrntfddttsH}ntfdd}t|_|S)zDecorator 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|tr4|EdH}n:y |j}Wntk rRYnXt|tj j rn|EdH}|S)N) rZisfuturerr isinstancerr8AttributeError collectionsabc Awaitable)argskwZresZ await_meth)rrrcorovs     zcoroutine..corocs@t||d}|jr |jd=tdd|_tdd|_|S)N)rr#rr)rrr rr)rJkwdsw)rLrrrwrappers zcoroutine..wrapper) rrisgeneratorfunction functoolswrapstypesr_DEBUG _is_coroutine)rrOr)rLrrrhs    rcCst|pt|ddtkS)z6Return True if func is a decorated coroutine function.rUN)rrr rU)rrrrrs rcCs@t|tkrdSt|tr8ttdkr4tt|dSdSdS)z)Return True if obj is a coroutine object.TdFN)r2_iscoroutine_typecacherE_COROUTINE_TYPESlenadd)objrrrrs   rc stt|s tt|tfdd}dd}d}t|drF|jrF|j}nt|dr\|jr\|j}||}|s~||rz|dS|Sd}t|dr|jr|j}nt|d r|jr|j}|j pd }d }r0|j dk r0t |j s0t |j }|dk r|\}}|dkr|d |d |} n|d|d |} n@|dk rV|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_callbackrhasattrrrr2)rL coro_name)is_corowrapperrrget_namesz#_format_coroutine..get_namec Ss<y|jStk r6y|jStk r0dSXYnXdS)NF) cr_runningrFr6)rLrrr is_runningsz%_format_coroutine..is_runningcr_coder7z runningr5cr_framezrz done, defined at r$z running, defined at z running at )rrrErr\rbr7r5rc co_filenamerrrPrZ_get_function_sourcef_linenoco_firstlineno) rLr_raZ coro_coder]Z coro_framefilenamelinenosourcer*r)r^rr(sH          r()__all__Zcollections.abcrGrQrrr r3rSr:rrrlogr rrTrrobjectrUr CoroutineType GeneratorTyperH CoroutinerXsetrWrr(rrrrs,    E5