
    gh	                         S SK r S SKrS SKrS SKJrJr  S SKJr  S SKJ	r	  \	(       a  S SK
Jr  S SKJrJr   " S S\5      rS	 rg)
    N)capture_internal_exceptionsevent_from_exception)Integration)TYPE_CHECKING)Callable)NoReturnUnionc                   J    \ rS rSrSrSrSS.S jr\S 5       r\S 5       r	S	r
g
)SysExitIntegration   a5  Captures 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.
sys_exitF)capture_successful_exitsc                    Xl         g N_capture_successful_exits)selfr   s     c/home/kali/devsecops-assessor/venv/lib/python3.13/site-packages/sentry_sdk/integrations/sys_exit.py__init__SysExitIntegration.__init__   s    )A&    c                  ,    [         R                  5         g r   )r   _patch_sys_exit r   r   
setup_onceSysExitIntegration.setup_once   s     	**,r   c                  ~   ^ [         R                  m[        R                  " T5      SU4S jj5       n U [         l        g )Nc                 4  > [         R                  " 5       R                  [        5      nUc  T" U 5         T" U 5        g ! [         aN  n[        5          UR                  (       d  U S;  a  [        U5        S S S 5        Ue! , (       d  f       Ue= fS nAff = f)N)r   N)
sentry_sdk
get_clientget_integrationr   
SystemExitr   r   _capture_exception)_SysExitIntegration__statusintegrationeold_exits      r   sentry_patched_exit?SysExitIntegration._patch_sys_exit.<locals>.sentry_patched_exit)   s     %//1AABTUK""	" 02"<< Q A +1- 3  32 s-   ? 
B	
B#B 6
B 
B	
BB)r   )sysexit	functoolswraps)r(   r'   s    @r   r   "SysExitIntegration._patch_sys_exit$   s2     88		"	 
#	$ 'r   r   N)__name__
__module____qualname____firstlineno____doc__
identifierr   staticmethodr   r   __static_attributes__r   r   r   r   r      s?     J38 B - - ' 'r   r   c                     [        U [        R                  " 5       R                  [        R
                  SS.S9u  p[        R                  " XS9  g )NF)typehandled)client_options	mechanism)hint)r   r   r    optionsr   r4   capture_event)exceventr<   s      r   r#   r#   ?   sA    &!,,.66-88UKKE
 U.r   )r,   r*   r   sentry_sdk.utilsr   r   sentry_sdk.integrationsr   sentry_sdk._typesr   collections.abcr   typingr   r	   r   r#   r   r   r   <module>rF      s2     
  N / +(&.' .'b/r   