
    ȇh;                    R   % S r SSKJr  SSKJrJr  SSKJr  SSKJ	r	J
r
  SSKJrJrJr  SSKrSSKrSSKrSSKJr  SS	KJr  SS
KJr  \(       a  SSKJrJrJrJr  SSKJr  \" SS/5      r S\!S'   \" 5       r"S\!S'   \RF                  " S5      r$\RJ                  " 5       r&S+S jr'S r( " S S\)5      r* " S S\*5      r+ " S S\*5      r,\" SS9 " S S\)5      5       r- " S S \-\5      r. " S! S"\)5      r/ " S# S$\)5      r0 " S% S&\)5      r1 " S' S(5      r2\ \"4S) jr3\3" 5       r4 \44S* jr5g),z2
Validation errors, and some surrounding helpers.
    )annotations)defaultdictdeque)pformat)dedentindent)TYPE_CHECKINGAnyClassVarN)define)Unresolvable)_utils)IterableMappingMutableMappingSequence)_typesanyOfoneOfzfrozenset[str]WEAK_MATCHESSTRONG_MATCHESz^[a-zA-Z][a-zA-Z0-9_]*$c                H    [        [        U SSS9U5      R                  5       $ )zH
Format something for an error message as prettily as we currently can.
H   F)width
sort_dicts)r   r   lstrip)thingprefixs     mC:\Users\julio\OneDrive\Documentos\Trabajo\IdeasFrscas\Cabanna\env\Lib\site-packages\jsonschema/exceptions.py_prettyr        s#     '%re<fELLNN    c                    U S:X  a.  [         R                  " [        R                  [        SS9  [        $ [        S[         SU  35      e)NRefResolutionError   
stacklevelzmodule z has no attribute )warningswarn_RefResolutionError_DEPRECATION_MESSAGEDeprecationWarningAttributeError__name__)names    r   __getattr__r/   '   sG    ##44	

 #"
78*,>tfE
FFr!   c            
        ^  \ rS rSr% S\S'   S\S'   \SSS\\\SS\4
                     SU 4S jjjrSS jrSS	 jr\	SS
 j5       r
