� ���g� ���ddlZddlZddlZddlmZddlmZmZmZerddl m Z Gd�de e��Z Gd�d��Z dS) �N)�Enum)� TYPE_CHECKING�List�Optional)�Clientc��eZdZdZdS)� Integrations�djangoN)�__name__� __module__� __qualname__�Django���i/home/asafur/pinokio/api/open-webui.git/app/env/lib/python3.11/site-packages/posthog/exception_capture.pyr r s������ �F�F�Frr c�x�eZdZejd��Zd dddeeefd�Z d�Z d�Z d �Z d �Z d d �ZdS) �ExceptionCapture�posthogN�clientr� integrationsc��||_tj|_|jt_|jt _g|_|pgD]x}|tj krf ddl m }||j ��}|j� |���D#t$r'}|j�d|����Yd}~�pd}~wwxYw�ydS)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)�selfrr� integrationr�enabled_integration�es r�__init__zExceptionCapture.__init__s����� �#&�>�� ��/���#�<� ��$&��!�'�-�2� T� T�K��l�1�1�1�T�W�W�W�W�W�W�*;�*;�D�<S�*T�*T�'��-�4�4�5H�I�I�I�I�� �T�T�T��H�&�&�'R�q�'R�'R�S�S�S�S�S�S�S�S�����T���� 2� T� Ts�0B � B;�B6�6B;c�d�|jt_|jD]}|����dS�N)rrrr� uninstall)r&r's r�closezExceptionCapture.close,s=���1����4� $� $�K� � !� !� #� #� #� #� $� $rc�d�|�|||f��|�|||��dSr,)�capture_exceptionr)r&�exc_type� exc_value� exc_tracebacks rrz"ExceptionCapture.exception_handler1s;�� ����)�]�C�D�D�D� � � ��9�m�D�D�D�D�Drc�T�|�|j|j|jf��dSr,)r0r1r2r3)r&�argss rrz)ExceptionCapture.thread_exception_handler6s*�� ���� �t�~�t�?Q�R�S�S�S�S�Src�~�d|vr d|di}nd}|�|d|d|df|��dS)N� distinct_idr��)r0)r&�exc_info�extra_properties�metadatas rr!z#ExceptionCapture.exception_receiver9sT�� �,� ,� ,�%�'7� �'F�G�H�H��H� ����� �X�a�[�(�1�+�F��Q�Q�Q�Q�Qrc��� |r|�d��nd}|j�||��dS#t$r(}|j�d|����Yd}~dSd}~wwxYw)Nr7zFailed to capture exception: )�getrr0r#r$r%)r&r%r<r7r)s rr0z"ExceptionCapture.capture_exception@s��� D�9A�K�(�,�,�}�5�5�5�t�K� �K� )� )�)�[� A� A� A� A� A��� D� D� D� �H� � �B�q�B�B� C� C� C� C� C� C� C� C� C����� D���s�48� A*�A%�%A*r,)r r r �logging� getLoggerr$rrr r*r.rrr!r0rrrrrs������� �'� �I� &� &�C�T�T�x�T�x��\�@R�7S�T�T�T�T�&$�$�$� E�E�E� T�T�T�R�R�R�D�D�D�D�D�Drr)r?rr�enumr�typingrrr�posthog.clientr�strr rrrr�<module>rEs��� ���� � � � �����������0�0�0�0�0�0�0�0�0�0��&�%�%�%�%�%�%������3�����1D�1D�1D�1D�1D�1D�1D�1D�1D�1Dr
Memory