o
    Zh                     @   s   d dl Z d dlmZ d dlmZmZ d dlmZ d dlm	Z	 e	rKd dl
mZ d dl
mZ d dl
mZ d d	l
mZ d d
lmZ eee eee gef ZG dd deZdd ZdddZdS )    N)Hub)capture_internal_exceptionsevent_from_exception)Integration)TYPE_CHECKING)Callable)Any)Type)Optional)TracebackTypec                   @   s*   e Zd ZdZdZdddZedd ZdS )	ExcepthookIntegration
excepthookFc                 C   s"   t |tstd|f || _d S )Nz7Invalid value for always_run: %s (must be type boolean))
isinstancebool
ValueError
always_run)selfr    r   Y/var/www/html/lang_env/lib/python3.10/site-packages/sentry_sdk/integrations/excepthook.py__init__   s   

zExcepthookIntegration.__init__c                   C   s   t tjt_d S )N)_make_excepthooksysr   r   r   r   r   
setup_once&   s   z ExcepthookIntegration.setup_onceNF)__name__
__module____qualname__
identifierr   r   staticmethodr   r   r   r   r   r      s    

r   c                    s    fdd}|S )Nc                    s   t j}|t}|d ur>t|jr>|j}t  t| ||f|j	dddd\}}|j
||d W d    n1 s9w   Y   | ||S )Nr   F)typeZhandled)Zclient_optionsZ	mechanism)hint)r   currentZget_integrationr   _should_sendr   clientr   r   optionsZcapture_event)type_value	tracebackZhubZintegrationr#   eventr    old_excepthookr   r   sentry_sdk_excepthook.   s   

z/_make_excepthook.<locals>.sentry_sdk_excepthookr   )r*   r+   r   r)   r   r   ,   s   r   Fc                 C   s   | rdS t tdrdS dS )NTps1F)hasattrr   )r   r   r   r   r"   D   s
   
r"   r   )r   Zsentry_sdk.hubr   Zsentry_sdk.utilsr   r   Zsentry_sdk.integrationsr   Zsentry_sdk._typesr   typingr   r   r	   r
   typesr   BaseExceptionZ
Excepthookr   r   r"   r   r   r   r   <module>   s&    