AlkantarClanX12

Your IP : 18.224.55.63


Current Path : /opt/cloudlinux/venv/lib/python3.11/site-packages/raven/__pycache__/
Upload File :
Current File : //opt/cloudlinux/venv/lib/python3.11/site-packages/raven/__pycache__/breadcrumbs.cpython-311.pyc

�

�܋f�3����ddlmZddlZddlZ	ddlmZn#e$r	ddlmZYnwxYwddlmZddl	m
Z
ddlmZddl
mZddlmZmZmZmZd	Zd
ZgZiZejd��Zd�ZGd
�de��ZGd�de��Zd"d�Zd�Z		d#d�Z d�Z!d$d�Z"d�Z#ed���Z$d$d�Z%d�Z&d�Z'iZ(d�Z)e)d��d���Z*e)d��d ���Z+d!�Z,ddl-Z.dS)%�)�absolute_importN)�Mapping)�time)�FunctionType)�once)�
to_unicode)�	iteritems�get_code�	text_type�string_types���ravenc��|d|dkoG|d|dko5|d|dko#|d|dko|d|dkS)N�type�level�message�category�data�)�a�bs  �H/opt/cloudlinux/venv/lib64/python3.11/site-packages/raven/breadcrumbs.py�event_payload_considered_equalrso��	�&�	�Q�v�Y��	#�
�g�J�!�G�*�$�	#�
�i�L�A�i�L�(�	#�
�j�M�Q�z�]�*�	#�
�f�I��6��"��c�4�eZdZd	d�Z		d
d�Zd�Zd�Zd�ZdS)�BreadcrumbBuffer�d�c�0�g|_||_||_dS�N)�buffer�limit�message_max_length)�selfr#r$s   r�__init__zBreadcrumbBuffer.__init__(s�������
�"4����rNc	��|s|s|std���|�t��}|�|pdt|��||||d���|f}|j�|��|jd|j�=dS)Nz6You must pass either `message`, `data`, or `processor`�default)r�	timestamprrrr)�
ValueErrorr�format�floatr"�appendr#)	r%r)rrrrr�	processor�results	         r�recordzBreadcrumbBuffer.record-s����	/�4�	/�9�	/��.�/�/�
/������I��+�+��%�I��y�)�)��� ��	
�	
�	�	�
�	��	
����6�"�"�"��K��$�*���%�%�%rc��|jdd�=dSr!)r")r%s r�clearzBreadcrumbBuffer.clearCs���K����N�N�Nrc�D�|dr"t|d��d|j�nd|d<|dr"t|d��dt�nd|d<|dr4t|d��dt����nd|d<|S)Nrrr)rr$�CATEGORY_MAX_LENGTH�LEVEL_MAX_LENGTH�lower)r%r/s  rr+zBreadcrumbBuffer.formatFs���W]�^g�Wh�r�J�v�i�'8�9�9�:R�4�;R�:R�S�S�nr��y��U[�\f�Ug�q�Z��z�(:�;�;�<P�=P�<P�Q�Q�mq��z��TZ�[b�Tc�m�*�V�G�_�5�5�6G�7G�6G�H�N�N�P�P�P�im��w���
rc�X�g}t|j��D]�\}\}}|�B	||��|r|�|��nd}n#t$r�wxYw|df|j|<n|�|�|��}|�-|rt
|d|��s|�|����|S)Nz&Failed to process breadcrumbs. Ignored���)�	enumerater"r+�	Exception�logger�	exceptionrr-)r%�rv�idx�payloadr.s     r�
get_bufferzBreadcrumbBuffer.get_bufferLs���
��)2�4�;�)?�)?�	#�	#�%�C�%�'�9��$�H��I�g�&�&�&�7>�G�d�k�k�'�2�2�2�4�G�G��
!�#�#�#��#����%,�T�?���C� � ��$��+�+�g�.�.���"��#�<�R��V�W�M�M�#��	�	�'�"�"�"���	s�A�A)rr�NNNNNNN)�__name__�
__module__�__qualname__r&r0r2r+r@rrrrr&sq������5�5�5�5�
:>�>B�&�&�&�&�,����������rrc��eZdZd�ZdS)�BlackholeBreadcrumbBufferc��dSr!r)r%�args�kwargss   rr0z BlackholeBreadcrumbBuffer.recordds���rN)rBrCrDr0rrrrFrFcs#������
�
�
�
�
rrFTc�>�|rt��St��Sr!)rrF)�enableds r�make_bufferrLhs"���"��!�!�!�$�&�&�&rc�$�||d<t|i|��S)Nr)r0)rrHrIs   r�record_breadcrumbrNns���F�6�N��4�"�6�"�"�"rc
��|�t��}tj���D]"}|j�|||||||���#dS)z�Records a breadcrumb for all active clients.  This is what integration
    code should use rather than invoking the `captureBreadcrumb` method
    on a specific client.
    N)rr�context�get_active_contexts�breadcrumbsr0)rr)rrrrr.�ctxs        rr0r0tsh�����F�F�	��}�0�0�2�2�6�6������y�%��(�#�T�9�	6�	6�	6�	6�6�6rc��������tD]}|�������rdS�t��j��}|�|�������rdS�����fd�}t	|���dS)Nc����	}�}��di��}�}|�|���rSt���dkr@t�dt��r%�dr�d}|�|��	t�	��}|r�	|z}n#t$rYnwxYw��dd��|�|�jtj	����
��|d���dS)N�extra�r�exc_info)rrrr)�pop�update�len�
isinstancerrr:�name�logging�getLevelNamer6)
r�
formatted_msg�format_argsrV�
data_valuerHrIrr;�msgs
     �����rr.z)_record_log_breadcrumb.<locals>.processor�s0����
