• File: encoding.cpython-37.opt-1.pyc
  • Full Path: /home3/farmfre2/public_html/ALFA_DATA/alfasymlink/root/opt/alt/python37/lib/python3.7/site-packages/raven/utils/__pycache__/encoding.cpython-37.opt-1.pyc
  • Date Modified: 06/27/2022 11:43 PM
  • File size: 2.59 KB
  • MIME-type: text/x-bytecode.python
  • Charset: 8 bit
B

Y@sfdZddlmZmZddlZddlmZmZmZm	Z	m
Z
ddZdd
dZdd
Z
ddZddZdS)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_importunicode_literalsN)
integer_types	text_typebinary_typestring_typesPY2c	Cs4ddl}ddl}t|ttdt||j|j|jfS)zDetermine 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)Decimaldatetime
isinstancertypefloatZdateZtime)objr	r
rE/opt/alt/python37/lib/python3.7/site-packages/raven/utils/encoding.pyis_protected_typesrutf-8Fstrictc
st|tr|Srt|r|Syft|tsvt|dr>|}qtsdt|trZt|}qtt|}qtt|}n|}WnTt	k
r}z6t|t
st	|jnd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).0arg)encodingerrorsstrings_onlyrr
<listcomp>Cszforce_text.<locals>.<listcomp>N)
rrrrhasattrrrbytesdecodeUnicodeDecodeError	Exceptionargsjoin)srrrer)rrrrrs(	






rcCs ddlm}tdt||S)Nr)	transformz5You should switch to raven.utils.serializer.transform)Zraven.utils.serializerr&warningswarnDeprecationWarning)valuer&rrrr&Hsr&cCsvytt|}Wn`ttfk
r,d}YnFtk
rpytttt|}Wntk
rjd}YnXYnX|S)Nz(Error decoding value))rrUnicodeEncodeErrorr r!reprr)r*rrr
to_unicodePsr-cCs8yt|ddStk
r2t|dSXdS)Nzutf-8)rrencoder!r-)r*rrr	to_string]sr/)rFr)__doc__Z
__future__rrr'Zraven.utils.compatrrrrrrrr&r-r/rrrr<module>s
,