
    tni                         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dS )    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    rd	pd
z             t          j                                         dS )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                 J    t           j                            | dz              d S )N
)sysstderrwrite)r   s    [/var/www/html/gpu-tools/venv/lib/python3.11/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      s    %# %$ % % % % 	D	9G	CDDDD	#g	-...D	 BGtO$?$F3	GHHHJr   c                   4    e Zd ZdZdd	dZed
d            ZdS )AtexitIntegrationatexitNcallbackOptional[Any]r
   c                 &    |t           }|| _        d S N)r   r    )selfr    s     r   __init__zAtexitIntegration.__init__!   s    'H r   c                  2    t           j        dd            } d S )Nr
   c                  8   t          j                    } |                     t                    }|d S t	          j        d           t	          j        d           t          j                                                     |                     |j	                   d S )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(   s    *,,F 001BCCK"L6777L7888*,,88:::LL+"6L77777r   r
   N)r   register)r1   s    r   
setup_oncezAtexitIntegration.setup_once&   s,    		8 	8 	8 
	8 	8 	8r   r#   )r    r!   r
   Nr2   )__name__
__module____qualname__
identifierr%   staticmethodr4    r   r   r   r      sR        J! ! ! ! !
 8 8 8 \8 8 8r   r   )r   r   r   r(   sentry_sdk.utilsr   sentry_sdk.integrationsr   typingr   r   r   intr   r   r:   r   r   <module>r?      s    				 



      # # # # # # / / / / / /              c C D    8 8 8 8 8 8 8 8 8 8r   