����
�
�7�B�'�'���
����%� � � ��	+�C��I�I��N�N�z�$�q�'�7�'C�'C�N��Q��N��q�'�K����k�*�*�*�	�%�c�N�N�M��
2� #�k� 1�
����	�	�	��D�	����	�
�
�:�t�$�$�$����$����)�%�0�0�6�6�8�8��	
�
�	�	�	�	�	s�	B � 
B-�,B-)r.)�special_logging_handlers�special_logger_handlers�getr]r0)r;rrcrHrI�handlerr.s`````  r�_record_log_breadcrumbrh�s��������+�����7�6�5�#�t�V�4�4�	��F�F�	�&�)�)�&�+�6�6�G���w�w�v�u�c�4��H�H���� � � � � � � � � �B�Y������rc��t|t��s|j}n|}t|dd��rdS|�d}d}nd}d|z}t	|��}t
j}|�3tj�	t
j
jj��}i}ttdd|jd	z
z|jd
�|��||d�z|d��t
j|��|d
|t&��}|j|_|jt	|��jksJ�|j|jk|j|jkd|_|S)N�__patched_for_raven__F)rrcz
level, msg)rcz%d, msga%(offset)sif 1:
    def factory(original, record_crumb):
        def %(name)s(self, %(args)s, *args, **kwargs):
            record_crumb(self, %(fwd)s, *args, **kwargs)
            return original(self, %(args)s, *args, **kwargs)
        return %(name)s
    
�
�z, )�offsetr]rH�fwdr�exec�factoryT)r\r�im_func�getattrr
r^�_srcfile�os�path�normpath�currentframe�__code__�co_filename�eval�compile�co_firstlinenorB�join�__dict__rh�__doc__rCrj)	�methr�funcrHrn�code�logging_srcfile�ns�new_funcs	         r�_wrap_logging_methodr��s|���d�L�)�)���|������t�,�e�4�4�����}���������%����D�>�>�D��&�O����'�*�*�� �)�5�
�
��(
�B���
��$�-��1�2��
��	�	�$�����
�
�
���
 �
 �")�!1�2�7�7�7��r�)�}�T�#9�:�:�H��|�H����(�4�.�.�"?�?�?�?�?�
��4�?�*�*�����&�&�%)�H�"��Orc	���tj}tjtjtjtjtjtjtjtjd�}t|��D]>\}}tt||��|��}ttj||���?ttjj
��tj_
dS)N)�debug�info�warning�warn�errorr<�critical�fatal)r^�Logger�DEBUG�INFO�WARNING�WARN�ERROR�CRITICAL�FATALr	r�rr�setattr�log)�cls�methods�method_namerr�s     r�
_patch_loggerr��s���
�.�C������?������]��$���	�	�G�(��0�0�7�7���U�'��C��%�%�u�.�.������X�6�6�6�6�-������G�N���rc�"�t��dS)zXInstalls the logging hook if it was not installed yet.  Otherwise
    does nothing.
    N)r�rrr�install_logging_hookr�s��
�O�O�O�O�Orc�2���fd�}t||��dS)z2Ignores a logger during breadcrumb recording.
    c�����|�krdSdS)NFTr)r;rrcrHrI�allow_levels     �rrgzignore_logger.<locals>.handlers����"��K����5��trN)�register_special_log_handler)�name_or_loggerr�rgs ` r�
ignore_loggerr�s4��������
!���9�9�9�9�9rc�X�t|t��r|}n|j}|t|<dS)a�Registers a callback for log handling. The callback is invoked
    with given arguments: `logger`, `level`, `msg`, `args` and `kwargs`
    which are the values passed to the logging system. If the callback
    returns true value the default handling is disabled. Only one callback
    can be registered per one logger name. Logger tree is not traversed
    so calling this method with `spammy_module` argument will not silence
    messages from `spammy_module.child`.
    N)r\rr]re)r��callbackr]s   rr�r�s6���.�,�/�/�#�����"��$,��D�!�!�!rc�:�t�|��dS)a;Registers a callback for log handling.  The callback is invoked
    with given arguments: `logger`, `level`, `msg`, `args` and `kwargs`
    which are the values passed to the logging system.  If the callback
    returns true value the default handling is disabled. Registering
    multiple handlers is allowed.
    N)rdr-)r�s r�register_logging_handlerr�.s���#�#�H�-�-�-�-�-rc����fd�}|S)Nc�:��t|��}|t�<|Sr!)r�hooked_libraries)�fr]s �r�	decoratorzlibraryhook.<locals>.decorator<s�����G�G��!"�����rr)r]r�s` r�libraryhookr�;s$���������r�requestsc���	ddlm}n#t$rYdSwxYw|j��fd�}||_t	dt
