
    fiH                       U d Z ddlmZ ddlmZmZmZ ddlmZ ddl	m
Z
mZmZmZmZ ddlmZ ddlmZmZmZmZ ddlmZm
ZmZ eeef         Zeez  Zee         Z ee         Z! e            Z"d	e#d
<   e G d de$                      Z%dVdZ&dVdZ'dWdZ(dXdZ)dYdZ*dYdZ+dZdZ, e-             e-             e-            fd[d#Z. e-             e-             e-            fd[d$Z/ e-             e-             e-            fd[d%Z0 e-             e-             e-            fd[d&Z1 e-             e-             e-            fd[d'Z2 e-             e-             e-            fd[d(Z3 e-             e-             e-            fd[d)Z4 ed*e& e.h d+h d,h d-.          e) e2h d+h d,h d-.          /          Z5 ed0e& e/h d1h d2h d-.          e* e3h d1h d2h d-.          /          Z6 ed3e' e0h d4h d2h d5.          e+ e4h d4h d2h d5.          /          Z7 ed6e' e0h d7h d2h d5.          e+ e4h d7h d2h d5.          /          Z8 ed8e( e1d9hh d2h d5.          e, e4h d:h d2h d5.          /          Z9 ed;e( e1d<hh d5=          e, e4d>d?hd<hh d5.          /          Z: ed@ dAe5fdBe6fdCe7fdDe8fdEe9fdFe:ffD                       Z;dGe#dH<   efd\dNZ<e G dO dP                      Z=d]dTZ>dUS )^zI
Referencing implementations for JSON Schema specs (historic & current).
    )annotations)IterableSequenceSet)Any)AnchorRegistryResourceSpecification
exceptions)frozen)_UNSETResolvedResolver_Unset)URIr   MappingSchemaRegistryEMPTY_REGISTRYc                      e Zd ZU dZded<   dS )UnknownDialectz
    A dialect identifier was found for a dialect unknown by this library.

    If it's a custom ("unofficial") dialect, be sure you've registered it.
    r   uriN)__name__
__module____qualname____doc____annotations__     f/var/www/html/Pagina-Ingenieria-Requisitos/venv/lib/python3.11/site-packages/referencing/jsonschema.pyr   r   $   s%           HHHHHr   r   contentsSchemareturn
URI | Nonec                Z    t          | t                    rd S |                     d          S )N$id)
isinstanceboolget)r!   s    r    
_dollar_idr*   /   s+    (D!! <<r   c                    t          | t                    sd| v rd S |                     d          }||                    d          s|S d S d S )N$refr&   #)r'   r(   r)   
startswithr!   ids     r    _legacy_dollar_idr1   5   sY    (D!! Vx%7%7	e		B	~bmmC00~	 ~~~r   ObjectSchemac                r    d| v rd S |                      d          }||                    d          s|S d S d S )Nr,   r0   r-   )r)   r.   r/   s     r    
_legacy_idr4   =   sH    	d		B	~bmmC00~	 ~~~r   specificationSpecification[Schema]Iterable[AnchorType[Schema]]c              #  0  K   t          |t                    rd S |                    d          }|&t          ||                     |                    V  |                    d          }|(t          ||                     |                    V  d S d S )N$anchornameresourcez$dynamicAnchor)r'   r(   r)   r   create_resourceDynamicAnchor)r5   r!   anchordynamic_anchors       r    _anchorrA   E   s       (D!! \\)$$F"228<<
 
 
 	
 	
 	

 \\"233N!"228<<
 
 
 	
 	
 	
 	
 	
 "!r   Iterable[Anchor[Schema]]c                    t          |t                    rg S |                    d          }|g S t          ||                     |                    gS )Nr9   r:   )r'   r(   r)   r   r=   )r5   r!   r?   s      r    _anchor_2019rD   Z   sf     (D!! 	\\)$$F~	"228<<	
 	
 	
 r   c                    t          |t                    rg S |                    dd          }|                    d          sg S t	          |dd          |                     |                    gS )Nr&    r-      r:   )r'   r(   r)   r.   r   r=   r5   r!   r0   s      r    _legacy_anchor_in_dollar_idrI   k   s     (D!! 		eR	 	 B== 	ABB"228<<	
 	
 	
 r   Specification[ObjectSchema]Iterable[Anchor[ObjectSchema]]c                    |                     dd          }|                    d          sg S t          |dd          |                     |                    gS )Nr0   rF   r-   rG   r:   )r)   r.   r   r=   rH   s      r    _legacy_anchor_in_idrM   |   sh     
