관리-도구
편집 파일: manager.cpython-37.pyc
B ��Y{ � @ sz d Z ddlmZ ddlZddlmZ ddlmZ dZe� d�Z G dd � d e�ZG d d� de�Z e� ZejZefdd �ZdS )z� raven.utils.serializer.manager ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ :copyright: (c) 2010-2012 by the Sentry Team, see AUTHORS for more details. :license: BSD, see LICENSE for more details. � )�absolute_importN)�closing)� text_type)�register� transformzsentry.errors.serializerc @ s, e Zd ZeZdd� Zedd� �Zdd� ZdS )�SerializationManagerc C s g | _ i | _d S )N)�_SerializationManager__registryZ"_SerializationManager__serializers)�self� r �O/opt/alt/python37/lib/python3.7/site-packages/raven/utils/serializer/manager.py�__init__ s zSerializationManager.__init__c c s x| j D ] }|V qW d S )N)r )r � serializerr r r �serializers s z SerializationManager.serializersc C s || j kr| j �|� |S )N)r �append)r r r r r r s zSerializationManager.registerN)�__name__� __module__�__qualname__�loggerr �propertyr r r r r r r s r c @ s( e Zd ZeZdd� Zdd� Zdd� ZdS )� Serializerc C s8 || _ t� | _g | _x|jD ]}| j�|| �� qW d S )N)�manager�set�contextr r )r r r r r r r ) s zSerializer.__init__c C s | ` | `d S )N)r r )r r r r �close0 s zSerializer.closec K s� |dkrdS t |�}|| jkr"dS | j�|� z�x\| jD ]R}|�|�r8y|j|f|�S tk r� } zt�|� t t |��S d}~X Y q8X q8W yt|�S tk r� } zt�|� t t |��S d}~X Y nX W d| j�|� X dS )zn Primary function which handles recursively transforming values via their serializers Nz<...>) �idr �addr Zcan� serialize� Exceptionr � exceptionr �type�repr�remove)r �value�kwargs�objidr �er r r r 4 s( zSerializer.transformN)r r r r r r r r r r r r &