
    ȇh                         S r SSKJr  SSKJr  SSKJr  SSKJr  SSK	r	SSKrSSK
r
SSKrSSKrSSKJrJr  SSKJr  SS	KJrJr  \R*                  " S
\SS9   " S S\5      r\ " S S5      5       r\ " S S5      5       r\ " S S5      5       rS r\	R:                  " SS9r\R?                  SSSSSS9  \R?                  SSS S!9  \R?                  S"S#S$S%/S$S&S'9  \R?                  S(S)\S*S+9  \R?                  S,S-S!9  \R?                  S.S/\R@                  " S05      S19  \R?                  S2S3S!9  S4 r!S5 r"\
RF                  S6S 4S7 jr$\
RJ                  \
RL                  \
RN                  4S8 jr(g)9z"
The ``jsonschema`` command line.
    )metadata)JSONDecodeErrorresolve_name)dedentN)definefield)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                       \ rS rSrSrg)_CannotLoadFile    N)__name__
__module____qualname____firstlineno____static_attributes__r       fC:\Users\julio\OneDrive\Documentos\Trabajo\IdeasFrscas\Cabanna\env\Lib\site-packages\jsonschema/cli.pyr   r      s    r   r   c                   l    \ rS rSr\" 5       r\" 5       r\" 5       r\S 5       r	S r
S rS rS rS rSrg	)

_Outputter#   c                 f    US   S:X  a  [        US   5      nOUS   S:X  a
  [        5       nU " WX#S9$ )Noutputplainerror_formatpretty)	formatterstdoutstderr)_PlainFormatter_PrettyFormatter)cls	argumentsr#   r$   r"   s        r   from_arguments_Outputter.from_arguments*   s@    X')'	.(ABIx H,(*IYvEEr   c                     [        U5      nU    [        R                  " U5      sS S S 5        $ ! [         a3  nU R                  U[        R                  " 5       S9  [        5       UeS nAff = f! [         a3  nU R                  U[        R                  " 5       S9  [        5       UeS nAff = f! , (       d  f       g = f)Npathexc_info)
openFileNotFoundErrorfilenotfound_errorsysr.   r   jsonloadr   parsing_error)selfr-   fileerrors       r   r4   _Outputter.load2   s    	/:D
 3yy T	 ! 	/###G!#.	/ # 3""s||~"F%'U23 Ts<   0 B0A0
A-.A((A-0
B-:.B((B--B00
B>c                 n    U R                   R                  U R                  R                  " S0 UD65        g Nr   )_stderrwrite
_formatterr1   r6   kwargss     r   r1   _Outputter.filenotfound_error@   &    4??==GGHr   c                 n    U R                   R                  U R                  R                  " S0 UD65        g r;   )r<   r=   r>   r5   r?   s     r   r5   _Outputter.parsing_errorC   s&    4??88B6BCr   c                 n    U R                   R                  U R                  R                  " S0 UD65        g r;   )r<   r=   r>   validation_errorr?   s     r   rF   _Outputter.validation_errorF   s&    4??;;EfEFr   c                 n    U R                   R                  U R                  R                  " S0 UD65        g r;   )_stdoutr=   r>   validation_successr?   s     r   rJ   _Outputter.validation_successI   rB   r   r   N)r   r   r   r   r	   r>   rI   r<   classmethodr)   r4   r1   r5   rF   rJ   r   r   r   r   r   r   #   sJ     JgGgGF F3IDGIr   r   c                   @    \ rS rSr\" S5      rSrS rS rS r	S r
Srg	)
r&   M   z`        ===[{type}]===({path})===

        {body}
        -----------------------------
        z===[SUCCESS]===({path})===
c                 @    U R                   R                  USU< S3S9$ )Nr0   z does not exist.r-   typebody)
_ERROR_MSGformatr6   r-   r.   s      r   r1   #_PrettyFormatter.filenotfound_errorZ   s/    %%$8+, & 
 	
r   c                     Uu  p4nSR                  [        R                  " X4U5      5      nU R                  R	                  UUR
                  US9$ )N rP   )join	tracebackformat_exceptionrS   rT   r   )r6   r-   r.   exc_type	exc_valueexc_traceback	exc_liness          r   r5   _PrettyFormatter.parsing_errora   sW    -5*]GG&&xMJ
	 %%"" & 
 	
r   c                 `    U R                   R                  UUR                  R                  US9$ )NrP   )rS   rT   	__class__r   r6   instance_pathr8   s      r   rF   !_PrettyFormatter.validation_errorl   s1    %%)) & 
 	
r   c                 4    U R                   R                  US9$ )N)r-   )_SUCCESS_MSGrT   r6   rd   s     r   rJ   #_PrettyFormatter.validation_successs   s      '']';;r   r   N)r   r   r   r   r   rS   rg   r1   r5   rF   rJ   r   r   r   r   r&   r&   M   s.     	J 2L
	

<r   r&   c                   :    \ rS rSr\" 5       rS rS rS rS r	Sr
g)r%   w   c                     U< S3$ )Nz does not exist.
r   rU   s      r   r1   "_PlainFormatter.filenotfound_error|   s    +,,r   c                 N    SR                  US:X  a  SO
[        U5      US   5      $ )NzFailed to parse {}: {}
<stdin>   )rT   reprrU   s      r   r5   _PlainFormatter.parsing_error   s,    )00*IT
QK
 	