dB		B== 	ABB"228<<	
 	
 	
 r   in_valueSet[str]in_subvaluesin_subarrayc                     d fd}|S )z
    Create a callable returning JSON Schema specification-style subschemas.

    Relies on specifying the set of keywords containing subschemas in their
    values, in a subobject's values, or in a subarray.
    r!   r"   r#   Iterable[ObjectSchema]c              3     K   t          | t                    rd S D ]}|| v r
| |         V  D ]}|| v r| |         E d {V  D ]&}|| v r | |                                         E d {V  'd S N)r'   r(   values)r!   eachrQ   rP   rN   s     r    subresources_ofz)_subresources_of.<locals>.subresources_of   s      h%% 	F 	% 	%Dxtn$$$ 	* 	*Dx#D>)))))))  	3 	3Dx#D>00222222222	3 	3r   r!   r"   r#   rS   r   rN   rP   rQ   rX   s   ``` r    _subresources_ofr[      s5    3 3 3 3 3 3 3 3 r   c                     d fd}|S )O
    Specifically handle older drafts where there are some funky keywords.
    r!   r"   r#   rS   c              3  X  K   t          | t                    rd S D ]}|| v r
| |         V  D ]}|| v r| |         E d {V  D ]&}|| v r | |                                         E d {V  '|                     d          }|%t          |t                    r
|E d {V  d S |V  d S d S Nitems)r'   r(   rV   r)   r   )r!   rW   r`   rQ   rP   rN   s      r    rX   z:_subresources_of_with_crazy_items.<locals>.subresources_of   s     h%% 	F 	% 	%Dxtn$$$ 	* 	*Dx#D>)))))))  	3 	3Dx#D>00222222222W%%%**           	 r   rY   r   rZ   s   ``` r    !_subresources_of_with_crazy_itemsra      s5           ( r   c                     d fd}|S )r]   r!   r"   r#   rS   c              3  ,  K   t          | t                    rd S D ]}|| v r
| |         V  D ]}|| v r| |         E d {V  D ]&}|| v r | |                                         E d {V  '|                     d          }|"t          |t                    r	|E d {V  n|V  |                     d          }|Tt          |                                          }t          |d           }t          |t                    r|V  |E d {V  d S d S d S )Nr`   dependencies)r'   r(   rV   r)   r   iternextr   	r!   rW   r`   rd   rV   valuerQ   rP   rN   s	         r    rX   zG_subresources_of_with_crazy_items_dependencies.<locals>.subresources_of   s     h%% 	F 	% 	%Dxtn$$$ 	* 	*Dx#D>)))))))  	3 	3Dx#D>00222222222W%%%**          ||N33#,--//00F&&E%)) "!!!!!!!!!! $#" "r   rY   r   rZ   s   ``` r    ._subresources_of_with_crazy_items_dependenciesri      s5    " " " " " " " "6 r   c                     d fd}|S )zT
    Specifically handle even older drafts where there are some funky keywords.
    r!   r2   r#   rS   c              3  \  K   D ]}|| v r
