관리-도구
편집 파일: exceptions.cpython-37.pyc
B �pSe�( � @ s d Z ddlmZmZ ddlZddlZddlZddlZddlm Z ddl mZmZ e ddg�Ze � Ze �� ZG dd � d e�ZG d d� de�ZG dd � d e�Zejdd�G dd� de��ZG dd� de�ZG dd� de�ZG dd� de�ZG dd� de�Zeefdd�Ze� Zefdd�ZdS )z2 Validation errors, and some surrounding helpers. � )�defaultdict�dequeN)�_utils)�PY3� iteritemsZanyOf�oneOfc s� e Zd Zedddeeeddf � fdd� Zdd� Zdd� ZerBeZnd d � Ze dd� �Z ed d� �Zedd� �Z dd� Zdd� Z� ZS )�_Error� Nc s� t t| ��||||||||| | � || _t|� | _| _t| � | _| _t |�| _ | | _| _|| _ || _|| _|| _| | _x|D ] }| |_q�W d S )N)�superr �__init__�messager �path� relative_path�schema_path�relative_schema_path�list�context�cause� __cause__� validator�validator_value�instance�schema�parent)�selfr r r r r r r r r r �error)� __class__r �F/opt/alt/python37/lib/python3.7/site-packages/jsonschema/exceptions.pyr s. z_Error.__init__c C s d| j j| jf S )Nz<%s: %r>)r �__name__r )r r r r �__repr__= s z_Error.__repr__c C s� | j | j| j| jf}tdd� |D ��r,| jS tj| jdd�}tj| jdd�}| jt� d� � �| j | jt� t| j�d d� �t�|�| jt� | j�t�|�f S )Nc s s | ]}|t kV qd S )N)�_unset)�.0�mr r r � <genexpr>D s z%_Error.__unicode__.<locals>.<genexpr>�H )�widthzl Failed validating %r in %s%s: %s On %s%s: %s ���)r r r r �anyr �pprint�pformat�textwrap�dedent�rstrip�!_word_for_schema_in_error_messager Zformat_as_indexr r �indent�#_word_for_instance_in_error_messager )r Zessential_for_verbose�pschema� pinstancer r r �__unicode__@ s z_Error.__unicode__c C s t | ��d�S )Nzutf-8)�unicode�encode)r r r r �__str__^ s z_Error.__str__c C s | f |� � �S )N)� _contents)�cls�otherr r r �create_froma s z_Error.create_fromc C s2 | j }|d kr| jS t| j�}|�t|j�� |S )N)r r r � extendleft�reversed� absolute_path)r r r r r r r<