Hacked By AnonymousFox

Current Path : /opt/alt/python37/lib/python3.7/site-packages/raven/utils/serializer/__pycache__/
Upload File :
Current File : //opt/alt/python37/lib/python3.7/site-packages/raven/utils/serializer/__pycache__/base.cpython-37.pyc

B

��Y��@s�dZddlmZddlZddlZddlmZmZmZm	Z	m
Z
mZmZddl
mZddlmZdZd	d
�ZGdd�de�ZGd
d�de�ZGdd�de�ZGdd�de�ZGdd�de�ZGdd�de�ZGdd�de�ZGdd�de�ZGdd�de�ZGdd�de�Ze�rGdd �d e�Ze�e�e�e�e�e�e�e�e�e�e�e�e�e�e�e�e�e�e�r�e�e�dS)!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)�
SerializercCs(yt|�d��Stk
r"dSXdS)N�
__sentry__F)�callable�__getattribute__�	Exception)�value�r�L/opt/alt/python37/lib/python3.7/site-packages/raven/utils/serializer/base.py�has_sentry_metadatasrc@s2eZdZdZdd�Zdd�Zdd�Zd
d
d�ZdS)r
rcCs
||_dS)N)r)�selfrrrr�__init__ szSerializer.__init__cCst||j�S)z|
        Given ``value``, return a boolean describing whether this
        serializer can operate on the given type
        )�
isinstance�types)rrrrr�can#szSerializer.cancKs|S)z@
        Given ``value``, coerce into a JSON-safe type.
        r)rr�kwargsrrr�	serialize*szSerializer.serialize�rc
Ks�|�dd�}|d7}||kr~ytt|��d|�}WnHtk
r|}z*ddl}|��|jj�|�tt	|��Sd}~XYnX|jj
|f||d�|��S)z|
        Given ``value``, recurse (using the parent serializer) to handle
        coercing of newly defined values.
        �string_max_lengthNrr)�	max_depth�_depth)�getr�reprr�	traceback�	print_excr�logger�	exception�typeZ	transform)rrrr rr�er#rrr�recurse0szSerializer.recurseN)rr)�__name__�
__module__�__qualname__rrrrr)rrrrr
s
r
c@s eZdZeeeefZdd�ZdS)�IterableSerializercs>��d�ptd��t��fdd�t��fdd�t|��D��S)N�list_max_length�infc3s |]\}}�j|f��VqdS)N)r))�.0�n�o)rrrr�	<genexpr>Jsz/IterableSerializer.serialize.<locals>.<genexpr>cs|d�kS)Nrr)�x)r.rr�<lambda>L�z.IterableSerializer.serialize.<locals>.<lambda>)r!�float�tuple�	itertools�	takewhile�	enumerate)rrrr)rr.rrrGs
zIterableSerializer.serializeN)	r*r+r,r8�list�set�	frozensetrrrrrrr-Dsr-c@s"eZdZefZdd�Zdd�ZdS)�DictSerializercCst|t�st|�S|S)N)rrr
)r�keyrrr�make_keyTs
zDictSerializer.make_keycsB��d�ptd��t��fdd�t��fdd�tt|���D��S)Nr.r/c3s8|]0\}\}}���j|f����j|f��fVqdS)N)rAr))r0r1�k�v)rrrrr3\sz+DictSerializer.serialize.<locals>.<genexpr>cs|d�kS)Nrr)r4)r.rrr5^r6z*DictSerializer.serialize.<locals>.<lambda>)r!r7�dictr9r:r;r)rrrr)rr.rrrYs
zDictSerializer.serializeN)r*r+r,rDrrArrrrrr?Qsr?c@seZdZefZdd�ZdS)�UnicodeSerializercKs&|�dd�}ttd��|d|�fS)Nrz%s)r!r"r)rrrrrrrrfszUnicodeSerializer.serializeN)r*r+r,rrrrrrrrEcsrEc@seZdZefZdd�ZdS)�StringSerializercKsf|�dd�}tr t|d|��Sy d|�d�d|��d�dStk
rTYnXt|d|��S)Nr�'�utf8)r!r	r"�decode�encode�UnicodeDecodeError)rrrrrrrrrs zStringSerializer.serializeN)r*r+r,rrrrrrrrFosrFcs(eZdZeZ�fdd�Zdd�Z�ZS)�TypeSerializercstt|��|�ot|�S)N)�superrLrr)rr)�	__class__rrr�szTypeSerializer.cancKs|j|��f|�S)N)r)r)rrrrrrr�szTypeSerializer.serialize)r*r+r,rrrr�
__classcell__rr)rNrrL�srLc@seZdZefZdd�ZdS)�BooleanSerializercKst|�S)N)�bool)rrrrrrr�szBooleanSerializer.serializeN)r*r+r,rQrrrrrrrP�srPc@seZdZefZdd�ZdS)�FloatSerializercKst|�S)N)r7)rrrrrrr�szFloatSerializer.serializeN)r*r+r,r7rrrrrrrR�srRc@seZdZefZdd�ZdS)�IntegerSerializercKst|�S)N)�int)rrrrrrr�szIntegerSerializer.serializeN)r*r+r,rTrrrrrrrS�srSc@seZdZejfZdd�ZdS)�FunctionSerializercKsd|j|jt|�fS)Nz<function %s from %s at 0x%x>)r*r+�id)rrrrrrr�szFunctionSerializer.serializeN)r*r+r,r�FunctionTyperrrrrrU�srUc@seZdZefZdd�ZdS)�LongSerializercKst|�S)N)�long)rrrrrrr�szLongSerializer.serializeN)r*r+r,rYrrrrrrrX�srX) �__doc__�
__future__rr9rZraven.utils.compatrrrrrrr	Zraven.utils.encodingr
rZserialization_manager�__all__r�objectr
r-r?rErFrLrPrRrSrUrX�registerrrrr�<module>s>$'











Hacked By AnonymousFox1.0, Coded By AnonymousFox