| |         V  D ]}|| v r| |         E d {V  D ]&}|| v r | |                                          E d {V  '|                     d          }|"t          |t                    r	|E d {V  n|V  |                     d          }|Rt	          |                                           }t          |d           }t          |t                    r|V  |E d {V  dD ]0}|                     |          }t          |t                    r|V  1d S )Nr`   rd   )additionalItemsadditionalProperties)rV   r)   r'   r   re   rf   r   rg   s	         r    rX   zJ_subresources_of_with_crazy_aP_items_dependencies.<locals>.subresources_of   s      	% 	%Dxtn$$$ 	* 	*Dx#D>)))))))  	3 	3Dx#D>00222222222W%%%**          ||N33#,--//00F&&E%)) "!!!!!!!!= 	 	DLL&&E%)) 	 	r   )r!   r2   r#   rS   r   rZ   s   ``` r    1_subresources_of_with_crazy_aP_items_dependenciesrn      s5           < r   c                "     ||z  d	 fd}|S )
NsegmentsSequence[int | str]resolver_Resolver[Any]subresourceResource[Any]r#   c                    t          |           }|D ]}|vr|vst          |d           |c S |                    |          S rU   )re   rf   in_subresourcerp   rr   rt   	_segmentssegmentin_childrN   s        r    maybe_in_subresourcez3_maybe_in_subresource.<locals>.maybe_in_subresource  sb    
 NN	  	  	 Gh&&x''4	4+@+@+H&&{333r   rp   rq   rr   rs   rt   ru   r#   rs   r   rN   rP   rQ   r|   r{   s   `   @r    _maybe_in_subresourcer     s;    
 k)H4 4 4 4 4 4 4  r   c                "     ||z  d	 fd}|S )
Nrp   rq   rr   rs   rt   ru   r#   c                    t          |           }|D ]U}|dk    r1t          |j        t                    r|                    |          c S |vr|vst          |d           |c S V|                    |          S r_   re   r'   r!   r   rw   rf   rx   s        r    r|   z?_maybe_in_subresource_crazy_items.<locals>.maybe_in_subresource6  s    
 NN	  		  		 G'!!j$' '!  ..{;;;;;h&&x''4	4+@+@+H&&{333r   r}   r   r~   s   `   @r    !_maybe_in_subresource_crazy_itemsr   /  ;    
 k)H4 4 4 4 4 4 4$  r   c                "     ||z  d	 fd}|S )
Nrp   rq   rr   rs   rt   ru   r#   c                    t          |           }|D ]S}|dv r1t          |j        t                    r|                    |          c S |vr|vst          |d           |c S T|                    |          S )N>   r`   rd   r   rx   s        r    r|   zL_maybe_in_subresource_crazy_items_dependencies.<locals>.maybe_in_subresourceR  s    
 NN	  		  		 G333
$9 93  ..{;;;;;h&&x''4	4+@+@+H&&{333r   r}   r   r~   s   `   @r    ._maybe_in_subresource_crazy_items_dependenciesr   K  r   r   zdraft2020-12>   ifnotelsethenr`   containscontentSchemapropertyNamesunevaluatedItemsrm   unevaluatedProperties>   allOfanyOfoneOfprefixItems>   $defs
propertiesdefinitionsdependentSchemaspatternProperties)rN   rQ   rP   )r;   id_ofrX   
anchors_inr|   zdraft2019-09>   r   r   r   r   r   r   r   rl   r   rm   r   >   r   r   r   zdraft-07>   r   r   r   r   r   r   rl   rm   >   r   r   r   zdraft-06>   r   r   r   rl   rm   zdraft-04r   >   r   rl   rm   zdraft-03extends)rQ   rP   rl   rm   c                >    i | ]\  }}|t          j        |          S r   )r
   opaque).0
dialect_idr5   s      r    
<dictcomp>r   /  s8     
 
 
%J 	HOM22
 
 
r   z,https://json-schema.org/draft/2020-12/schemaz,https://json-schema.org/draft/2019-09/schemaz&http://json-schema.org/draft-07/schemaz&http://json-schema.org/draft-06/schemaz&http://json-schema.org/draft-04/schemaz&http://json-schema.org/draft-03/schemazRegistry[Specification[Schema]]_SPECIFICATIONSr   r   defaultSpecification[Any] | _UnsetSpecification[Any]c                    t                               |                     d                    }||j        S |t          u rt          |           |S )z
    Retrieve the `Specification` with the given dialect identifier.

    Raises:

        `UnknownDialect`

            if the given ``dialect_id`` isn't known

    r-   )r   r)   rstripr!   r   r   )r   r   r<   s      r    specification_withr   =  sR     "":#4#4S#9#9::H  &Z(((Nr   c                  0    e Zd ZU dZded<   ded<   dd
