U 췀g@sddlZddlmZddlmZmZddlZddlmZddl m Z m Z ddl m Z mZmZmZddlmZerddlmZdd lmZdd lmZdd lmZdd lmZed edefdZGdddeZddZddZdS)Nwraps)Threadcurrent_thread) Integrationuse_isolation_scope use_scope)event_from_exceptioncapture_internal_exceptionsloggerreraise) TYPE_CHECKING)Any)TypeVar)Callable)Optional)ExcInfoF.)boundc@s&eZdZdZdddZeddZdS) ThreadingIntegration threadingNTcCs*|dk rtd||_|dk r&||_dS)NzLDeprecated: propagate_hub is deprecated. This will be removed in the future.)r warningpropagate_scope)selfZ propagate_hubrrO/opt/hc_python/lib/python3.8/site-packages/sentry_sdk/integrations/threading.py__init__szThreadingIntegration.__init__cs$tjtfdd}|t_dS)Nc stt}|dkr&|f||S|jr>t}t}nd}d}t$t||t |j d|j }||_ W5QRX|f||S)N__func__) sentry_sdk get_clientget_integrationrrZget_isolation_scopeZget_current_scoper _wrap_rungetattrrun)rakwZ integrationZisolation_scopeZ current_scopeZnew_runZ old_startrr sentry_start4s  z5ThreadingIntegration.setup_once..sentry_start)rstartr)r(rr'r setup_once/szThreadingIntegration.setup_once)NT)__name__ __module__ __qualname__ identifierr staticmethodr*rrrrrs rcstfdd}|S)Nc snfdd}dk rddk rdt4t |W5QRW5QRSQRXW5QRXn|SdS)Ncs<zt}|fWStk r6ttYnXdS)N)r Exceptionr _capture_exception)r)r%r& old_run_funcrr_run_old_run_funcZs z1_wrap_run..run.._run_old_run_funcr)r%r&r3current_scope_to_useisolation_scope_to_user2)r%r&rr$Ws   0z_wrap_run..runr)r6r5r2r$rr4rr"Usr"cCsJt}t}|tdk rFt||jdddd\}}tj||d|S)NrF)typeZhandled)Zclient_optionsZ mechanism)hint) sysexc_inforr r!rr optionsZ capture_event)r:clienteventr8rrrr1ls r1)r9 functoolsrrrrrZsentry_sdk.integrationsrZsentry_sdk.scoperr Zsentry_sdk.utilsr r r r typingrrrrrZsentry_sdk._typesrrrr"r1rrrrs"        9