\SS j5       r\SS j5       r\SS j5       r S     SS jjrS rSS jrSrU =r$ )_Error2   zClassVar[str]!_word_for_schema_in_error_message#_word_for_instance_in_error_message Nc                @  > [         TU ]  UUUUUUUUU	U
5
        Xl        [        U5      =U l        U l        [        U	5      =U l        U l        [        U5      U l	        U=U l
        U l        X l        X`l        Xpl        Xl        Xl        Xl        U H	  nXl        M     g N)super__init__messager   pathrelative_pathschema_pathrelative_schema_pathlistcontextcause	__cause__	validatorvalidator_valueinstanceschemaparent_type_checker)selfr:   rC   r;   rA   r@   rD   rE   rF   r=   rG   type_checkererror	__class__s                r   r9   _Error.__init__7   s     		
 ).t4	D&7<[7II44G}&++
T^". )EL r!   c                R    SU R                   R                   SU R                  < S3$ )N<: >)rL   r-   r:   rI   s    r   __repr___Error.__repr__`   s'    4>>**+2dll-=Q??r!   c                .   U R                   U R                  U R                  U R                  4n[	        S U 5       5      (       a  U R
                  $ [        R                  " U R                  [        U R                  5      S S S9n[        R                  " U R                  U R                  S9nSn[        SU R
                   SU R                   < SU S[        U R                  US	9 S
U S[        U R                  US	9 S3R                  5       5      $ )Nc              3  0   #    U  H  o[         L v   M     g 7fr7   )_unset).0ms     r   	<genexpr>!_Error.__str__.<locals>.<genexpr>g   s     :$9qF{$9s   )	containerindices                z            z 

            Failed validating z in z:
                r   z

            On 
            )rC   rD   rE   rF   anyr:   r   format_as_indexr3   r?   r>   r4   r<   r   r    rstrip)rI   essential_for_verboser=   instance_pathr   s        r   __str___Error.__str__c   s   NND00$--!
 :$9:::<<,,<<223CR8
 ..>>&&
 \\N #~~0[M BV45 6 v67 8 

 
	
r!   c                .    U " S0 UR                  5       D6$ )Nr5   	_contents)clsothers     r   create_from_Error.create_from   s    'U__&''r!   c                    U R                   nUc  U R                  $ [        U R                  5      nUR                  [	        UR
                  5      5        U$ r7   )rG   r<   r   
extendleftreversedabsolute_pathrI   rG   r;   s      r   rs   _Error.absolute_path   sH    >%%%T''(!5!567r!   c                    U R                   nUc  U R                  $ [        U R                  5      nUR                  [	        UR
                  5      5        U$ r7   )rG   r>   r   rq   rr   absolute_schema_pathrt   s      r   rw   _Error.absolute_schema_path   sH    >,,,T../!<!<=>r!   c                (   SnU R                    H  n[        U[        5      (       a  US[        U5      -   S-   -  nM.  [        R                  U5      (       a
  USU-   -  nMR  UR                  SS5      R                  SS5      nUS	U-   S
-   -  nM     U$ )N$[].\z\\'z\'z['z'])rs   
isinstanceintstr&_JSON_PATH_COMPATIBLE_PROPERTY_PATTERNmatchreplace)rI   r;   elemescaped_elems       r   	json_path_Error.json_path   s    &&D$$$c$i#--7==dCCd
"#||D&9AA#uM|+d22 ' r!   c                    Ub  U R                   [        L a  Xl         UR                  5        H%  u  p4[        X5      [        L d  M  [	        XU5        M'     g r7   )rH   rW   itemsgetattrsetattr)rI   rJ   kwargskvs        r   _set_Error._set   sF    
 #(:(:f(D!-LLNDAt6)# #r!   c                H    SnU Vs0 s H  o"[        X5      _M     sn$ s  snf )N)
r:   rA   r@   rC   rD   r;   r=   rE   rF   rG   )r   )rI   attrsattrs      r   rk   _Error._contents   s+    
 7<<edgd))e<<<s   c                   ^   T R                   S   n[        U[        5      (       a&  T R
                  R                  T R                  U5      $ [        U 4S jU 5       5      $ ! [        [        4 a     gf = f)NtypeFc              3  p   >#    U  H+  nTR                   R                  TR                  U5      v   M-     g 7fr7   )rH   is_typerE   )rX   expected_typerI   s     r   rZ   '_Error._matches_type.<locals>.<genexpr>   s2      
!) &&t}}mDD!)s   36)	rF   KeyError	TypeErrorr   r   rH   r   rE   rb   )rI   expecteds   ` r   _matches_type_Error._matches_type   su    	{{6*H h$$%%--dmmXFF 
!)
 
 	
 )$ 		s   A" "A54A5)rB   rH   rA   r@   rE   r:   rG   r;   r<   r>   rF   r=   rC   rD   )r:   r   rC   r   r;   Iterable[str | int]rA   zException | NonerD   r
   rE   r
   rF   zMapping[str, Any] | boolr=   r   rG   z_Error | NonerJ   z_types.TypeCheckerreturnNoner   r   )rm   r1   )r   zSequence[str | int]r7   )rJ   z_types.TypeChecker | Noner   r
   r   r   )r   bool)r-   
__module____qualname____firstlineno____annotations__rW   r9   rS   rg   classmethodrn   propertyrs   rw   r   r   rk   r   __static_attributes____classcell__rL   s   @r   r1   r1   2   s6   '44)66
  $&"&%+1+- $+1' '  '  "	' 
  '  '  '  )'  )'  '  )'  
'  ' R@
: ( (     
 
 37
$/
$ 
$ 
	
$=
 
r!   r1   c                       \ rS rSrSrSrSrSrg)ValidationError   z2
An instance was invalid under a provided schema.
rF   rE   r5   Nr-   r   r   r   __doc__r3   r4   r   r5   r!   r   r   r      s     )1%*4'r!   r   c                       \ rS rSrSrSrSrSrg)SchemaError   z:
A schema was invalid under its corresponding metaschema.

metaschemarF   r5   Nr   r5   r!   r   r   r      s     )5%*2'r!   r   F)slotsc                  8    \ rS rSr% SrSrS\S'   S rS
S jrSr	g	)r)      z
A ref could not be resolved.
zjsonschema.exceptions.RefResolutionError is deprecated as of version 4.18.0. If you wish to catch potential reference resolution errors, directly catch referencing.exceptions.Unresolvable.	Exception_causec                r    U R                   UR                   La  [        $ U R                  UR                  :H  $ r7   )rL   NotImplementedr   rI   rm   s     r   __eq___RefResolutionError.__eq__   s+    >>0!!{{ell**r!   c                ,    [        U R                  5      $ r7   )r   r   rR   s    r   rg   _RefResolutionError.__str__   s    4;;r!   r5   Nr   )
r-   r   r   r   r   r*   r   r   rg   r   r5   r!   r   r)   r)      s#    
	>  +
 r!   r)   c                  <    \ rS rSrS
S jrS rS rS rS rS r	Sr
g	)_WrappedReferencingError   c                2    [         R                  U SU5        g )N_wrapped)object__setattr__)rI   rA   s     r   r9   !_WrappedReferencingError.__init__   s    4U3r!   c                    UR                   U R                   L a  U R                  UR                  :H  $ UR                   U R                  R                   L a  U R                  U:H  $ [        $ r7   )rL   r   r   r   s     r   r   _WrappedReferencingError.__eq__   sP    ??dnn,==ENN22__ 7 77==E))r!   c                .    [        U R                  U5      $ r7   )r   r   )rI   r   s     r   r/   $_WrappedReferencingError.__getattr__   s    t}}d++r!   c                ,    [        U R                  5      $ r7   )hashr   rR   s    r   __hash__!_WrappedReferencingError.__hash__   s    DMM""r!   c                $    SU R                   < S3$ )Nz<WrappedReferencingError rQ   )r   rR   s    r   rS   !_WrappedReferencingError.__repr__  s    *4==*;1==r!   c                `    U R                   R                  R                   SU R                    3$ )NrP   )r   rL   r-   rR   s    r   rg    _WrappedReferencingError.__str__  s(    --))2232dmm_EEr!   r5   N)rA   _Unresolvable)r-   r   r   r   r9   r   r/   r   rS   rg   r   r5   r!   r   r   r      s!    4,#>Fr!   r   c                  ,    \ rS rSrSrSS jrSS jrSrg)	UndefinedTypeChecki	  zF
A type checker was asked to check a type it did not have registered.
c                    Xl         g r7   r   )rI   r   s     r   r9   UndefinedTypeCheck.__init__  s    	r!   c                $    SU R                   < S3$ )NzType z  is unknown to this type checkerr   rR   s    r   rg   UndefinedTypeCheck.__str__  s    tyym#CDDr!   r   N)r   r   r   r   r   r-   r   r   r   r   r9   rg   r   r5   r!   r   r   r   	  s    Er!   r   c                  $    \ rS rSrSrS rS rSrg)UnknownTypei  zH
A validator was asked to validate an instance against an unknown type.
c                (    Xl         X l        X0l        g r7   )r   rE   rF   )rI   r   rE   rF   s       r   r9   UnknownType.__init__  s    	 r!   c                    Sn[        SU R                  < S[        U R                  US9 S[        U R                  US9 S3R                  5       5      $ )Nr_   z            Unknown type z, for validator with schema:
                r`   z7

            While checking instance:
                ra   )r   r   r    rF   rE   rd   )rI   r   s     r   rg   UnknownType.__str__  sc    )) 'V45 6 v67 8 
 	
r!   )rE   rF   r   Nr   r5   r!   r   r   r     s    

r!   r   c                  6   ^  \ rS rSrSrSU 4S jjrS rSrU =r$ )FormatErrori-  z
Validating a format failed.
c                L   > [         TU ]  X5        Xl        U=U l        U l        g r7   )r8   r9   r:   rA   rB   )rI   r:   rA   rL   s      r   r9   FormatError.__init__2  s#    (&++
T^r!   c                    U R                   $ r7   )r:   rR   s    r   rg   FormatError.__str__7  s    ||r!   )rB   rA   r:   r7   )	r-   r   r   r   r   r9   rg   r   r   r   s   @r   r   r   -  s    ,
 r!   r   c                  f    \ rS rSrSr\rSSS jjrSS jrS r	SS jr
S rS rS	 r\S
 5       rSrg)	ErrorTreei;  z>
ErrorTrees make it easier to check which validations failed.
c                    0 U l         [        U R                  5      U l        U HE  nU nUR                   H  nX4   nM	     X#R                   UR
                  '   UR                  Ul        MG     g r7   )errorsr   rL   rk   r;   rC   rE   	_instance)rI   r   rK   r]   elements        r   r9   ErrorTree.__init__B  s\    <>2=dnn2MEI ::%.	 &05U__-"'..I r!   c                    XR                   ;   $ )z3
Check whether ``instance[index]`` has any errors.
rj   rI   indexs     r   __contains__ErrorTree.__contains__N  s     &&r!   c                n    U R                   [        La  X;  a  U R                   U     U R                  U   $ )a!  
Retrieve the child tree one level down at the given ``index``.

If the index is not in the instance that this tree corresponds
to and is not known by this tree, whatever error would be raised
by ``instance.__getitem__`` will be propagated (usually this is
some subclass of `LookupError`.
)r   rW   rk   r   s     r   __getitem__ErrorTree.__getitem__T  s0     >>'E,=NN5!~~e$$r!   c                T    [         R                  " S[        SS9  X R                  U'   g)z
Add an error to the tree at the given ``index``.

.. deprecated:: v4.20.0

    Setting items on an `ErrorTree` is deprecated without replacement.
    To populate a tree, provide all of its sub-errors when you
    construct the tree.
z8ErrorTree.__setitem__ is deprecated without replacement.r$   r%   N)r'   r(   r+   rk   )rI   r   values      r   __setitem__ErrorTree.__setitem__a  s'     	F	

 !&ur!   c                ,    [        U R                  5      $ )zI
Iterate (non-recursively) over the indices in the instance with errors.
)iterrk   rR   s    r   __iter__ErrorTree.__iter__r  s     DNN##r!   c                    U R                   $ )z
Return the `total_errors`.
)total_errorsrR   s    r   __len__ErrorTree.__len__x  s        r!   c                l    [        U 5      nUS:X  a  SOSnSU R                  R                   SU SU S3$ )N   rK   r   rO   z (z total z)>)lenrL   r-   )rI   totalr   s      r   rS   ErrorTree.__repr__~  s>    D	!QJH4>>**+2eWGF82FFr!   c                    [        S U R                  R                  5        5       5      n[        U R                  5      U-   $ )zD
The total number of errors in the entire tree, including children.
c              3  <   #    U  H  u  p[        U5      v   M     g 7fr7   )r  )rX   _trees      r   rZ   )ErrorTree.total_errors.<locals>.<genexpr>  s     K4J3t994Js   )sumrk   r   r  r   )rI   child_errorss     r   r  ErrorTree.total_errors  s5    
 KDNN4H4H4JKK4;;,..r!   )rk   r   N)r5   )r   zIterable[ValidationError])r   	str | int)r   r  r   r   )r-   r   r   r   r   rW   r   r9   r   r   r   r  r  rS   r   r  r   r5   r!   r   r   r   ;  sF     I
1'%&"$!G
 / /r!   r   c                   ^ ^ UU 4S jnU$ )aG  
Create a key function that can be used to sort errors by relevance.

Arguments:
    weak (set):
        a collection of validation keywords to consider to be
        "weak".  If there are two errors at the same level of the
        instance and one is in the set of weak validation keywords,
        the other error will take priority. By default, :kw:`anyOf`
        and :kw:`oneOf` are considered weak keywords and will be
        superseded by other same-level validation errors.

    strong (set):
        a collection of validation keywords to consider to be
        "strong"

c                   > U R                   n[        U R                  5      * U R                  UT;  UT;   U R                  5       (       + 4$ r7   )rC   r  r;   r   )rK   rC   strongweaks     r   	relevanceby_relevance.<locals>.relevance  sJ    OO	_JJT!##%%
 	
r!   r5   )r  r  r  s   `` r   by_relevancer    s    &
 r!   c                   [        XSS9nUc  gUR                  (       aa  [        R                  " SUR                  US9n[	        U5      S:X  a  U" US   5      U" US   5      :X  a  U$ US   nUR                  (       a  Ma  U$ )aq  
Try to find an error that appears to be the best match among given errors.

In general, errors that are higher up in the instance (i.e. for which
`ValidationError.path` is shorter) are considered better matches,
since they indicate "more" is wrong with the instance.

If the resulting match is either :kw:`oneOf` or :kw:`anyOf`, the
*opposite* assumption is made -- i.e. the deepest error is picked,
since these keywords only need to match once, and any other errors
may not be relevant.

Arguments:
    errors (collections.abc.Iterable):

        the errors to select from. Do not provide a mixture of
        errors from different validation attempts (i.e. from
        different instances or schemas), since it won't produce
        sensical output.

    key (collections.abc.Callable):

        the key to use when sorting errors. See `relevance` and
        transitively `by_relevance` for more details (the default is
        to sort with the defaults of that function). Changing the
        default is only useful if you want to change the function
        that rates errors but still want the error context descent
        done by this function.

Returns:
    the best matching error, or ``None`` if the iterable was empty

.. note::

    This function is a heuristic. Its return value may change for a given
    set of inputs from version to version if better heuristics are added.

N)keydefaultr$   )r  r   r
  )maxr@   heapq	nsmallestr  )r   r  bestsmallests       r   
best_matchr&    s}    N v-D|
,, ??1dll<x=A#hqk"2c(1+6F"FK{ ,,, Kr!   )r   r
   r   r   )6r   
__future__r   collectionsr   r   pprintr   textwrapr   r   typingr	   r
   r   r"  rer'   r   r   referencing.exceptionsr   r   
jsonschemar   collections.abcr   r   r   r   r   	frozensetr   r   r   compiler   UnsetrW   r    r/   r   r1   r   r   r)   r   r   r   r   r   r  r  r&  r5   r!   r   <module>r3     s3   # *  # / /  	   @ KK!('7);<n <!* ,)+4M)N &	OGS
Y S
l5f 53& 3 e )    ,F2M F0	E 	E
) 
0) N/ N/b #> @ N	 % 2r!   