
    QEe%                         d dl mZmZmZ d dlmZ d dlZd dlZ G d de          Z G d d          Z	d Z
d	 Zd
 Zd Zd Zd Zd Z e             e            fdZd Zd Zd ZdS )    )MappingMutableMappingSequence)urlsplitNc                   B    e Zd ZdZd Zd Zd Zd Zd Zd Z	d Z
d	 Zd
S )URIDictz8
    Dictionary which uses normalized URIs as keys.
    c                 D    t          |                                          S N)r   geturlselfuris     1lib/python3.11/site-packages/jsonschema/_utils.py	normalizezURIDict.normalize   s    }}##%%%    c                 P    t                      | _         | j        j        |i | d S r
   )dictstoreupdate)r   argskwargss      r   __init__zURIDict.__init__   s-    VV

4*6*****r   c                 B    | j         |                     |                   S r
   r   r   r   s     r   __getitem__zURIDict.__getitem__   s    z$..--..r   c                 @    || j         |                     |          <   d S r
   r   )r   r   values      r   __setitem__zURIDict.__setitem__   s     */
4>>#&&'''r   c                 <    | j         |                     |          = d S r
   r   r   s     r   __delitem__zURIDict.__delitem__   s    Jt~~c**+++r   c                 *    t          | j                  S r
   )iterr   r   s    r   __iter__zURIDict.__iter__       DJr   c                 *    t          | j                  S r
   )lenr   r#   s    r   __len__zURIDict.__len__   s    4:r   c                 *    t          | j                  S r
   )reprr   r#   s    r   __repr__zURIDict.__repr__"   r%   r   N)__name__
__module____qualname____doc__r   r   r   r   r    r$   r(   r+    r   r   r   r      s         & & &+ + +/ / /0 0 0, , ,                r   r   c                       e Zd ZdZd ZdS )UnsetzG
    An as-of-yet unset attribute or unprovided default parameter.
    c                     dS )Nz<unset>r0   r#   s    r   r+   zUnset.__repr__+   s    yr   N)r,   r-   r.   r/   r+   r0   r   r   r2   r2   &   s-             r   r2   c                 T    |s| S |  dd                     d |D                        dS )aA  
    Construct a single string containing indexing operations for the indices.

    For example for a container ``bar``, [1, 2, "foo"] -> bar[1][2]["foo"]

    Arguments:

        container (str):

            A word to use for the thing being indexed

        indices (sequence):

            The indices to format.
    [z][c              3   4   K   | ]}t          |          V  d S r
   r*   ).0indexs     r   	<genexpr>z"format_as_index.<locals>.<genexpr>B   s(      #E#EEDKK#E#E#E#E#E#Er   ])join)	containerindicess     r   format_as_indexr?   /   sD    "  HH$))#E#EW#E#E#EEEHHHHr   c              #      K   |                     di           }d                    |                     di                     }| D ]"}||vr|rt          j        ||          r|V  #dS )z
    Return the set of additional properties for the given ``instance``.

    Weeds out properties that should have been validated by ``properties`` and
    / or ``patternProperties``.

    Assumes ``instance`` is dict-like already.
    
properties|patternPropertiesN)getr<   research)instanceschemarA   patternspropertys        r   find_additional_propertiesrK   E   s       L"--Jxx

#6;;<<H  :%% BIh99 NNN	 r   c                 r    t          |           dk    rdnd}d                    d | D                       |fS )z@
    Create an error message for extra items or properties.
       waswerez, c              3   4   K   | ]}t          |          V  d S r
   r7   )r8   extras     r   r:   zextras_msg.<locals>.<genexpr>^   s(      55UT%[[555555r   )r'   r<   )extrasverbs     r   
extras_msgrT   X   sC    
 KK1$$55&D9955f55555t;;r   c                 6    t          | t                    r| gS | S )z]
    Wrap ``thing`` in a list if it's a single str.

    Otherwise, return it unchanged.
    )
isinstancestr)things    r   ensure_listrY   a   s"     % wLr   c                     t          |           t                    k    rdS t          fd|                                 D                       S )zI
    Check if two mappings are equal using the semantics of `equal`.
    Fc              3   R   K   | ]!\  }}|v ot          ||                   V  "d S r
   equal)r8   keyr   twos      r   r:   z!_mapping_equal.<locals>.<genexpr>s   sR        C 	s
