
                             S SK r S SKrS SKrS SKrS SKJrJrJr   " S S\5      r " S S\	5      r
S rSS jrS	 rS
 rS rS rS rS r\	" 5       \	" 5       4S jrS rg)    N)	str_typesMutableMappingurlsplitc                   H    \ rS rSrSrS rS rS rS rS r	S r
S	 rS
 rSrg)URIDict	   z1
Dictionary which uses normalized URIs as keys.

c                 4    [        U5      R                  5       $ N)r   geturlselfuris     $lib/third_party/jsonschema/_utils.py	normalizeURIDict.normalize   s    }##%%    c                 Z    [        5       U l        U R                  R                  " U0 UD6  g r
   )dictstoreupdate)r   argskwargss      r   __init__URIDict.__init__   s"    V


4*6*r   c                 >    U R                   U R                  U5         $ r
   r   r   r   s     r   __getitem__URIDict.__getitem__   s    zz$..-..r   c                 >    X R                   U R                  U5      '   g r
   r   )r   r   values      r   __setitem__URIDict.__setitem__   s    */

4>>#&'r   c                 <    U R                   U R                  U5      	 g r
   r   r   s     r   __delitem__URIDict.__delitem__   s    JJt~~c*+r   c                 ,    [        U R                  5      $ r
   )iterr   r   s    r   __iter__URIDict.__iter__       DJJr   c                 ,    [        U R                  5      $ r
   )lenr   r(   s    r   __len__URIDict.__len__"   s    4::r   c                 ,    [        U R                  5      $ r
   )reprr   r(   s    r   __repr__URIDict.__repr__%   r+   r   )r   N)__name__
__module____qualname____firstlineno____doc__r   r   r   r!   r$   r)   r.   r2   __static_attributes__ r   r   r   r   	   s/    
&+/0,  r   r   c                       \ rS rSrSrS rSrg)Unset)   z@
An as-of-yet unset attribute or unprovided default parameter.

c                     g)Nz<unset>r:   r(   s    r   r2   Unset.__repr__/   s    r   r:   N)r4   r5   r6   r7   r8   r2   r9   r:   r   r   r<   r<   )   s    
r   r<   c                     [         R                  " SSR                  U 5      5      n[        R                  " UR                  S5      5      $ )z<
Load a schema from ./schemas/``name``.json and return it.


jsonschemazschemas/{0}.jsonzutf-8)pkgutilget_dataformatjsonloadsdecode)namedatas     r   load_schemarJ   3   s:     L*<*C*CD*IJD::dkk'*++r   c                 V   ^ SR                  U4S jU R                  5        5       5      $ )z=
A dumb version of :func:`textwrap.indent` from Python 3.3.


c              3   :   >#    U  H  nS ST-  -  U-   v   M     g7f)    Nr:   ).0linetimess     r   	<genexpr>indent.<locals>.<genexpr>C   s!     N:M$SAI&-:Ms   )join
splitlines)stringrR   s    `r   indentrX   =   s#     99N&:K:K:MNNNr   c                 H    U (       d  gSSR                  S U  5       5      -  $ )z
Construct a single string containing indexing operations for the indices.

For example, [1, 2, "foo"] -> [1][2]["foo"]

Arguments:

    indices (sequence):

        The indices to format.

 z[%s]z][c              3   8   #    U  H  n[        U5      v   M     g 7fr
   r1   )rP   indexs     r   rS   "format_as_index.<locals>.<genexpr>V   s     ?wed5kkw   )rU   )indicess    r   format_as_indexra   F   s$     DII?w????r   c              #      #    UR                  S0 5      nSR                  UR                  S0 5      5      nU  H2  nXB;  d  M
  U(       a  [        R                  " X45      (       a  M.  Uv   M4     g7f)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)getrU   research)instanceschemarc   patternspropertys        r   find_additional_propertiesrm   Y   sZ      L"-Jxx

#6;<H%BIIh99N	 s   <A/-A/c                 ^    [        U 5      S:X  a  SnOSnSR                  S U  5       5      U4$ )z9
Create an error message for extra items or properties.

   waswere, c              3   8   #    U  H  n[        U5      v   M     g 7fr
   r\   )rP   extras     r   rS   extras_msg.<locals>.<genexpr>w   s     5fUT%[[fr_   )r-   rU   )extrasverbs     r   
extras_msgrx   m   s4     6{a995f55t;;r   c                     / nU H!  n UR                  [        US   5      5        M#     U < SSR                  U5      < 3$ ! [         a    UR                  [        U5      5         Md  f = f)a  
Create an error message for a failure to match the given types.

If the ``instance`` is an object and contains a ``name`` property, it will
be considered to be a description of that object and used as its type.

Otherwise the message is simply the reprs of the given ``types``.

rH   z is not of type rr   )appendr1   	ExceptionrU   )ri   typesreprstypes       r   	types_msgr   z   sd     E	%LLd6l+, 
 &.tyy/?@@  	%LLd$	%s   A$A*)A*c                     [        5       n[        U [        5      (       d  U 4n U  HE  n[        U[        5      (       a  UR                  [	        U5      5        M4  UR                  U5        MG     [        U5      $ )z
isinstance() can accept a bunch of really annoying different types:
    * a single type
    * a tuple of types
    * an arbitrary nested tree of tuples

Return a flattened tuple of the given argument.

)set
isinstancetupler   flattenadd)suitable_for_isinstancer|   things      r   r   r      sa     EE-u55#:"<(eU##LL(IIe	 )
 <r   c                 6    [        U [        5      (       a  U /$ U $ )zR
Wrap ``thing`` in a list if it's a single str.

Otherwise, return it unchanged.

)r   r   )r   s    r   ensure_listr      s     %##wLr   c                 "    U SL a  U$ U SL a  U$ U $ )zA
A hack to make True and 1 and False and 0 unique for ``uniq``.

TFr:   )elementtruefalses      r   unboolr      s"     $	E	Nr   c                     [        [        S U  5       5      5      [        U 5      :H  $ ! [         a     [        S U  5       5      n[        R
                  " USS5      n[        X5       H  u  p4X4:X  d  M     g    g! [        [        4 a4    / nU  H(  n[        U5      nXe;   a      gUR                  U5        M*       gf = ff = f)z
Check if all of a container's elements are unique.

Successively tries first to rely that the elements are hashable, then
falls back on them being sortable, and finally falls back on brute
force.

c              3   8   #    U  H  n[        U5      v   M     g 7fr
   r   rP   is     r   rS   uniq.<locals>.<genexpr>   s     4)Qvayy)r_   c              3   8   #    U  H  n[        U5      v   M     g 7fr
   r   r   s     r   rS   r      s     7Y&))Yr_   ro   NFT)
r-   r   	TypeErrorsorted	itertoolsislicezipNotImplementedErrorr   rz   )	containersortslicedr   jseenes          r   uniqr      s    34)445YGG 	7Y77D%%dAt4FD)6  *  $Y/ 	D1I9 A	 
 	s>   &) 
C=A<5A<8A<<(C $C'C <C?C  C)ro   )r   rE   rB   rg   jsonschema.compatr   r   r   r   objectr<   rJ   rX   ra   rm   rx   r   r   r   r   r   r:   r   r   <module>r      sp       	 A A n  @F ,O@&(
<A(.
   
r   