o
    iC	                     @   s   d dl Z d dlZd dlmZmZ d dlmZ d dlmZ erId 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dZddedefddZdS )    N)capture_internal_exceptionsevent_from_exception)Integration)TYPE_CHECKING)Callable)Any)Type)Optional)TracebackTypec                   @   s6   e Zd ZdZdZd
deddfddZeddd	ZdS )ExcepthookIntegration
excepthookF
always_runreturnNc                 C   s"   t |tstd|f || _d S )Nz7Invalid value for always_run: %s (must be type boolean))
isinstancebool
ValueErrorr   )selfr    r   _/home/ubuntu/veenaModal/venv/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_onceF)r   N)	__name__
__module____qualname__
identifierr   r   r   staticmethodr   r   r   r   r   r      s    r   old_excepthook
Excepthookr   c                    s"   dddt dddd f fdd}|S )	Ntype_zType[BaseException]value	tracebackzOptional[TracebackType]r   c                    s   t  t}|d u r | ||S t|jrBt ! t| ||ft  jdddd\}}t j	||d W d    n1 s=w   Y   | ||S )Nr   F)typehandled)client_options	mechanism)hint)

sentry_sdk
get_clientget_integrationr   _should_sendr   r   r   optionscapture_event)r!   r"   r#   integrationeventr(   r   r   r   sentry_sdk_excepthook-   s   

z/_make_excepthook.<locals>.sentry_sdk_excepthook)BaseException)r   r2   r   r1   r   r   ,   s   r   Fr   c                 C   s   | rdS t tdrdS dS )NTps1F)hasattrr   )r   r   r   r   r,   H   s
   
r,   )r   r    r   r    r   )r   r)   sentry_sdk.utilsr   r   sentry_sdk.integrationsr   typingr   r   r   r   r	   typesr
   r3   r    r   r   r   r,   r   r   r   r   <module>   s&    
