HEX
Server: Apache
System: Linux 185.122.168.184.host.secureserver.net 5.14.0-570.60.1.el9_6.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Nov 5 05:00:59 EST 2025 x86_64
User: barbeatleanalyti (1024)
PHP: 8.1.33
Disabled: NONE
Upload Files
File: //var/opt/nydus/ops/jsonschema/__pycache__/cli.cpython-39.pyc
a

�,�h� �@s�dZddlmZddlmZddlmZddlmZddl	Z	ddlZddl
Z
ddlZddlZddl
mZmZddlmZdd	lmZmZejd
edd�Gd
d�de�ZeGdd�d��ZeGdd�d��ZeGdd�d��Zdd�Ze	jdd�Zejdddddd�ejdd d!d"�ejd#d$d%d&gd%d'd(�ejd)d*ed+d,�ejd-d.d"�ejd/d0e� d1�d2�ejd3d4d"�d5d6�Z!d7d8�Z"e
j#d9d�fd:d;�Z$e
j%e
j&e
j'fd<d=�Z(dS)>z"
The ``jsonschema`` command line.
�)�metadata)�JSONDecodeError��resolve_name)�dedentN)�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�?/opt/nydus/tmp/pip-target-wkfpz8uv/lib/python/jsonschema/cli.pyrsrc@sReZdZe�Ze�Ze�Zedd��Zdd�Z	dd�Z
dd�Zd	d
�Zdd�Z
d
S)�
_OutputtercCs:|ddkrt|d�}n|ddkr,t�}||||d�S)N�output�plain�error_format�pretty)�	formatter�stdout�stderr)�_PlainFormatter�_PrettyFormatter)�cls�	argumentsrrrrrr�from_arguments*s
z_Outputter.from_argumentscCs�zt|�}Wn>tyJ}z&|j|t��d�t�|�WYd}~n
d}~00|�jzt�|�WWd�Sty�}z&|j	|t��d�t�|�WYd}~n
d}~00Wd�n1s�0YdS)N��path�exc_info)
�open�FileNotFoundError�filenotfound_error�sysr#r�json�loadr�
parsing_error)�selfr"�file�errorrrrr)2sz_Outputter.loadcKs|j�|jjfi|���dS�N)�_stderr�write�
_formatterr&�r+�kwargsrrrr&@sz_Outputter.filenotfound_errorcKs|j�|jjfi|���dSr.)r/r0r1r*r2rrrr*Csz_Outputter.parsing_errorcKs|j�|jjfi|���dSr.)r/r0r1�validation_errorr2rrrr4Fsz_Outputter.validation_errorcKs|j�|jjfi|���dSr.)�_stdoutr0r1�validation_successr2rrrr6Isz_Outputter.validation_successN)rrrrr1r5r/�classmethodr r)r&r*r4r6rrrrr#s
rc@s8eZdZed�ZdZdd�Zdd�Zdd�Zd	d
�Z	dS)rz`        ===[{type}]===({path})===

        {body}
        -----------------------------
        z===[SUCCESS]===({path})===
cCs|jj|d|�d�d�S)Nr%z does not exist.�r"�type�body)�
_ERROR_MSG�format�r+r"r#rrrr&Zs
�z#_PrettyFormatter.filenotfound_errorcCs2|\}}}d�t�|||��}|jj||j|d�S)N�r8)�join�	traceback�format_exceptionr;r<r)r+r"r#�exc_type�	exc_value�
exc_tracebackZ	exc_linesrrrr*as
��z_PrettyFormatter.parsing_errorcCs|jj||jj|d�S)Nr8)r;r<�	__class__r�r+�
instance_pathr-rrrr4ls
�z!_PrettyFormatter.validation_errorcCs|jj|d�S)N)r")�_SUCCESS_MSGr<�r+rGrrrr6ssz#_PrettyFormatter.validation_successN)
rrrrr;rHr&r*r4r6rrrrrMs�rc@s2eZdZe�Zdd�Zdd�Zdd�Zdd�Zd	S)
rcCs
|�d�S)Nz does not exist.
rr=rrrr&|sz"_PlainFormatter.filenotfound_errorcCs d�|dkrdnt|�|d�S)NzFailed to parse {}: {}
�<stdin>�)r<�reprr=rrrr*s�z_PlainFormatter.parsing_errorcCs|jj||d�S)N)�	file_namer-)�
_error_formatr<rFrrrr4�sz _PlainFormatter.validation_errorcCsdS)Nr>rrIrrrr6�sz"_PlainFormatter.validation_successN)	rrrrrNr&r*r4r6rrrrrws
rcCsd|vrd|}t|�S)N�.zjsonschema.r)�namerrr�_resolve_name_with_default�srQzJSON 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.
    )rWz-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�defaultrWz-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.
    )r9rWz
--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�versionZ
jsonschema)rUrZ�schemaz=the path to a JSON Schema to validate with (i.e. schema.json)cCsXttj|pdgd��}|ddkr4|dr4t�d��|ddkrT|ddurTd|d<|S)Nz--help��argsrrrz3--error-format can only be used with --output plainz"{error.instance}: {error.message}
)�vars�parser�
parse_argsr-)r]rrrrr`�s�r`cCs:d}|�|�D]}d}|j||d�q|s6|j|d�|S)NFT�rGr-)rG)Ziter_errorsr4r6)rG�instance�	validator�	outputter�invalidr-rrr�_validate_instance�srfrKcCst�tt|d�d��dS)Nr\)r)r'�exit�runr`r\rrr�main�sric
s@tj|||d��z��|d�}Wnty6YdS0|d}|durPt|�}z|�|�Wn8ty�}z �j|d|d�WYd}~dSd}~00|dr��j|d}}n��fdd�}d	g}|d
dur�t|d
|d�nd}	|||	d�}
d
}|D]@}z||�}
Wnt�y"d}Yn0|t	||
|
�d�O}�q�|S)N)rrrr[rKrcrarTc
sPzt���WStyJ}z&�jdt��d�t�|�WYd}~n
d}~00dS)NrJr!)r(r)rr*r'r#r)�_r-�rd�stdinrrr)s�zrun.<locals>.loadrJ�base_uri)rmZreferrer)�resolverr)rGrbrcrd)
rr r)rrZcheck_schemar	r4r
rf)rrrrlr[Z	Validatorr-r)rTrnrcZ	exit_codeZeachrbrrkrrh�sZ��
���
�rh))�__doc__�	importlibrr(r�pkgutilr�textwrapr�argparser'r@�warnings�attrsrrZjsonschema.exceptionsr	Zjsonschema.validatorsr
r�warn�DeprecationWarning�	ExceptionrrrrrQ�ArgumentParserr_�add_argumentrZr`rf�argvrirrrlrhrrrr�<module>s��))��
��
�	���