Hacked By AnonymousFox

Current Path : /opt/cloudlinux/venv/lib64/python3.11/site-packages/raven/utils/serializer/__pycache__/
Upload File :
Current File : //opt/cloudlinux/venv/lib64/python3.11/site-packages/raven/utils/serializer/__pycache__/base.cpython-311.pyc

�

�܋f���<�dZddlmZddlZddlZddlZddlmZmZm	Z	m
Z
mZmZm
Z
ddlmZddlmZddlmZd	Zd
�ZGd�de��ZGd
�de��ZGd�de��ZGd�de��ZGd�de��ZGd�de��ZGd�de��ZGd�de��ZGd�de��ZGd�de��Z Gd�d e��Z!erGd!�d"e��Z"ej#e��ej#e��ej#e��ej#e��ej#e��ej#e��ej#e��ej#e��ej#e ��ej#e!��erej#e"��dSdS)#z�
raven.utils.serializer.base
~~~~~~~~~~~~~~~~~~~~~~~~~~~

:copyright: (c) 2010-2012 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
�)�absolute_importN)�	text_type�binary_type�string_types�	iteritems�class_types�PY2�PY3)�
to_unicode���manager��
is_namedtuple)�
Serializerc�j�	t|�d����S#t$rYdSwxYw)N�
__sentry__F)�callable�__getattribute__�	Exception)�values �R/opt/cloudlinux/venv/lib64/python3.11/site-packages/raven/utils/serializer/base.py�has_sentry_metadatarsE�����.�.�|�<�<�=�=�=�������u�u����s�!$�
2�2c�,�eZdZdZd�Zd�Zd�Zd	d�ZdS)
r�c��||_dS�Nr
)�selfrs  r�__init__zSerializer.__init__#s
�������c�,�t||j��S�z|
        Given ``value``, return a boolean describing whether this
        serializer can operate on the given type
        )�
isinstance�types�rrs  r�canzSerializer.can&s��
�%���,�,�,r c��|S)z@
        Given ``value``, coerce into a JSON-safe type.
        r�rr�kwargss   r�	serializezSerializer.serialize-s	���r �rc��|�dd��}|dz
}||kr�	tt|����d|�}nj#t$r]}ddl}|���|jj�|��tt|����cYd}~Sd}~wwxYw|jj
|f||d�|��S)z|
        Given ``value``, recurse (using the parent serializer) to handle
        coercing of newly defined values.
        �string_max_lengthNrr)�	max_depth�_depth)�getr�reprr�	traceback�	print_excr�logger�	exception�type�	transform)rrr.r/r)r-�er2s        r�recursezSerializer.recurse3s��
