
    Ki
                         S SK r S SKrS SKrS SKJr  S SKJrJrJr  \(       a  S SK	J
r
   " S S\\5      r " S S5      rg)	    N)Enum)TYPE_CHECKINGListOptional)Clientc                       \ rS rSrSrSrg)Integrations   django N)__name__
__module____qualname____firstlineno__Django__static_attributes__r       [/var/www/html/dynamic-report/venv/lib/python3.13/site-packages/posthog/exception_capture.pyr	   r	      s    Fr   r	   c                   ~    \ rS rSr\R
                  " S5      r SSSS\\\	      4S jjr
S rS	 rS
 rS rSS jrSrg)ExceptionCapture   posthogNclientr   integrationsc                    Xl         [        R                  U l        U R                  [        l        U R
                  [        l        / U l        U=(       d    /  HM  nU[        R                  :X  d  M   SSK
Jn  U" U R                  5      nU R                  R                  U5        MO     g ! [         a)  nU R                  R!                  SU 35         S nAM  S nAff = f)Nr   )DjangoIntegrationz%Failed to enable Django integration: )r   sys
excepthookoriginal_excepthookexception_handlerthread_exception_handler	threadingenabled_integrationsr	   r   %posthog.exception_integrations.djangor   exception_receiverappend	Exceptionlog	exception)selfr   r   integrationr   enabled_integrationes          r   __init__ExceptionCapture.__init__   s     #&>> //#<<	$&!'-2-K l111TW*;D<S<S*T'--445HI . ! THH&&)Nqc'RSSTs   23B**
C4CCc                 t    U R                   [        l        U R                   H  nUR	                  5         M     g N)r   r   r   r#   	uninstall)r*   r+   s     r   closeExceptionCapture.close.   s+    1144K!!# 5r   c                 N    U R                  XU45        U R                  XU5        g r1   )capture_exceptionr   )r*   exc_type	exc_valueexc_tracebacks       r   r    "ExceptionCapture.exception_handler3   s%    ]CD  mDr   c                 h    U R                  UR                  UR                  UR                  45        g r1   )r6   r7   r8   r9   )r*   argss     r   r!   )ExceptionCapture.thread_exception_handler8   s%    t~~t?Q?QRSr   c                 `    SU;   a  SUS   0nOS nU R                  US   US   US   4U5        g )Ndistinct_idr         )r6   )r*   exc_infoextra_propertiesmetadatas       r   r%   #ExceptionCapture.exception_receiver;   sC    ,,%'7'FGHHXa[(1+FQr   c                      U(       a  UR                  S5      OS nU R                  R                  X5        g ! [         a(  nU R                  R                  SU 35         S nAg S nAff = f)Nr?   zFailed to capture exception: )getr   r6   r'   r(   r)   )r*   r)   rD   r?   r-   s        r   r6   "ExceptionCapture.capture_exceptionB   s[    	D9A(,,}5tKKK)))A 	DHH!>qcBCC	Ds   58 
A*A%%A*)r   r#   r   r1   )r   r   r   r   logging	getLoggerr(   r   r   r	   r.   r3   r    r!   r%   r6   r   r   r   r   r   r      sZ     

I
&C NRTT.6tL7I.JT*$
E
TRDr   r   )rI   r   r"   enumr   typingr   r   r   posthog.clientr   strr	   r   r   r   r   <module>rO      s9     
   0 0%3 3D 3Dr   