관리-도구
편집 파일: base.cpython-37.pyc
B ��Y� � @ s� d Z ddlmZ ddlZddlZddlmZmZmZm Z m Z mZmZ ddl mZ ddlmZ dZd d � ZG dd� de�ZG d d� de�ZG dd� de�ZG dd� de�ZG dd� de�ZG dd� de�ZG dd� de�ZG dd� de�ZG dd� de�ZG dd� de�Ze�rG dd � 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)� Serializerc C s( yt | �d��S tk r" dS X d S )N� __sentry__F)�callable�__getattribute__� Exception)�value� r �L/opt/alt/python37/lib/python3.7/site-packages/raven/utils/serializer/base.py�has_sentry_metadata s r c @ s2 e Zd ZdZdd� Zdd� Zdd� Zd d d�ZdS )r r c C s || _ d S )N)r )�selfr r r r �__init__ s zSerializer.__init__c C s t || j�S )z| Given ``value``, return a boolean describing whether this serializer can operate on the given type )� isinstance�types)r r r r r �can# s zSerializer.canc K s |S )z@ Given ``value``, coerce into a JSON-safe type. r )r r �kwargsr r r � serialize* s zSerializer.serialize� r c K s� |� dd�}|d7 }||kr~ytt|��d|� }W nH tk r| } z*ddl}|�� | jj�|� tt |��S d}~X Y nX | 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�typeZ transform)r r r r r r �er# r r r �recurse0 s zSerializer.recurseN)r r )�__name__� __module__�__qualname__r r r r r) r r r r r s r c @ s e Zd ZeeeefZdd� ZdS )�IterableSerializerc s>