VULN_CHECK_I913V6 % g 4dZddlmZddlmZddlmZddlZddlZddlZddl Z ddl Z ddl m Z ddlmZmZddlmZdd lmZmZe j.d ed Gd deZeGddZeGddZeGddZdZej>dZ e jCddddde jCddd !e jCd"d#d$d%gd$d&'e jCd(d)ed*+e jCd,d-!e jCd.d/ejDd01e jCd2d3!d4Z#d5Z$ejJd6dfd7Z&ejNejPejRfd8Z*y#e $r ddlm Z YfwxYw)9z" The ``jsonschema`` command line. )metadata)JSONDecodeError)dedentN resolve_name)definefield) SchemaError) _RefResolver validator_forzThe 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 eZdZy)_CannotLoadFileN)__name__ __module__ __qualname__3/usr/lib/python3.12/site-packages/jsonschema/cli.pyrr#srrcdeZdZeZeZeZedZdZ dZ dZ dZ dZ y) _Outputtercj|ddk(rt|d}n|ddk(r t}|||S)Noutputplain error_formatpretty) formatterstdoutstderr)_PlainFormatter_PrettyFormatter)cls argumentsrr rs rfrom_argumentsz_Outputter.from_arguments.sB X ' )' .(ABI x H ,(*IYvfEErcf t|}|5 t j|cdddS#t$r0|j|tjt wxYw#t$r0|j|tjt wxYw#1swYyxYw)Npathexc_info) openFileNotFoundErrorfilenotfound_errorsysr)rjsonloadr parsing_error)selfr(files rr/z_Outputter.load6s $:D  (yy ( ( ! $  # #  # G!# # $# (""s||~"F%'' (Ts% /B'A+9A(+9B$$B''B0c n|jj|jjdi|yNr)_stderrwrite _formatterr,r1kwargss rr,z_Outputter.filenotfound_errorD) =4??==GGHrc n|jj|jjdi|yr4)r5r6r7r0r8s rr0z_Outputter.parsing_errorGs) 84??88B6BCrc n|jj|jjdi|yr4)r5r6r7validation_errorr8s rr=z_Outputter.validation_errorJs) ;4??;;EfEFrc n|jj|jjdi|yr4)_stdoutr6r7validation_successr8s rr@z_Outputter.validation_successMr:rN)rrrr r7r?r5 classmethodr%r/r,r0r=r@rrrrr'sJJgGgGFF (IDGIrrc8eZdZedZdZdZdZdZdZ y)r"z` ===[{type}]===({path})=== {body} ----------------------------- z===[SUCCESS]===({path})=== c\|jj|ddj|S)Nr+z{!r} does not exist.r(typebody) _ERROR_MSGformatr1r(r)s rr,z#_PrettyFormatter.filenotfound_error^s2%%$'..t4&  rc|\}}}djtj|||}|jj ||j |S)NrD)join tracebackformat_exceptionrGrHr)r1r(r)exc_type exc_value exc_traceback exc_liness rr0z_PrettyFormatter.parsing_errores[-5*)]GG  & &xM J %%""&  rcf|jj||jj|S)NrD)rGrH __class__rr1 instance_patherrors rr=z!_PrettyFormatter.validation_errorps1%%))&  rc:|jj|S)N)r() _SUCCESS_MSGrHr1rVs rr@z#_PrettyFormatter.validation_successws  '']';;rN) rrrrrGrYr,r0r=r@rrrr"r"Qs. J2L    )rHreprrIs rr0z_PlainFormatter.parsing_errors,)00*IT QK  rc<|jj||S)N) file_namerW) _error_formatrHrUs rr=z _PlainFormatter.validation_errors!!((=(NNrcy)NrKrrZs rr@z"_PlainFormatter.validation_successsrN) rrrr rcr,r0r=r@rrrr!r!{s GM5 Orr!c*d|vrd|z}t|S)N.z jsonschema.r)names r_resolve_name_with_defaultrhs $t#  rzJSON Schema Validation CLI) descriptionz-iz --instanceappend 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. )actiondesthelpz-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. )rnz-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. )choicesdefaultrnz-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. )rErnz --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 --versionversion jsonschema)rlrqschemaz=the path to a JSON Schema to validate with (i.e. schema.json)cttj|xsdg}|ddk7r|drtjd|ddk(r |dd|d<|S)Nz--helpargsrrrz3--error-format can only be used with --output plainz"{error.instance}: {error.message} )varsparser parse_argsrW)rvr$s rryrysrV&&D,>XJ&?@Ig%)N*Cll A  g%)N*C*K$I .! rcd}|j|D]}d}|j|||s|j||S)NFTrVrW)rV) iter_errorsr=r@)rVinstance validator outputterinvalidrWs r_validate_instancersOG&&x0""e"L1 $$=$A Nrr_cVtjtt|y)Nru)r$)r-exitrunryrus rmainrsHHS:40 12rctj||| j|d}|d}| t |} |j ||drj|d}}n fd}dg}|d t|d | nd} ||| } d } |D]} || } | t| | |  z} | S#t$rYywxYw#t $r }j|d|Yd}~yd}~wwxYw#t$rd} YjwxYw)N)r$rr rsr_r~r{rkc tjS#t$r0jdt j t wxYw)Nr^r')r.r/rr0r-r)r)_rstdins rr/zrun..load sO (yy''" (''"S\\^(&''  (s 9Ar^base_uri)rreferrer)resolverr)rVr}r~r) rr%r/rr check_schemar r=r r)r$rr rrs ValidatorrWr/rkrr~ exit_codeeachr}rs ` @rrrso))*I  ( 34+&I!&) v&#..)K*@i (K :  *:&15 &84II DzH +"!##  I  c  ""#H- #  < I s;B;C C6; CC C3C..C36 DD)+__doc__ importlibrr.rtextwraprargparser-rMwarningspkgutilr ImportErrorpkgutil_resolve_nameattrsrr jsonschema.exceptionsr jsonschema.validatorsr r warnDeprecationWarning Exceptionrrr"r!rhArgumentParserrx add_argumentrqryrargvrrr rrrrrrs  2$ -=   : i &I&I&IR&<&<&