
    h&                         S r SSKrSSKrSSKrSSKr\R
                  r " S S\R                  5      r " S S\	5      r
S rS rS	 rS
 rSS jrSS jr	S r\R"                  r\R$                  rg)zImproved JSON serialization.
    Nc                   ,   ^  \ rS rSrSrU 4S jrSrU =r$ )JsonEncoder   zCustomizable JSON encoder.

If the object implements __getstate__, then that method is invoked, and its
result is serialized instead of the object itself.
c                 j   >  UR                   nU" 5       $ ! [         a     Of = f[        TU ]  U5      $ N)__getstate__AttributeErrorsuperdefault)selfvalue	get_state	__class__s      fC:\Users\julio\OneDrive\Documentos\Trabajo\Ideas Frescas\venv\Lib\site-packages\debugpy/common/json.pyr   JsonEncoder.default   sB    	**I ;  		 wu%%s    
## )__name__
__module____qualname____firstlineno____doc__r   __static_attributes____classcell__)r   s   @r   r   r      s    & &    r   c                   J    \ rS rSrSr\r \" SS9r S rS r	S r
S rS	 rS
rg)
JsonObject"   zrA wrapped Python object that formats itself as JSON when asked for a string
representation via str() or format().
   )indentc                 >    [        U[        5      (       a   eXl        g r   )
isinstancer   r   )r   r   s     r   __init__JsonObject.__init__-   s    eZ0000
r   c                     [         er   )NotImplementedErrorr   s    r   r   JsonObject.__getstate__1   s    !!r   c                 B    [         R                  " U R                  5      $ r   )builtinsreprr   r&   s    r   __repr__JsonObject.__repr__4   s    }}TZZ((r   c                     [        U 5      $ r   )formatr&   s    r   __str__JsonObject.__str__7   s    d|r   c                     U(       a!  SU-   S-   n[        USU R                  05      nOU R                  nUR                  U R                  5      $ )am  If format_spec is empty, uses self.json_encoder to serialize self.value
as a string. Otherwise, format_spec is treated as an argument list to be
passed to self.json_encoder_factory - which defaults to JSONEncoder - and
then the resulting formatter is used to serialize self.value as a string.

Example::

    format("{0} {0:indent=4,sort_keys=True}", json.repr(x))
zjson_encoder_factory()json_encoder_factory)evalr3   json_encoderencoder   )r   format_specmake_encoderencoders       r   
__format__JsonObject.__format__:   sS      3[@3FL5t7P7PQG ''G~~djj))r   r   N)r   r   r   r   r   r   r3   r5   r"   r   r+   r/   r:   r   r   r   r   r   r   "   s8     ';'q1LK")*r   r   c                     U H-  n[        U[        R                  5      (       d  M$   U" U 5      s  $    g! [         a     M?  f = f)zGConvert value (str) to number, otherwise return None if is not possibleN)
issubclassnumbersNumber
ValueError)r   	classinfoone_infos      r   
_converterrD   `   s@    h//&   s   5
AAc                     ^ ^ [        T 5      (       d   eUR                  SS5      m[        U5      (       a   eU U4S jnU$ )zReturns a validator for a JSON property that requires it to have a value of
the specified type. If optional=True, () is also allowed.

The meaning of classinfo is the same as for isinstance().
optionalFc                    > T(       a  U S:X  d  [        U T5      (       a  U $ [        U T5      nU(       a  U$ T(       d  U S:X  a  [        S5      e[        SSR	                  S T 5       5      -   5      e)Nr   zmust be specifiedzmust be  or c              3   8   #    U  H  oR                   v   M     g 7fr   )r   ).0ts     r   	<genexpr>,of_type.<locals>.validate.<locals>.<genexpr>   s     4SAZZ   )r!   rD   rA   	TypeErrorjoin)r   converted_valuerB   rF   s     r   validateof_type.<locals>.validateu   sf    "E9)E)EL(	:O&& !455J4S4S)SSTTr   lenpop)rB   kwargsrR   rF   s   `  @r   of_typerX   j   s>     y>>>zz*e,H6{{?
U Or   c                    ^  U 4S jnU$ )zReturns a validator for a JSON property with a default value.

The validator will only allow property values that have the same type as the
specified default value.
c                    > U S:X  a  T$ [        U [        T5      5      (       a  U $ [        SR                  [        T5      R                  5      5      e)Nr   zmust be {0})r!   typerO   r.   r   )r   r   s    r   rR   default.<locals>.validate   sE    B;NtG}--LM00g1G1GHIIr   r   )r   rR   s   ` r   r   r      s    J Or   c                     ^ ^ [        T 5      (       d   eUR                  SS5      m[        U5      (       a   eUU 4S jnU$ )zReturns a validator for a JSON enum.

The validator will only allow the property to have one of the specified values.

If optional=True, and the property is missing, the first value specified is used
as the default.
rF   Fc                 ~   > T(       a  U S:X  a  TS   $ U T;   a  U $ [        SR                  [        T5      5      5      e)Nr   r   zmust be one of: {0!r})rA   r.   list)r   rF   valuess    r   rR   enum.<locals>.validate   s=    !9f_L4;;DLIJJr   rT   )r`   rW   rR   rF   s   `  @r   enumrb      s>     v;;;zz*e,H6{{?K Or   c                 "  ^ ^^^^^ T (       d  S m O5[        T [        5      (       d  [        T [        5      (       a  [        T 5      m Tc  S mO[        T[        5      (       a.  T Vs1 s H  n[
        R                  " U5      iM     snmU4S jmOq[        T[        5      (       a@  S[        T5      s=::  a  S::  d   e   e[        S T 5       5      mTS-   SS u  mmUU4S	 jmO[
        R                  " T5      mU4S
 jmU UU4S jnU$ s  snf )a  Returns a validator for a JSON array.

If the property is missing, it is treated as if it were []. Otherwise, it must
be a list.

If validate_item=False, it's treated as if it were (lambda x: x) - i.e. any item
is considered valid, and is unchanged. If validate_item is a type or a tuple,
it's treated as if it were json.of_type(validate).

Every item in the list is replaced with validate_item(item) in-place, propagating
any exceptions raised by the latter. If validate_item is a type or a tuple, it is
treated as if it were json.of_type(validate_item).

If vectorize=True, and the value is neither a list nor a dict, it is treated as
if it were a single-element list containing that single value - e.g. "foo" is
then the same as ["foo"]; but {} is an error, and not [{}].

If size is not None, it can be an int, a tuple of one int, a tuple of two ints,
or a set. If it's an int, the array must have exactly that many elements. If it's
a tuple of one int, it's the minimum length. If it's a tuple of two ints, they
are the minimum and the maximum lengths. If it's a set, it's the set of sizes that
are valid - e.g. for {2, 4}, the array can be either 2 or 4 elements long.
c                     U $ r   r   )xs    r   <lambda>array.<locals>.<lambda>   s    !r   c                     g)NTr   )_s    r   rf   rg      s    $r   c                    > [        U 5      T;   =(       d0    SR                  SR                  S [        T5       5       5      5      $ )Nmust have {0} elementsrH   c              3   8   #    U  H  n[        U5      v   M     g 7fr   )strrJ   ns     r   rL   *array.<locals>.<lambda>.<locals>.<genexpr>   s     9LqCFFLrN   )rU   r.   rP   sortedr   sizes    r   rf   rg      s=    J$ '..9F4L99r         c              3   N   #    U  H  n[         R                  " U5      v   M     g 7fr   )operatorindexrn   s     r   rL   array.<locals>.<genexpr>   s     51X^^A&&s   #%r   r   c                    > [        U 5      T:  a  SR                  T5      $ Tb   [        U 5      T:  a  SR                  T5      $ S$ )Nzmust have at least {0} elementszmust have at most {0} elementsTrU   r.   )r   max_lenmin_lens    r   rf   rg      sV    5zG# .44W=  "s5zG'; 288A 	r   c                 P   > [        U 5      T:H  =(       d    SR                  T5      $ )Nrk   r{   rr   s    r   rf   rg      s#    J$G":"A"A$"GGr   c                 l  > U S:X  a  / n O%T(       a  [        U [        [        45      (       d  U /n [        [        5      " U 5        T" U 5      nUSLa  [	        U5      e[        U 5       H  u  p# T" U5      X'   M     U $ ! [        [        4 a%  n[        U5      " S[        U5       SU 35      eS nAff = f)Nr   T[] )	r!   r_   dictrX   rA   	enumeraterO   r[   r*   )r   size_erriitemexcvalidate_itemvalidate_size	vectorizes        r   rR   array.<locals>.validate   s    B;Ez%$>>GEe '4X&& 'GA6(. (
  z* 63i!DG9Bse 4556s   .
A>>B3 B..B3)r!   r[   tuplerX   setrw   rx   rU   )r   r   rs   ro   rR   r|   r}   r   s   ```  @@@r   arrayr      s    2 #	M4	(	(J}e,L,L.|&	D#		+/04aq!40
 
D%	 	 CI""""""555 7NAa0
 ~~d#
& OW 1s   ' Dc                 ~   ^  [        T [        5      (       d  [        T [        5      (       a  [        T 5      m U 4S jnU$ )aR  Returns a validator for a JSON object.

If the property is missing, it is treated as if it were {}. Otherwise, it must
be a dict.

If validate_value=False, it's treated as if it were (lambda x: x) - i.e. any
value is considered valid, and is unchanged. If validate_value is a type or a
tuple, it's treated as if it were json.of_type(validate_value).

Every value in the dict is replaced with validate_value(value) in-place, propagating
any exceptions raised by the latter. If validate_value is a type or a tuple, it is
treated as if it were json.of_type(validate_value). Keys are not affected.
c                   > U S:X  a  0 $ [        [        5      " U 5        T(       a$  U R                  5        H  u  p T" U5      X'   M     U $ ! [        [        4 a%  n[        U5      " S[        U5       SU 35      eS nAff = f)Nr   r   r   )rX   r   itemsrO   rA   r[   r*   )r   kvr   validate_values       r   rR   object.<locals>.validate  s    B;Ie:-a0EH &
  ":. :s)aQy3%$899:s   
AB A<<B)r!   r[   r   rX   )r   rR   s   ` r   objectr      s4     .$'':ne+L+L 0 Or   c                     [        U 5      $ r   )r   r<   s    r   r*   r*     s    er   )FFN)F)r   r)   jsonr?   rw   JSONDecoderJsonDecoderJSONEncoderr   r   r   rD   rX   r   rb   r   r*   dumpsloadsr   r   r   <module>r      s~   
     &$"" &"0* 0*|4$0L^D 	



r   