r   c                 4    U R                   R                  XS9$ )N)	file_namer8   )_error_formatrT   rc   s      r   rF    _PlainFormatter.validation_error   s    !!((=(NNr   c                     g)NrX   r   rh   s     r   rJ   "_PlainFormatter.validation_success   s    r   r   N)r   r   r   r   r	   ru   r1   r5   rF   rJ   r   r   r   r   r%   r%   w   s      GM-
Or   r%   c                 .    SU ;  a  SU -   n [        U 5      $ )N.zjsonschema.r   )names    r   _resolve_name_with_defaultr|      s    
$t#r   zJSON 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.
    )r   z-oz--outputr   r!   z
        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defaultr   z-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.
    )rQ   r   z
--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)r   r   schemaz=the path to a JSON Schema to validate with (i.e. schema.json)c                     [        [        R                  U =(       d    S/S95      nUS   S:w  a  US   (       a  [        R                  S5      eUS   S:X  a  US   c  SUS'   U$ )Nz--helpargsr   r   r    z3--error-format can only be used with --output plainz"{error.instance}: {error.message}
)varsparser
parse_argsr8   )r   r(   s     r   r   r      sr    V&&D,>XJ&?@Ig%)N*CllA
 	
 g%)N*C*K$I	.!r   c                     SnUR                  U5       H  nSnUR                  XS9  M     U(       d  UR                  U S9  U$ )NFTrd   r8   )rd   )iter_errorsrF   rJ   )rd   instance	validator	outputterinvalidr8   s         r   _validate_instancer      sM    G&&x0"""L 1 $$=$ANr   rp   c                 L    [         R                  " [        [        U S9S95        g )Nr   )r(   )r2   exitrunr   r   s    r   mainr      s    HHS:4012r   c           	        ^^ [         R                  U UUS9m TR                  U S   5      nU S   nUc  [	        U5      n UR                  U5        U S   (       a  TR                  U S   pO
UU4S jnS/nU S	   b  [        U S	   US
9OS n	U" XIS9n
SnU H  n U" U5      nU[        UUU
TS9-  nM     U$ ! [         a     gf = f! [         a  nTR                  U S   US9   S nAgS nAff = f! [         a    Sn Mj  f = f)N)r(   r#   r$   r   rp   r   r   r   c                    >  [         R                  " T5      $ ! [         a3  nTR                  S[        R
                  " 5       S9  [        5       UeS nAff = f)Nro   r,   )r3   r4   r   r5   r2   r.   r   )_r8   r   stdins     r   r4   run.<locals>.load  sR    3yy''" 3''"S\\^ (  &'U2	3s    
A.AAro   base_uri)r   referrer)resolverr   )rd   r   r   r   )
r   r)   r4   r   r   check_schemar
   rF   r   r   )r(   r#   r$   r   r   	Validatorr8   r4   r   r   r   	exit_codeeachr   r   s      `          @r   r   r      sk   )) * I	( 34 +&I!&)	v& #..)K*@i	3 K	
 
:		* :& 15 
 &4II
	DzH +"!##	 I  c    ""#H- 	# 	
 <  	I	s;   B7 C C17
CC
C.C))C.1D D))__doc__	importlibr   r3   r   pkgutilr   textwrapr   argparser2   rZ   warningsattrsr   r	   jsonschema.exceptionsr
   jsonschema.validatorsr   r   warnDeprecationWarning	Exceptionr   r   r&   r%   r|   ArgumentParserr   add_argumentr   r   r   argvr   r#   r$   r   r   r   r   r   <module>r      s           
    - = 	: 	i 	 &I &I &IR &< &< &<R   ( 
	 	 ,
   ,	
	  	   

  
   *h
	  	   -	#
     
     \*  
   	H   hhqrl 3 **SZZsyy :r   