AlkantarClanX12
Current Path : /opt/alt/python37/lib/python3.7/site-packages/raven/utils/__pycache__/ |
Current File : //opt/alt/python37/lib/python3.7/site-packages/raven/utils/__pycache__/encoding.cpython-37.pyc |
B ��Y� � @ sf d Z ddlmZmZ ddlZddlmZmZmZm Z m Z dd� Zdd d�Zdd � 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 C s4 ddl }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). r N)�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_type s r �utf-8F�strictc s� t | t�r| S �rt| �r| S yft | t�svt| d�r>| �� } q�tsdt | t�rZt| � ��} qtt| �} q�tt| �� ��} n| �� ��} W nT t k r� } z6t | t �s�t |j� �nd�� ��fdd�| D ��} W dd}~X Y nX | 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__� c s g | ]}t |� ����qS r )� force_text)�.0�arg)�encoding�errors�strings_onlyr r � <listcomp>C s zforce_text.<locals>.<listcomp>N) r r r r �hasattrr r �bytes�decode�UnicodeDecodeError� Exception�args�join)�sr r r �er )r r r r r s( r c C s ddl m} t�dt� || �S )Nr )� transformz5You should switch to raven.utils.serializer.transform)Zraven.utils.serializerr( �warnings�warn�DeprecationWarning)�valuer( r r r r( H s r( c C sv yt t| ��} W n` ttfk r, d} Y nF tk rp yt ttt| ����} W n tk rj d} Y nX Y nX | S )Nz(Error decoding value))r r �UnicodeEncodeErrorr"