HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux spn-python 5.15.0-89-generic #99-Ubuntu SMP Mon Oct 30 20:42:41 UTC 2023 x86_64
User: arjun (1000)
PHP: 8.1.2-1ubuntu2.20
Disabled: NONE
Upload Files
File: //home/arjun/projects/env/lib/python3.10/site-packages/jsonschema/__pycache__/cli.cpython-310.pyc
o

+we� �@s�dZddlmZddlmZddlmZddlZddlZddlZddl	Z	ddl
Z
zddlmZWne
y?ddlmZYnwddlmZmZddlmZdd	lmZmZe
jd
edd�Gd
d�de�ZeGdd�d��ZeGdd�d��ZeGdd�d��Zdd�Zejdd�Z e j!dddddd�e j!dd d!d"�e j!d#d$d%d&gd%d'd(�e j!d)d*ed+d,�e j!d-d.d"�e j!d/d0e�"d1�d2�e j!d3d4d"�d5d6�Z#d7d8�Z$ej%d9d�fd:d;�Z&ej'ej(ej)fd<d=�Z*dS)>z"
The ``jsonschema`` command line.
�)�metadata)�JSONDecodeError)�dedentN��resolve_name)�define�field)�SchemaError)�_RefResolver�
validator_forz�The jsonschema CLI is deprecated and will be removed in a future version. Please use check-jsonschema instead, which can be installed from https://pypi.org/project/check-jsonschema/�)�
stacklevelc@seZdZdS)�_CannotLoadFileN)�__name__�
__module__�__qualname__�rr�G/home/arjun/projects/env/lib/python3.10/site-packages/jsonschema/cli.pyr#src@sReZdZe�Ze�Ze�Zedd��Zdd�Z	dd�Z
dd�Zd	d
�Zdd�Z
d
S)�
_OutputtercCs:|ddkr
t|d�}n	|ddkrt�}||||d�S)N�output�plain�error_format�pretty)�	formatter�stdout�stderr)�_PlainFormatter�_PrettyFormatter)�cls�	argumentsrrrrrr�from_arguments.s
z_Outputter.from_argumentsc	Cs�zt|�}Wnty|j|t��d�t��w|�"z
t�|�WWd�Sty=|j	|t��d�t��w1sAwYdS)N��path�exc_info)
�open�FileNotFoundError�filenotfound_error�sysr#r�json�loadr�
parsing_error)�selfr"�filerrrr)6s�
���z_Outputter.loadcK�|j�|jjdi|���dS�Nr)�_stderr�write�
_formatterr&�r+�kwargsrrrr&D�z_Outputter.filenotfound_errorcKr-r.)r/r0r1r*r2rrrr*Gr4z_Outputter.parsing_errorcKr-r.)r/r0r1�validation_errorr2rrrr5Jr4z_Outputter.validation_errorcKr-r.)�_stdoutr0r1�validation_successr2rrrr7Mr4z_Outputter.validation_successN)rrrrr1r6r/�classmethodr r)r&r*r5r7rrrrr's
rc@s8eZdZed�ZdZdd�Zdd�Zdd�Zd	d
�Z	dS)rz`        ===[{type}]===({path})===

        {body}
        -----------------------------
        z===[SUCCESS]===({path})===
cCs|jj|dd�|�d�S)Nr%z{!r} does not exist.�r"�type�body)�
_ERROR_MSG�format�r+r"r#rrrr&^s
�z#_PrettyFormatter.filenotfound_errorcCs2|\}}}d�t�|||��}|jj||j|d�S)N�r9)�join�	traceback�format_exceptionr<r=r)r+r"r#�exc_type�	exc_value�
exc_traceback�	exc_linesrrrr*es
��z_PrettyFormatter.parsing_errorcCs|jj||jj|d�S)Nr9)r<r=�	__class__r�r+�
instance_path�errorrrrr5ps
�z!_PrettyFormatter.validation_errorcCs|jj|d�S)N)r")�_SUCCESS_MSGr=�r+rIrrrr7wsz#_PrettyFormatter.validation_successN)
rrrrr<rKr&r*r5r7rrrrrQs�rc@s2eZdZe�Zdd�Zdd�Zdd�Zdd�Zd	S)
rcCs
d�|�S)Nz{!r} does not exist.
)r=r>rrrr&�s
z"_PlainFormatter.filenotfound_errorcCs d�|dkrdnt|�|d�S)NzFailed to parse {}: {}
�<stdin>�)r=�reprr>rrrr*�s�z_PlainFormatter.parsing_errorcCs|jj||d�S)N)�	file_namerJ)�
_error_formatr=rHrrrr5�sz _PlainFormatter.validation_errorcCsdS)Nr?rrLrrrr7�sz"_PlainFormatter.validation_successN)	rrrrrQr&r*r5r7rrrrr{srcCsd|vrd|}t|�S)N�.zjsonschema.r)�namerrr�_resolve_name_with_default�srTzJSON Schema Validation CLI)�descriptionz-iz
--instance�append�	instancesz�
        a path to a JSON instance (i.e. filename.json) to validate (may
        be specified multiple times). If no instances are provided via this
        option, one will be expected on standard input.
    )�action�dest�helpz-Fz--error-formata�
        the format to use for each validation error message, specified
        in a form suitable for str.format. This string will be passed
        one formatted object named 'error' for each ValidationError.
        Only provide this option when using --output=plain, which is the
        default. If this argument is unprovided and --output=plain is
        used, a simple default representation will be used.
    )rZz-oz--outputrrz�
        an output format to use. 'plain' (default) will produce minimal
        text with one line for each error, while 'pretty' will produce
        more detailed human-readable output on multiple lines.
    )�choices�defaultrZz-Vz--validatorz�
        the fully qualified object name of a validator to use, or, for
        validators that are registered with jsonschema, simply the name
        of the class.
    )r:rZz
--base-uriz�
        a base URI to assign to the provided schema, even if it does not
        declare one (via e.g. $id). This option can be used if you wish to
        resolve relative references to a particular URI (or local path)
    z	--version�version�
jsonschema)rXr]�schemaz=the path to a JSON Schema to validate with (i.e. schema.json)cCsXttj|pdgd��}|ddkr|drt�d��|ddkr*|ddur*d|d<|S)Nz--help��argsrrrz3--error-format can only be used with --output plainz"{error.instance}: {error.message}
)�vars�parser�
parse_argsrJ)rarrrrrd�s�rdcCs:d}|�|�D]}d}|j||d�q|s|j|d�|S)NFT�rIrJ)rI)�iter_errorsr5r7)rI�instance�	validator�	outputter�invalidrJrrr�_validate_instance�srkrNcCst�tt|d�d��dS)Nr`)r)r'�exit�runrdr`rrr�main�srnc
s<tj|||d��z	��|d�}Wn
tyYdSw|d}|dur(t|�}z|�|�WntyK}z�j|d|d�WYd}~dSd}~ww|drY�j|d}}n
��fdd�}d	g}|d
durqt|d
|d�nd}	|||	d�}
d
}|D]}z||�}
Wnty�d}Yq}w|t	||
|
�d�O}q}|S)N)rrrr_rNrhrerWcs4zt���WSty�jdt��d�t��w)NrMr!)r(r)rr*r'r#r)�_�ri�stdinrrr)
s��zrun.<locals>.loadrM�base_uri)rr�referrer)�resolverr)rIrgrhri)
rr r)rr�check_schemar	r5r
rk)rrrrqr_�	ValidatorrJr)rWrtrh�	exit_code�eachrgrrprrm�sb���������
�rm)+�__doc__�	importlibrr(r�textwrapr�argparser'rA�warnings�pkgutilr�ImportError�pkgutil_resolve_name�attrsrr�jsonschema.exceptionsr	�jsonschema.validatorsr
r�warn�DeprecationWarning�	ExceptionrrrrrT�ArgumentParserrc�add_argumentr]rdrk�argvrnrrrqrmrrrr�<module>s���))��
��
�	���