U if]"@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/python38/lib64/python3.8/asyncio/coroutines.py_is_debug_modes rc@seZdZdddZddZddZdd Zd d Zdd d ZddZ e ddZ e ddZ e ddZ ddZe ddZddZdS) CoroWrapperNcCs>||_||_ttd|_t|dd|_t|dd|_ dS)Nr__name__ __qualname__) genfuncr 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|SNrrrrr__iter__7szCoroWrapper.__iter__cCs |jdSr*rsendr+rrr__next__:szCoroWrapper.__next__cCs |j|Sr*r-)rvaluerrrr.=szCoroWrapper.sendcCs|j|||Sr*)rthrow)rtyper0 tracebackrrrr1@szCoroWrapper.throwcCs |jSr*)rcloser+rrrr4CszCoroWrapper.closecCs|jjSr*)rgi_framer+rrrr5FszCoroWrapper.gi_framecCs|jjSr*)r gi_runningr+rrrr6JszCoroWrapper.gi_runningcCs|jjSr*)rgi_coder+rrrr7NszCoroWrapper.gi_codecCs|Sr*rr+rrr __await__RszCoroWrapper.__await__cCs|jjSr*)r gi_yieldfromr+rrrr9UszCoroWrapper.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): ) rf_lastijoinr3 format_listrZDEBUG_STACK_DEPTHrstripr error)rrr(msgtbrrr__del__Ys     zCoroWrapper.__del__)N)NN)r __module__rrr)r,r/r.r1r4propertyr5r6r7r8r9rBrrrrr$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?sr||}t|s(t|s(t|tr4|EdH}n:z |j}Wntk rRYnXt|tj j rn|EdH}|Sr*) rZisfutureinspectZ isgenerator isinstancerr8AttributeError collectionsabc Awaitable)argskwresZ await_methrrrcorozs    zcoroutine..corocs@t||d}|jr |jd=tdd|_tdd|_|S)NrPr rr)rrrrr)rMkwdswrQrrrwrappers zcoroutine..wrapper) warningswarnDeprecationWarningrGrisgeneratorfunction functoolswrapstypesr_DEBUG _is_coroutine)rrUrrTrris"    rcCst|pt|ddtkS)z6Return True if func is a decorated coroutine function.r^N)rGrrr^rPrrrrs rcCs@t|tkrdSt|tr8ttdkr4tt|dSdSdS)z)Return True if obj is a coroutine object.TdFN)r2_iscoroutine_typecacherH_COROUTINE_TYPESlenadd)objrrrrs   rc sht|tfdd}dd}d}t|dr:|jr:|j}nt|drP|jrP|j}||}|sr||rn|dS|Sd}t|dr|jr|j}nt|d r|jr|j}|jpd }d }r$|jdk r$t |js$t |j}|dk r|\}}|dkr|d |d |} n|d|d |} n@|dk rJ|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)rQ coro_nameZis_corowrapperrrget_namesz#_format_coroutine..get_namec SsHz|jWStk rBz |jWYStk r<YYdSXYnXdS)NF) cr_runningrIr6)rQrrr is_runnings z%_format_coroutine..is_runningcr_coder7z runningr5cr_framezrz done, defined at r!z running, defined at z running at )rHrrerkr7r5rl co_filenamerrGrYrZ_get_function_sourcef_linenoco_firstlineno) rQrhrjZ coro_coderfZ coro_framefilenamelinenosourcer'rrgrr%sJ         r%) __all__Zcollections.abcrJrZrGrr r3r\rVr:rrrlogr rr]rrobjectr^r CoroutineType GeneratorTyperK Coroutinerasetr`rr%rrrrs2    E8