ZdS )r>   z4
    Dynamic anchors, introduced in draft 2020.
    strr;   SchemaResourcer<   rr   _Resolver[Schema]r#   _Resolved[Schema]c                <   | j         }|                                D ]X\  }}	 |                    || j                  j        }n# t
          j        $ r Y 8w xY wt          |t                    r|j         }Yt          |j
        |                    |                    S )z2
        Resolve this anchor dynamically.
        )r!   rr   )r<   dynamic_scoper?   r;   rh   r   NoSuchAnchorr'   r>   	_Resolvedr!   rw   )selfrr   lastr   registryr?   s         r    resolvezDynamicAnchor.resolve\  s     }%3355 	' 	'MC!di88>*   &-00 '],,T22
 
 
 	
s    AAANrr   r   r#   r   )r   r   r   r   r   r   r   r   r    r>   r>   S  sK           III
 
 
 
 
 
r   r>   rr   r   r   c                f   |                      d          }t          |j        t                    r|j                            d          rg|                                 D ]R\  }}|                      |          }t          |j        t                    r|j                            d          s n|}S|S )u   
    Recursive references (via recursive anchors), present only in draft 2019.

    As per the 2019 specification (§ 8.2.4.2.1), only the ``#`` recursive
    reference is supported (and is therefore assumed to be the relevant
    reference).
    r-   z$recursiveAnchor)lookupr'   r!   r   r)   r   )rr   resolvedr   _next_resolveds        r    lookup_recursive_refr   n  s     s##H(#W-- 
%(2C2G2G3 3 
% ,,.. 	% 	%FC$OOC00M&   #+//0BCC $HHOr   N)r!   r"   r#   r$   )r!   r2   r#   r$   )r5   r6   r!   r"   r#   r7   )r5   r6   r!   r"   r#   rB   )r5   rJ   r!   r2   r#   rK   )rN   rO   rP   rO   rQ   rO   )r   r   r   r   r#   r   r   )?r   
__future__r   collections.abcr   r   r   typingr   referencingr   r	   r
   r   r   referencing._attrsr   referencing._corer   r   r   r   	_Resolverr   referencing.typingr   
AnchorTyper   r   r2   r(   r"   r   r   r   r   	Exceptionr   r*   r1   r4   rA   rD   rI   rM   	frozensetr[   ra   ri   rn   r   r   r   DRAFT202012DRAFT201909DRAFT7DRAFT6DRAFT4DRAFT3r   r   r>   r   r   r   r    <module>r      s     # " " " " " 3 3 3 3 3 3 3 3 3 3       M M M M M M M M M M M M M M % % % % % %            B A A A A A A A A A sCx  
	 &! &! "* + + + +     Y            
 
 
 
*   "   "     #&Y[[%IKK    : #&Y[[%IKK    B #&Y[[%IKK$ $ $ $ $P #&Y[[%IKK' ' ' ' 'V #&Y[[%IKK         0 #&Y[[%IKK         : #&Y[[%IKK         : m	
$$
 
 
 ?>>
 
 
  . ..
 
 
 ?>>
 
 
  72 2 2h m	
55
 
 
 0//
 
 
  . ::
 
 
 0//
 
 
  72 2 2h 
	
BB	
 	
 	
 0//GGG   +GG	
 	
 	
 0//GGG  % 
  
  
D 
	
BB
 
 
 0//GGG
 
 
 +GG
 
 
 0//GGG
 
 

 
 
8 
	
EE///GGG  
 $GGCCC///GGG  
 
 
  
	
EEKGGG   $GG#%;<KGGG  
 
 
  4<8
 
 <[I;[I5v>5v>5v>5v>*

 
 
4 4    " ,2    , 
 
 
 
 
 
 
 
4     r   