-uUCH--     r   )r'   allitemsoner_   s    `r   _mapping_equalrd   m   sa     3xx3s88u    ))++     r   c                     t          |           t          |          k    rdS t          d t          | |          D                       S )zJ
    Check if two sequences are equal using the semantics of `equal`.
    Fc              3   <   K   | ]\  }}t          ||          V  d S r
   r\   )r8   ijs      r   r:   z"_sequence_equal.<locals>.<genexpr>   s.      55tq!uQ{{555555r   )r'   r`   ziprb   s     r   _sequence_equalrj   y   sE     3xx3s88u55s3}}555555r   c                    t          | t                    st          |t                    r| |k    S t          | t                    r%t          |t                    rt          | |          S t          | t                    r%t          |t                    rt          | |          S t          |           t          |          k    S )z
    Check if two things are equal evading some Python type hierarchy semantics.

    Specifically in JSON Schema, evade `bool` inheriting from `int`,
    recursing into sequences to do the same.
    )rV   rW   r   rj   r   rd   unboolrb   s     r   r]   r]      s     #s z#s33 cz#x   )ZX%>%> )sC(((#w (JsG$<$< (c3'''#;;&++%%r   c                     | du r|S | du r|S | S )zH
    A hack to make True and 1 and False and 0 unique for ``uniq``.
    TFr0   )elementtruefalses      r   rl   rl      s'    
 $	E		Nr   c                 r   	 t          d | D                       }t          j        |dd          }t          ||          D ]\  }}t	          ||          r dS n\# t
          t          f$ rH g }| D ]@}t          |          }|D ]}t	          ||          r  Y dS |                    |           AY nw xY wdS )z
    Check if all of a container's elements are unique.

    Tries to rely on the container being recursively sortable, or otherwise
    falls back on (slow) brute force.
    c              3   4   K   | ]}t          |          V  d S r
   )rl   )r8   rg   s     r   r:   zuniq.<locals>.<genexpr>   s(      33AfQii333333r   rM   NFT)	sorted	itertoolsisliceri   r]   NotImplementedError	TypeErrorrl   append)r=   sortslicedrg   rh   seenes          r   uniqr}      s	   3333333!$400f%% 	 	DAqQ{{ uu	  + 	 	 	 	 	Aq		A ! !A;; ! 5555! KKNNNN	 		 4s   AA A <B4B43B4c           
      P   |                      |d          rg S g }d|v r*t          t          dt          |                              S d|v rh| j                            |d                   }|                    t          |                     |j	        |j
                  ||j	                             d|v r3|t          t          dt          |d                                       z  }d|v r|                     |d                                       |          r9|t          | ||d                   z  }d	|v r|t          | ||d	                   z  }nd
|v r|t          | ||d
                   z  }dD ]_}||v rYt          |          D ]I\  }}|                     ||                                       |          r|                    |           J`dD ]K}||v rE||         D ]<}t          |                     ||          d          }	|	|t          | ||          z  }=L|S )z
    Get all indexes of items that get evaluated under the current schema

    Covers all keywords related to unevaluatedItems: items, prefixItems, if,
    then, else, contains, unevaluatedItems, allOf, oneOf, anyOf
    booleanra   r   $refrH   	_resolverprefixItemsifrH   thenelse)containsunevaluatedItemsallOfoneOfanyOfN)is_typelistranger'   r   lookupextend%find_evaluated_item_indexes_by_schemaevolvecontentsresolveris_valid	enumeraterx   nextdescend)
	validatorrG   rH   evaluated_indexesresolvedkeywordkv	subschemaerrss
             r   r   r      s    ++ 	&E!S]]++,,,&--fVn==  1  #,&/ !   ! 		
 		
 		
 T%3vm/D+E+E"F"FGGGv~~6$<0099(CC 	!F8VD\" "  !%Jx& & ! !%Jx& & ! 4 0 0f!(++ 0 01##6'?#;;DDQGG 0%,,Q///.  f#G_  	I--h	BBDII<%)N!8Y* * % r   c                    |                      |d          rg S g }d|v rh| j                            |d                   }|                    t	          |                     |j        |j                  ||j                             dD ]r}||v rl||         }|                      |d          r|r||                                z  }>|                      |d          r|D ]}||v r|	                    |           sd|v r:|D ]7}|d         D ],}t          j        ||          r|	                    |           -8d|v r9|d                                         D ]\  }}	||vr
|t	          | ||	          z  }dD ]K}||v rE||         D ]<}	t          |                     ||	          d	          }
|
|t	          | ||	          z  }=Ld
|v r|                     |d
                                       |          r9|t	          | ||d
                   z  }d|v r|t	          | ||d                   z  }nd|v r|t	          | ||d                   z  }|S )a  
    Get all keys of items that get evaluated under the current schema

    Covers all keywords related to unevaluatedProperties: properties,
    additionalProperties, unevaluatedProperties, patternProperties,
    dependentSchemas, allOf, oneOf, anyOf, if, then, else
    r   r   r   )rA   additionalPropertiesunevaluatedPropertiesobjectrC   dependentSchemasr   Nr   r   r   r   )r   r   r   r   &find_evaluated_property_keys_by_schemar   r   r   keysrx   rE   rF   ra   r   r   r   )r   rG   rH   evaluated_keysr   r   schema_valuerJ   patternr   r   s              r   r   r      s1    ++ 	N&--fVn==2  #,&/ !   ! 		
 		
 		
 8 8 f!'?L  y99 8l 8(--//1""<:: 8 , 8 8H8++&--h777f$$  	4 	4H!"56 4 49Wh// 4"))(3334 V###)*<#=#C#C#E#E 	 	Hix''D8Y  NN /  f#G_  	I--h	BBDII<"&L!8Y' ' N v~~6$<0099(CC 	D8VD\  N "Hx# #  "Hx# #  r   )collections.abcr   r   r   urllib.parser   rt   rE   r   r2   r?   rK   rT   rY   rd   rj   r]   r   rl   r}   r   r   r0   r   r   <module>r      sl   = = = = = = = = = = ! ! ! ! ! !     				         n      >       I I I,  &< < <	 	 		 	 	6 6 6& & &    	 	 	 	  8< < <~L L L L Lr   