AlkantarClanX12

Your IP : 18.217.98.175


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

B

��Y��@sfdZddlmZmZddlZddlmZmZmZm	Z	m
Z
dd�Zdd
d�Zdd
�Z
dd�Zdd�ZdS)z�
raven.utils.encoding
~~~~~~~~~~~~~~~~~~~~~~~~~~~~

:copyright: (c) 2010-2012 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
�)�absolute_import�unicode_literalsN)�
integer_types�	text_type�binary_type�string_types�PY2c	Cs4ddl}ddl}t|ttd�t||j|j|jf�S)z�Determine if the object instance is of a protected type.

    Objects of protected types are preserved as-is when passed to
    force_text(strings_only=True).
    rN)�Decimal�datetime�
isinstancer�type�float�date�time)�objr	r
�r�E/opt/alt/python37/lib/python3.7/site-packages/raven/utils/encoding.py�is_protected_typesr�utf-8F�strictc
s�t|t�r|S�rt|�r|Syft|t�svt|d�r>|��}q�tsdt|t�rZt|���}qtt|�}q�tt|����}n|����}WnTt	k
r�}z6t|t
�s�t	|j��nd����fdd�|D��}Wdd}~XYnX|S)z�
    Similar to smart_text, except that lazy instances are resolved to
    strings, rather than kept as lazy objects.

    If strings_only is True, don't convert (some) non-string-like objects.
    �__unicode__� csg|]}t|�����qSr)�
force_text)�.0�arg)�encoding�errors�strings_onlyrr�
<listcomp>Cszforce_text.<locals>.<listcomp>N)
rrrr�hasattrrr�bytes�decode�UnicodeDecodeError�	Exception�args�join)�srrr�er)rrrrrs(	






rcCs ddlm}t�dt�||�S)Nr)�	transformz5You should switch to raven.utils.serializer.transform)Zraven.utils.serializerr(�warnings�warn�DeprecationWarning)�valuer(rrrr(Hsr(cCsvytt|��}Wn`ttfk
r,d}YnFtk
rpytttt|����}Wntk
rjd}YnXYnX|S)Nz(Error decoding value))rr�UnicodeEncodeErrorr"r#�reprr)r,rrr�
to_unicodePsr/cCs8yt|�d��d��Stk
r2t|��d�SXdS)Nzutf-8)rr!�encoder#r/)r,rrr�	to_string]sr1)rFr)�__doc__�
__future__rrr)Zraven.utils.compatrrrrrrrr(r/r1rrrr�<module>s
,