
    \j                         d dl Z d dlZd dlZd dlZd dlmZ d dlmZ d dlm	Z	 e	rd dlm
Z
 d dlmZ deded	dfd
Z G d de      Zy)    N)logger)Integration)TYPE_CHECKING)Any)Optionalpendingtimeoutreturnc                     dt         ddfd} |d| z          |d|z          |dt        j                  dk(  xr d	xs d
z         t        j                  j                          y)zThis is the default shutdown callback that is set on the options.
    It prints out a message to stderr that informs the user that some events
    are still pending and the process is waiting for them to flush out.
    msgr
   Nc                 H    t         j                  j                  | dz          y )N
)sysstderrwrite)r   s    H/root/env/lib/python3.12/site-packages/sentry_sdk/integrations/atexit.pyechozdefault_callback.<locals>.echo   s    

t$    z.Sentry is attempting to send %i pending eventszWaiting up to %s secondszPress Ctrl-%s to quitntBreakC)strosnamer   r   flush)r   r	   r   s      r   default_callbackr      sc    %# %$ % 		9G	CD	#g	-.	 BGGtO$?$F3	GHJJr   c                   ,    e Zd ZdZdddZedd       Zy)AtexitIntegrationatexitNc                 "    |t         }|| _        y N)r   callback)selfr"   s     r   __init__zAtexitIntegration.__init__!   s    'H r   c                  2    t         j                  dd       } y )Nc                  ,   t        j                         } | j                  t              }|y t	        j
                  d       t	        j
                  d       t        j                         j                          | j                  |j                         y )Nzatexit: got shutdown signalzatexit: shutting down client)r"   )

sentry_sdk
get_clientget_integrationr   r   debugget_isolation_scopeend_sessioncloser"   )clientintegrations     r   	_shutdownz/AtexitIntegration.setup_once.<locals>._shutdown(   sm    **,F 001BCK"LL67LL78**,88:LL+"6"6L7r   r
   N)r   register)r0   s    r   
setup_oncezAtexitIntegration.setup_once&   s    		8 
	8r   r!   )r"   zOptional[Any]r
   Nr1   )__name__
__module____qualname__
identifierr$   staticmethodr3    r   r   r   r      s     J!
 8 8r   r   )r   r   r   r'   sentry_sdk.utilsr   sentry_sdk.integrationsr   typingr   r   r   intr   r   r9   r   r   <module>r>      sI    	 
   # /  c C D 8 8r   