U 췀g @sddlZddlZddlmZddlmZmZddlmZm Z zddl Z ddl m Z Wne k rpedYnXddlmZerddlmZdd lmZdd lmZd d Zd dZddZGdddeZdS)N)OP) Integration DidNotEnable)event_from_exceptionreraise)Taskzasyncio not available) TYPE_CHECKING)Any) Coroutine)ExcInfocCst|ddpt|ddpdS)N __qualname____name__zcoroutine without __name__)getattrcororM/opt/hc_python/lib/python3.8/site-packages/sentry_sdk/integrations/asyncio.pyget_names   rcsHdz*t}|fdd}||Wntk rBYnXdS)NcsHfdd}r ||f|St|fd|i|}|jrD|jd=|S)Nc snd}tXtjtjttjd4zIdH}Wntk rTt t YnXW5QRXW5QRX|S)N)opnameorigin) sentry_sdkZisolation_scopeZ start_spanrZFUNCTIONrAsyncioIntegrationr Exceptionr_capture_exception)resultrrr_coro_creating_hub_and_span*s $zPpatch_asyncio.._sentry_task_factory.._coro_creating_hub_and_spanloop)rZ_source_traceback)rrkwargsrtaskZorig_task_factoryrr_sentry_task_factory's  z+patch_asyncio.._sentry_task_factory)asyncioZget_running_loopZget_task_factoryZset_task_factory RuntimeError)rr"rr!r patch_asyncio s %r%cCsNt}t}|t}|dk rJt||jdddd\}}tj||d|S)Nr#F)typeZhandled)Zclient_optionsZ mechanism)hint) sysexc_inforZ get_clientZget_integrationrroptionsZ capture_event)r)clientZ integrationeventr'rrrrRs  rc@s&eZdZdZdeZeddZdS)rr#zauto.function.cCs tdS)N)r%rrrr setup_oncehszAsyncioIntegration.setup_onceN)r __module__r identifierr staticmethodr-rrrrrds r)r(rZsentry_sdk.constsrZsentry_sdk.integrationsrrZsentry_sdk.utilsrrr#Z asyncio.tasksr ImportErrortypingrr collections.abcr Zsentry_sdk._typesr rr%rrrrrrs$      2