#�J�J�':�D�A�A���!����Y���
.�!�$�u�+�+�.�.�/A�0A�/A�B�����
.�
.�
.� � � � ��#�#�%�%�%���#�-�-�a�0�0�0� ��e���-�-�-�-�-�-�-�-�����	
.����
&�t�|�%�e�?�y�-3�?�?�7=�?�?�	?s�$A�
B/�AB*�$B/�*B/N)r+r)�__name__�
__module__�__qualname__r$rr&r*r9rr rrr sZ�������E����-�-�-����?�?�?�?�?�?r rc�*�eZdZejfZd�Zd�ZdS)�NamedtupleSerializerc� �t|��Sr"rr%s  rr&zNamedtupleSerializer.canJs��
�U�#�#�#r c	�(������d��ptd����fd�}|������}tj}t
��fd�||t|����D����}|S)N�list_max_length�infc���|d�kS�Nrr��xrAs �r�<lambda>z0NamedtupleSerializer.serialize.<locals>.<lambda>Ss���a��d�_�4�r c�<��g|]\}\}}|�j|fi���f��Sr�r9��.0�n�k�vr)rs    ��r�
<listcomp>z2NamedtupleSerializer.serialize.<locals>.<listcomp>VsJ���
�
�
���6�A�q�����Q�)�)�&�)�)�*�
�
�
r )r0�float�_asdict�items�	itertools�	takewhile�dict�	enumerate)rrr)�	less_thanrRrTrFrAs` `    @rr*zNamedtupleSerializer.serializeQs������ �*�*�%6�7�7�G�5��<�<��4�4�4�4�	��
�
���%�%�'�'���'�	��
�
�
�
�
�&�Y�y�)�E�2B�2B�C�C�
�
�
�
�
���r N)r:r;r<�collections�
namedtupler$r&r*rr rr>r>Gs=������
�
#�%�E�$�$�$�	�	�	�	�	r r>c� �eZdZeeeefZd�ZdS)�IterableSerializerc	��������d��ptd���t��fd�tj�fd�t|����D����S)NrArBc3�:�K�|]\}}�j|fi���V��dSrrI)rKrL�or)rs   ��r�	<genexpr>z/IterableSerializer.serialize.<locals>.<genexpr>bsO�����
�
���1�
�D�L��%�%�f�%�%�
�
�
�
�
�
r c���|d�kSrDrrEs �rrGz.IterableSerializer.serialize.<locals>.<lambda>e����Q�q�T�O�-C�r )r0rP�tuplerSrTrV�rrr)rAs` `@rr*zIterableSerializer.serialize`s������ �*�*�%6�7�7�G�5��<�<���
�
�
�
�
��"�#C�#C�#C�#C�#,�U�#3�#3�5�5�
�
�
�
�
�	
r N)	r:r;r<rb�list�set�	frozensetr$r*rr rr[r[]s1������
�D�#�y�)�E�
�
�
�
�
r r[c� �eZdZefZd�Zd�ZdS)�DictSerializerc�N�t|t��st|��S|Sr)r#rr)r�keys  r�make_keyzDictSerializer.make_keyms%���#�|�,�,�	#��c�?�?�"��
r c��������d��ptd���t��fd�tj�fd�tt
|������D����S)NrArBc3��K�|]9\}\}}���j|fi������j|fi���fV��:dSr)rkr9rJs    ��rr_z+DictSerializer.serialize.<locals>.<genexpr>tsx�����
�
���6�A�q��]�]�<�4�<��4�4�V�4�4�
5�
5�|�t�|�A�7P�7P��7P�7P�Q�
�
�
�
�
�
r c���|d�kSrDrrEs �rrGz*DictSerializer.serialize.<locals>.<lambda>wrar )r0rPrUrSrTrVrrcs` `@rr*zDictSerializer.serializers������ �*�*�%6�7�7�G�5��<�<���
�
�
�
�
��"�#C�#C�#C�#C�Y��%� � �F"�F"�#�#�
�
�
�
�
�	
r N)r:r;r<rUr$rkr*rr rrhrhjs9������
�G�E����

�
�
�
�
r rhc��eZdZefZd�ZdS)�UnicodeSerializerc�~�|�dd��}ttd����|d|�fzS)Nr-z%s)r0r1r�rrr)r-s    rr*zUnicodeSerializer.serializesA��
#�J�J�':�D�A�A���I�d�O�O�$�$��.@�/@�.@�(A�'C�C�Cr N)r:r;r<rr$r*rr rrprp|s/������
�L�E�D�D�D�D�Dr rpc��eZdZefZd�ZdS)�StringSerializerc�&�|�dd��}trt|d|���S	d|�d��d|��d��zdzS#t
$rYnwxYwt|d|���S)Nr-�'�utf8)r0r
r1�decode�encode�UnicodeDecodeErrorrrs    rr*zStringSerializer.serialize�s���"�J�J�':�D�A�A���	3���0�0�0�1�2�2�2�	�����f�-�-�.@�/@�.@�A������ �"%�&�
&��!�	�	�	��D�	�����E�,�,�,�-�.�.�.s�5A,�,
A9�8A9N)r:r;r<rr$r*rr rrtrt�s*������
�N�E�
/�
/�
/�
/�
/r rtc�(��eZdZeZ�fd�Zd�Z�xZS)�TypeSerializerc�t��tt|���|��ot|��Sr)�superr|r&r)rr�	__class__s  �rr&zTypeSerializer.can�s6������.�.�2�2�5�9�9�9�+�#�E�*�*�	+r c�B�|j|���fi|��Sr)r9rr(s   rr*zTypeSerializer.serialize�s(���t�|�E�,�,�.�.�9�9�&�9�9�9r )r:r;r<rr$r&r*�
__classcell__)rs@rr|r|�sL��������E�+�+�+�+�+�:�:�:�:�:�:�:r r|c��eZdZefZd�ZdS)�BooleanSerializerc�:�tt|����Sr)r1�boolr(s   rr*zBooleanSerializer.serialize�s���D��K�K� � � r N)r:r;r<r�r$r*rr rr�r��s*������
�G�E�!�!�!�!�!r r�c��eZdZefZd�ZdS)�FloatSerializerc�:�tt|����Sr)r1rPr(s   rr*zFloatSerializer.serialize�s���E�%�L�L�!�!�!r N)r:r;r<rPr$r*rr rr�r��s*������
�H�E�"�"�"�"�"r r�c��eZdZefZd�ZdS)�IntegerSerializerc�:�tt|����Sr)r1�intr(s   rr*zIntegerSerializer.serialize�s���C��J�J���r N)r:r;r<r�r$r*rr rr�r��s*������
�F�E� � � � � r r�c�$�eZdZejfZd�ZdS)�FunctionSerializerc�@�d|j|jt|��fzS)Nz<function %s from %s at 0x%x>)r:r;�idr(s   rr*zFunctionSerializer.serialize�s&��.��N�E�,�b��i�i�29�9�	9r N)r:r;r<r$�FunctionTyper*rr rr�r��s.������
�
�!�E�9�9�9�9�9r r�c��eZdZefZd�ZdS)�LongSerializerc�:�tt|����Sr)r1�longr(s   rr*zLongSerializer.serialize�s����U���$�$�$r N)r:r;r<r�r$r*rr rr�r��s*���������	%�	%�	%�	%�	%r r�)$�__doc__�
__future__rrXrSr$�raven.utils.compatrrrrrr	r
�raven.utils.encodingrr�serialization_manager�raven.utilsr�__all__r�objectrr>r[rhrprtr|r�r�r�r�r��registerrr r�<module>r�s�����'�&�&�&�&�&�������������������������������+�+�+�+�+�+�5�5�5�5�5�5�%�%�%�%�%�%������$?�$?�$?�$?�$?��$?�$?�$?�N�����:����,

�

�

�

�

��

�

�

�
�
�
�
�
�Z�
�
�
�$	D�	D�	D�	D�	D�
�	D�	D�	D�/�/�/�/�/�z�/�/�/�&:�:�:�:�:�Z�:�:�:�!�!�!�!�!�
�!�!�!�"�"�"�"�"�j�"�"�"� � � � � �
� � � �9�9�9�9�9��9�9�9��%�%�%�%�%�%��%�%�%����3�4�4�4����1�2�2�2����~�.�.�.����0�1�1�1����/�0�0�0����~�.�.�.����0�1�1�1�����/�/�/����0�1�1�1����1�2�2�2��3�"��"�>�2�2�2�2�2�3�3r 

Hacked By AnonymousFox1.0, Coded By AnonymousFox