U 췀g @s|ddlZddlZddlZddlmZmZddlmZddlm Z e r`ddl m Z ddl m Z mZGdddeZd d ZdS) N)capture_internal_exceptionsevent_from_exception) Integration) TYPE_CHECKING)Callable)NoReturnUnionc@s:eZdZdZdZddddZeddZed d Zd S) SysExitIntegrationaMCaptures sys.exit calls and sends them as events to Sentry. By default, SystemExit exceptions are not captured by the SDK. Enabling this integration will capture SystemExit exceptions generated by sys.exit calls and send them to Sentry. This integration, in its default configuration, only captures the sys.exit call if the exit code is a non-zero and non-None value (unsuccessful exits). Pass `capture_successful_exits=True` to capture successful exits as well. Note that the integration does not capture SystemExit exceptions raised outside a call to sys.exit. Zsys_exitF)capture_successful_exitscCs ||_dSN)_capture_successful_exits)selfr rN/opt/hc_python/lib/python3.8/site-packages/sentry_sdk/integrations/sys_exit.py__init__szSysExitIntegration.__init__cCs tdSr )r _patch_sys_exitrrrr setup_onceszSysExitIntegration.setup_oncecs(tjtdfdd }|t_dS)Nrc s~tt}|dkr|z |WnNtk rx}z0t|jsR|dkrZt|W5QRX|W5d}~XYnXdS)N)rN) sentry_sdk get_clientZget_integrationr SystemExitrr _capture_exception)Z_SysExitIntegration__statusZ integrationeZold_exitrrsentry_patched_exit)s z?SysExitIntegration._patch_sys_exit..sentry_patched_exit)r)sysexit functoolswraps)rrrrr$sz"SysExitIntegration._patch_sys_exitN) __name__ __module__ __qualname____doc__ identifierr staticmethodrrrrrrr s  r cCs2t|tjtjddd\}}tj||ddS)NF)typeZhandled)Zclient_optionsZ mechanism)hint)rrroptionsr r"Z capture_event)exceventr%rrrr?s  r)rrrZsentry_sdk.utilsrrZsentry_sdk.integrationsrZsentry_sdk._typesrcollections.abcrtypingrrr rrrrrs   1