j���dS)Nr)�Sessionc�|����fd�}	�|�g|�Ri|��}||��n#t$r
|d���wxYw|S)Nc	�n��tdd�j�j|r|jpd|r|jpdd����dS)N�httpr�)�url�method�status_code�reason)rrr)r0r�r�r�r�)�response�requests �r�_record_requestz5_hook_requests.<locals>.send.<locals>._record_requestMs[�������{�!�.�'�@�H�,@�H�D�"�6�x��>�$�	;�;�
�
�
�
�
�
r)r:)r%r�rHrIr��resp�	real_sends `    �r�sendz_hook_requests.<locals>.sendLs�����	�	�	�	�	�	"��9�T�7�<�T�<�<�<�V�<�<�D�

�O�D�!�!�!�!��	�	�	�	��O�D�!�!�!��	����
�s�
"�9z(requests.packages.urllib3.connectionpool)r�)�requests.sessionsr��ImportErrorr�r�r^r�)r�r�r�s  @r�_hook_requestsr�Cs�����-�-�-�-�-�-�-���������������I������"�G�L��<�%�o�/�/�/�/�/�/s�
�
��httplibc����	ddlm}n#t$r	ddlm}YnwxYw|j�|j��fd�}�fd�}||_||_dS)Nr)�HTTPConnectionc��������	�ix|_�	|j�|j�|j������	�fd�}t	dd|����
|��g|�Ri|��S)Nc����}|�d��s�dkrdpd�d����krd�zpd����}|�d�|d	<|d	����|S)
N)zhttp://zhttps://i��httpsr�z://z:%s�)r�r�r)�
startswithrZ)r�real_url�default_port�hostr��port�statusr�s  ������rr.z7_install_httplib.<locals>.putrequest.<locals>.processorss�����H��&�&�'>�?�?�
� �C�'�3�G�=�v�=�=��D��L�(�9�U�T�\�?�R�?��C�	�� � ���D��L�
��L����'�'�'��Krr�r�)rrr.)�_raven_status_dictr�r�r�r0)r%r�r�rHrIr.r�r�r�r��real_putrequests ``   @@@@�r�
putrequestz$_install_httplib.<locals>.putrequestms����������+-�-���&��y���y���(��	�	�	�	�	�	�	�	�	�	�	�F�Z�9�E�E�E�E���t�V�S�B�4�B�B�B�6�B�B�Brc�v���|g|�Ri|��}t|dd��}|�d|vr|j|d<|j|d<|S)Nr�r�r�)rrr�r�)r%rHrIr=r��real_getresponses     �r�getresponsez%_install_httplib.<locals>.getresponse�sb���
�
�d�
4�T�
4�
4�
4�V�
4�
4����3�T�:�:����-�v�"=�"=�$&�I�F�=�!�!�y�F�8���	r)r�r�r��http.clientr�r�)r�r�r�r�r�s   @@r�_install_httplibr�cs�����/�*�*�*�*�*�*�*���/�/�/�.�.�.�.�.�.�.�.�/����%�/�O�%�1��C�C�C�C�C�0�����!+�N��!,�N���s���c��|�t���}|D]:}t�|��}|�td|z���|���;dS)NzUnknown library %r for hooking)r��keysrf�RuntimeError)�	libraries�libr�s   r�hook_librariesr��sk����$�)�)�+�+�	������#�#�C�(�(���<��?�#�E�F�F�F�������	�r)TrAr!)/�
__future__rrtr^�collections.abcrr��collectionsr�typesr�raven.utilsr�raven.utils.encodingr�raven.utils.compatr	r
rrr4r5rdre�	getLoggerr;r�objectrrFrLrNr0rhr�r�r�r�r�r�r�r�r�r�r��
raven.contextrrrr�<module>r�s���&�&�&�&�&�&�	�	�	�	�����$�'�'�'�'�'�'�'���$�$�$�#�#�#�#�#�#�#�#�$����������������������+�+�+�+�+�+�K�K�K�K�K�K�K�K�K�K�K�K���������	��	�7�	#�	#�����:�:�:�:�:�v�:�:�:�z
�
�
�
�
� 0�
�
�
�
'�'�'�'�#�#�#�?C�+/�
6�
6�
6�
6�* �* �* �ZC�C�C�C�L���.������:�:�:�:�
-�
-�
-� .�.�.������
��Z���/�/���/�>
��Y���*-�*-���*-�Z��������s��%�%