
    Mh                     L   U d dl Z d dlZd dlZd dlmZmZmZmZmZm	Z	m
Z
mZmZmZ d dlZd dlmZ dae	ej                 ed<    G d de j                  Zddddddddddddd	ed
e	e         dede	eeeef         gef                  de	eegef                  de	eegef                  de	eegef                  dede	eeeeef                  gef                  dedede	e         defdZddddddddddddded
e	e         dede	eeeef         gef                  de	eegef                  de	eegef                  de	eegef                  dede	eeeeef                  gef                  dedede	e         fdZddddddddddddded
e	e         dede	eeeef         gef                  de	eegef                  de	eegef                  de	eegef                  dede	eeeeef                  gef                  dedede	e         fdZd Zdeeeeef                  gef         fdZddddddddddddej        dded	ed ed!ed"ed#ede	ed$                  d%e	eeef                  d&e	eeef                  d'e	eegef                  d(ed)ed*eded+efd,Zddddddddddddej        dded ed!ed"ed#ede	ed$                  d%e	eeef                  d&e	eeef                  d'e	eegef                  d(ed)ed*eded+efd-Z  G d. d$          Z!defd/Z"dS )0    N)
AnyCallableIOIterableMappingOptionalSetTupleTypeUnion)Parser_reserved_word_rec                   "    e Zd ZdZdZdZdZdZdS )
QuoteStylea  Controls how strings will be quoted during encoding.

    By default, for compatibility with the `json` module and older versions of
    `json5`, strings (not being used as keys and that are legal identifiers)
    will always be double-quoted, and any double quotes in the string will be
    escaped. This is `QuoteStyle.ALWAYS_DOUBLE`.  If you pass
    `QuoteStyle.ALWAYS_SINGLE`, then strings will always be single-quoted, and
    any single quotes in the string will be escaped.  If you pass
    `QuoteStyle.PREFER_DOUBLE`, then the behavior is the same as ALWAYS_DOUBLE
    and strings will be double-quoted *unless* the string contains more double
    quotes than single quotes, in which case the string will be single-quoted
    and single quotes will be escaped. If you pass `QuoteStyle.PREFER_SINGLE`,
    then the behavior is the same as ALWAYS_SINGLE and strings will be
    single-quoted *unless* the string contains more single quotes than double
    quotes, in which case the string will be double-quoted and any double
    quotes will be escaped.

    *Note:* PREFER_DOUBLE and PREFER_SINGLE can impact performance, since in
    order to know which encoding to use you have to iterate over the entire
    string to count the number of single and double quotes. The codes guesses
    at an encoding while doing so, but if it guess wrong, the entire string has
    to be re-encoded, which will slow things down. If you are very concerned
    about performance (a) you probably shouldn't be using this library in the
    first place, because it just isn't very fast, and (b) you should use
    ALWAYS_DOUBLE or ALWAYS_SINGLE, which won't have this issue.
    always_doublealways_singleprefer_doubleprefer_singleN)__name__
__module____qualname____doc__ALWAYS_DOUBLEALWAYS_SINGLEPREFER_DOUBLEPREFER_SINGLE     I/var/www/html/test/jupyter/venv/lib/python3.11/site-packages/json5/lib.pyr   r   '   s.         6 $M#M#M#MMMr   r   Tencodingclsobject_hookparse_float	parse_intparse_constantstrictobject_pairs_hookallow_duplicate_keysconsume_trailingstartfpr!   r"   r#   r$   r%   r&   r'   r(   r)   r*   r+   returnc                    |                                  }t          ||||||||||	|
|          \  }}}|rt          |          |S )a  Deserialize ``fp`` (a ``.read()``-supporting file-like object
    containing a JSON document) to a Python object.

    Supports almost the same arguments as ``json.load()`` except that:
        - the `cls` keyword is ignored.
        - an extra `allow_duplicate_keys` parameter supports checking for
          duplicate keys in a object; by default, this is True for
          compatibility with ``json.load()``, but if set to False and
          the object contains duplicate keys, a ValueError will be raised.
        - an extra `consume_trailing` parameter specifies whether to
          consume any trailing characters after a valid object has been
          parsed. By default, this value is True and the only legal
          trailing characters are whitespace. If this value is set to False,
          parsing will stop when a valid object has been parsed and any
          trailing characters in the string will be ignored.
        - an extra `start` parameter specifies the zero-based offset into the
          file to start parsing at. If `start` is None, parsing will
          start at the current position in the file, and line number
          and column values will be reported as if starting from the
          beginning of the file; If `start` is not None,
          `load` will seek to zero and then read (and discard) the
          appropriate number of characters before beginning parsing;
          the file must be seekable for this to work correctly.

    You can use `load(..., consume_trailing=False)` to repeatedly read
    values from a file. However, in the current implementation `load` does
    this by reading the entire file into memory before doing anything, so
    it is not very efficient.

    Raises
        - `ValueError` if given an invalid document. This is different
          from the `json` module, which raises `json.JSONDecodeError`.
        - `UnicodeDecodeError` if given a byte string that is not a
          legal UTF-8 document (or the equivalent, if using a different
          `encoding`). This matches the `json` module.
    r    )readparse
ValueError)r,   r!   r"   r#   r$   r%   r&   r'   r(   r)   r*   r+   svalerr_s                   r   loadr6   I   sk    l 			A	%+1)  KCa  ooJr   r2   c                f    t          | |||||||||	|
|          \  }}}|rt          |          |S )aP  Deserialize ``s`` (a string containing a JSON5 document) to a Python
    object.

    Supports the same arguments as ``json.load()`` except that:
        - the `cls` keyword is ignored.
        - an extra `allow_duplicate_keys` parameter supports checking for
          duplicate keys in a object; by default, this is True for
          compatibility with ``json.load()``, but if set to False and
          the object contains duplicate keys, a ValueError will be raised.
        - an extra `consume_trailing` parameter specifies whether to
          consume any trailing characters after a valid object has been
          parsed. By default, this value is True and the only legal
          trailing characters are whitespace. If this value is set to False,
          parsing will stop when a valid object has been parsed and any
          trailing characters in the string will be ignored.
        - an extra `start` parameter specifies the zero-based offset into the
          string to start parsing at.

    Raises
        - `ValueError` if given an invalid document. This is different
          from the `json` module, which raises `json.JSONDecodeError`.
        - `UnicodeDecodeError` if given a byte string that is not a
          legal UTF-8 document (or the equivalent, if using a different
          `encoding`). This matches the `json` module.
    )r2   r!   r"   r#   r$   r%   r&   r'   r(   r)   r*   r+   )r0   r1   )r2   r!   r"   r#   r$   r%   r&   r'   r(   r)   r*   r+   r3   r4   r5   s                  r   loadsr8      s^    V 
%+1)  KCa  ooJr   c          	         |
J d            t          | t                    r|pd}|                     |          } | st          d          |pd}t	          | d|          }|                    ||
d	          \  }}}|rd||fS 	 t          |||||||	
          }|d|fS # t          $ r}dt          |          |fcY d}~S d}~ww xY w)a	  Parse ```s``, returning positional information along with a value.

    This works exactly like `loads()`, except that (a) it returns the
    position in the string where the parsing stopped (either due to
    hitting an error or parsing a valid value) and any error as a string,
    (b) it takes an optional `consume_trailing` parameter that says whether
    to keep parsing the string after a valid value has been parsed; if True
    (the default), any trailing characters must be whitespace. If False,
    parsing stops when a valid value has been reached, (c) it takes an
    optional `start` parameter that specifies a zero-based offset to start
    parsing from in the string, and (d) the return value is different, as
    described below.

    `parse()` is useful if you have a string that might contain multiple
    values and you need to extract all of them; you can do so by repeatedly
    calling `parse`, setting `start` to the value returned in `position`
    from the previous call.

    Returns a tuple of (value, error_string, position). If the string
        was a legal value, `value` will be the deserialized value,
        `error_string` will be `None`, and `position` will be one
        past the zero-based offset where the parser stopped reading.
        If the string was not a legal value,
        `value` will be `None`, `error_string` will be the string value
        of the exception that would've been raised, and `position` will
        be the zero-based farthest offset into the string where the parser
        hit an error.

    Raises:
        - `UnicodeDecodeError` if given a byte string that is not a
          legal UTF-8 document (or the equivalent, if using a different
          `encoding`). This matches the `json` module.

    Note that this does *not* raise a `ValueError`; instead any error is
    returned as the second value in the tuple.

    You can use this method to read in a series of values from a string
    `s` as follows:

    >>> import json5
    >>> s = '1 2 3 4'
    >>> values = []
    >>> start = 0
    >>> while True:
    ...     v, err, pos = json5.parse(s, start=start, consume_trailing=False)
    ...     if v:
    ...         values.append(v)
    ...         start = pos
    ...         if start == len(s) or s[start:].isspace():
    ...             # Reached the end of the string (ignoring trailing
    ...             # whitespace
    ...             break
    ...         continue
    ...     raise ValueError(err)
    >>> values
    [1, 2, 3, 4]

    Nz!Custom decoders are not supportedzutf-8z!Empty strings are not legal JSON5r   z<string>)pos)_strict_consume_trailing)global_vars)r#   r$   r%   r&   r(   r)   )
isinstancebytesdecoder1   r   r0   _convertstr)r2   r!   r"   r#   r$   r%   r&   r'   r(   r)   r*   r+   parserastr4   r:   valuees                     r   r0   r0      s4   V ;;;;;;!U &wHHX ><===JQEAzu---FLL &=MNN !  MCc  S#~!##)/!5
 
 
 dC ! ! !SVVS       !s   B" "
C,C=CCc                 n    d }fd}|pt           }|pt          }|p|}t          | ||||          S )Nc                 p    t          |                     dd                              dd                    S )NInfinityinfNaNnan)floatreplace)r2   s    r   _fp_constant_parserz%_convert.<locals>._fp_constant_parserD  s.    QYYz51199%GGHHHr   c                     sBt                      }| D ]1\  }}||v rt          d| d          |                    |           2r |           S r t          |                     S t          |           S )NzDuplicate key "z" found in object)setr1   adddict)pairskeyskeyr5   r)   r#   r(   s       r   _dictifyz_convert.<locals>._dictifyG  s    # 	55D  Q$;;$%Ms%M%M%MNNN 	,$$U+++ 	,;tE{{+++E{{r   )rM   int	_walk_ast)	rD   r#   r$   r%   r&   r(   r)   rO   rW   s	    `   ``  r   rA   rA   ;  sq    I I I       &K SI#:':NS(KNKKKr   dictifyc                    | dk    rd S | dk    rdS | dk    rdS | \  }}|dk    rl|                     d          s|                     d          r |d	
          S d|v sd|v sd|v r |          S d|v sd|v r |          S  |          S |dk    r|S |dk    r?g }|D ]/\  }}	t          |	          }
|                    ||
f           0 |          S |dk    rfd|D             S t          d| z             )NNoneTrueTFalseFnumber0x0X   )base.rF   ErI   rK   stringobjectarrayc           	      6    g | ]}t          |          S r   )rY   ).0elrZ   r&   r$   r%   s     r   
<listcomp>z_walk_ast.<locals>.<listcomp>}  s9     
 
 
 b';	>JJ
 
 
r   zunknown el: )
startswithrY   appendr1   )rk   rZ   r$   r%   r&   tyvrT   rV   val_exprr3   s    ````      r   rY   rY   \  s    
V||t	V||t	W}}uEB	X~~<< 	)d!3!3 	)9QR((((!88saxx3!88;q>>!??eqjj!>!$$$y||	X~~	X~~ 	% 	%MC';	> C LL#s$$$$wu~~	W}}
 
 
 
 
 
 

 
 
 	
 ^b(
)
))r   F)skipkeysensure_asciicheck_circular	allow_nanr"   indent
separatorsdefault	sort_keys
quote_keystrailing_commasr)   quote_styleobjrr   rs   rt   ru   JSON5Encoderrv   rw   rx   ry   rz   r{   r|   c                b    |                     t          d| ||||||||	|
||||d|           dS )a`  Serialize ``obj`` to a JSON5-formatted stream to ``fp``,
    a ``.write()``-supporting file-like object.

    Supports the same arguments as ``dumps()``, below.

    Calling ``dump(obj, fp, quote_keys=True, trailing_commas=False,                    allow_duplicate_keys=True)``
    should produce exactly the same output as ``json.dump(obj, fp).``
    )r}   rr   rs   rt   ru   r"   rv   rw   rx   ry   rz   r{   r)   r|   Nr   )writedumps)r}   r,   rr   rs   rt   ru   r"   rv   rw   rx   ry   rz   r{   r)   r|   kws                   r   dumpr     so    : HH 	
%)!!+!5#	
 	
 	
 	
    r   c                    |pt           } |d||||||||	|
|||d|}|                    | t                      dd          S )a>  Serialize ``obj`` to a JSON5-formatted string.

    Supports the same arguments as ``json.dumps()``, except that:

    - The ``encoding`` keyword is ignored; Unicode strings are always written.
    - By default, object keys that are legal identifiers are not quoted; if you
      pass ``quote_keys=True``, they will be.
    - By default, if lists and objects span multiple lines of output (i.e.,
      when ``indent`` >=0), the last item will have a trailing comma after it.
      If you pass ``trailing_commas=False``, it will not.
    - If you use a number, a boolean, or ``None`` as a key value in a dict, it
      will be converted to the corresponding JSON string value, e.g.  "1",
      "true", or "null". By default, ``dump()`` will match the `json` modules
      behavior and produce malformed JSON if you mix keys of different types
      that have the same converted value; e.g., ``{1: "foo", "1": "bar"}``
      produces '{"1": "foo", "1": "bar"}', an object with duplicated keys. If
      you pass ``allow_duplicate_keys=False``, an exception will be raised
      instead.
    - If `quote_keys` is true, then keys of objects will be enclosed in quotes,
      as in regular JSON. Otheriwse, keys will not be enclosed in quotes unless
      they contain whitespace.
    - If `trailing_commas` is false, then commas will not be inserted after the
      final elements of objects and arrays, as in regular JSON.  Otherwise,
      such commas will be inserted.
    - If `allow_duplicate_keys` is false, then only the last entry with a given
      key will be written. Otherwise, all entries with the same key will be
      written.
    - `quote_style` controls how strings are encoded. See the documentation
      for the `QuoteStyle` class, above, for how this is used.

      *Note*: Strings that are being used as unquoted keys are not affected
      by this parameter and remain unquoted.

      *`quote_style` was added in version 0.10.0*.

    Other keyword arguments are allowed and will be passed to the
    encoder so custom encoders can get them, but otherwise they will
    be ignored in an attempt to provide some amount of forward-compatibility.

    *Note:* the standard JSON module explicitly calls `int.__repr(obj)__`
    and `float.__repr(obj)__` to encode ints and floats, thereby bypassing
    any custom representations you might have for objects that are subclasses
    of ints and floats, and, for compatibility, JSON5 does the same thing.
    To override this behavior, create a subclass of JSON5Encoder
    that overrides `encode()` and handles your custom representation.

    For example:

    ```
    >>> import json5
    >>> from typing import Any, Set
    >>>
    >>> class Hex(int):
    ...    def __repr__(self):
    ...        return hex(self)
    >>>
    >>> class CustomEncoder(json5.JSON5Encoder):
    ...    def encode(
    ...        self, obj: Any, seen: Set, level: int, *, as_key: bool
    ...    ) -> str:
    ...        if isinstance(obj, Hex):
    ...            return repr(obj)
    ...        return super().encode(obj, seen, level, as_key=as_key)
    ...
    >>> json5.dumps([20, Hex(20)], cls=CustomEncoder)
    '[20, 0x14]'

    ```

    *Note:* calling ``dumps(obj, quote_keys=True, trailing_commas=False,                             allow_duplicate_keys=True)``
    should produce exactly the same output as ``json.dumps(obj).``
    rr   rs   rt   ru   rv   rw   rx   ry   rz   r{   r)   r|   r   F)seenlevelas_keyr   )r~   encoderQ   )r}   rr   rs   rt   ru   r"   rv   rw   rx   ry   rz   r{   r)   r|   r   encs                   r   r   r     sx    x 
C
# !%'1   C ::cQu:===r   c                      e Zd Zdddddddddddej        ddedededed	eeee	f                  d
ee
e	e	f                  deeegef                  dededededefdZdedefdZdedededede	f
dZdededee	         fdZdedede	fdZdedede	fdZde	dede	fdZde	dede	fdZde	de	fdZdedede	fd Zdededede	fd!Zdededede	fd"Zdede
e	e	f         fd#Zd$e	defd%Zde	defd&Zde	defd'Zd$e	defd(Z dS ))r~   FTNr   rr   rs   rt   ru   rv   rw   rx   ry   rz   r{   r)   r|   c                    ~|| _         || _        || _        || _        || _        || _        ||dnd}|\  | _        | _        |pt          | _	        || _
        |	| _        |
| _        || _        || _        dS )zProvides a class that may be overridden to customize the behavior
        of `dumps()`. The keyword args are the same as for that function.
        *Added in version 0.10.0N)z, : ),r   )rr   rs   rt   ru   rv   rw   item_separatorkv_separator_raise_type_error
default_fnry   rz   r{   r)   r|   )selfrr   rs   rt   ru   rv   rw   rx   ry   rz   r{   r)   r|   r   s                 r   __init__zJSON5Encoder.__init__&  s    ,  (,"$)/[J1;.T.!6%6"$.$8!&r   r}   r-   c                 ,    |                      |          S )aW  Provides a last-ditch option to encode a value that the encoder
        doesn't otherwise recognize, by converting `obj` to a value that
        *can* (and will) be serialized by the other methods in the class.

        Note: this must not return a serialized value (i.e., string)
        directly, as that'll result in a doubly-encoded value.)r   )r   r}   s     r   rx   zJSON5Encoder.defaultN  s     s###r   r   r   r   c                    |pt                      }|                     ||          }||S |rt          d|           |                     |||          S )a  Returns an JSON5-encoded version of an arbitrary object. This can
        be used to provide customized serialization of objects. Overridden
        methods of this class should handle their custom objects and then
        fall back to super.encode() if they've been passed a normal object.

        `seen` is used for duplicate object tracking when `check_circular`
        is True.

        `level` represents the current indentation level, which increases
        by one for each recursive invocation of encode (i.e., whenever
        we're encoding the values of a dict or a list).

        May raise `TypeError` if the object is the wrong type to be
        encoded (i.e., your custom routine can't handle it either), and
        `ValueError` if there's something wrong with the value, e.g.
        a float value of NaN when `allow_nan` is false.

        If `as_key` is true, the return value should be a double-quoted string
        representation of the object, unless obj is a string that can be an
        identifier (and quote_keys is false and obj isn't a reserved word).
        If the object should not be used as a key, `TypeError` should be
        raised; that allows the base implementation to implement `skipkeys`
        properly.
        r   NzInvalid key f)rQ   _encode_basic_type	TypeError_encode_non_basic_type)r   r}   r   r   r   r2   s         r   r   zJSON5Encoder.encodeW  sk    @ }suu##C#77=H 	31C11222**3e<<<r   c                F   t          |t                    r|                     ||          S |du r|rdndS |du r|rdndS ||rd	nd
S t          |t                    r|                     ||          S t          |t
                    r|                     ||          S dS )z/Returns None if the object is not a basic type.r   Tz"true"trueFz"false"falseNz"null"null)r>   rB   _encode_strrX   _encode_intrM   _encode_floatr   r}   r   s      r   r   zJSON5Encoder._encode_basic_type  s     c3 	8##C#777
 $;;%18861%<< &399G3;%18861c3 	8##C#777c5!! 	:%%c&%999tr   c                J    t                               |          }|rd| dn|S )N")rX   __repr__)r   r}   r   r2   s       r   r   zJSON5Encoder._encode_int  s*    LL!(x1xxxxq(r   c                    |t          d          k    r
| j        }d}nW|t          d          k    r
| j        }d}n:t          j        |          r
| j        }d}nd}t                               |          }|st          d          |rd| dn|S )	NrJ   rI   z-infz	-InfinityrK   TzIllegal JSON5 value: f{obj}r   )rM   ru   mathisnanr   r1   )r   r}   r   allowedr2   s        r   r   zJSON5Encoder._encode_float  s    %,,nGAAE&MM!!nGAAZ__ 	$nGAAGs##A 	<:;;;!(x1xxxxq(r   c                    |r3|                      |          r| j        s|                     |          s|S |                     || j                  S )N)is_identifierrz   is_reserved_word_encode_quoted_strr|   r   s      r   r   zJSON5Encoder._encode_str  sd    	""3''	 O	 ))#..		 J&&sD,<===r   c                    g }d}d}d}d}|D ]}||k    r8|dz  }|t           j        t           j        fv r|                     |          }	n|}	n||k    r8|dz  }|t           j        t           j        fv r|                     |          }	nv|}	ns|dk    r|                     |          }	nWt          |          }
|
dk     r|                     |          }	n,|
dk     r|}	n#| j        s|dvr|}	n|                     |          }	|                    |	           	||k    r0|t           j        k    r | 	                    |t           j                  S ||k    r0|t           j        k    r | 	                    |t           j                  S |t           j        t           j        fv rdd	
                    |          z   dz   S dd	
                    |          z   dz   S )
z@Returns a quoted string with a minimal number of escaped quotes.r   'r      \       )u    u     )r   r   r   
_escape_chr   r   ordrs   rn   r   join)r   r}   r|   retdouble_quotes_seensingle_quotes_seensqdqch
encoded_chos              r   r   zJSON5Encoder._encode_quoted_str  s    !	# !	#BRxx #a'",,#   "&!4!4JJ!#JJr"a'",,#   "&!4!4JJ!#JJt!__R00

GGr66!%!4!4JJWW!#JJ* 5r9M/M/M!#JJ!%!4!4JJJz"""" !333z777**3
0HIII!333z777**3
0HIII:3Z5MNNN%++RWWS\\!C''r   r   c                    |dk    rdS |dk    rdS |dk    rdS |dk    rdS |d	k    rd
S |dk    rdS |dk    rdS |dk    rdS |dk    rdS |dk    rdS t          |          }|dk     rd|dS |dz
  }d|dz	  z   }d|dz  z   }d|dd|dS )z9Returns the backslash-escaped representation of the char.r   z\\r   z\'r   z\"
z\nz\r	z\tz\bz\fz\v z\0i   z\u04xi   
   i   i  )r   )r   r   r   r3   highlows         r   r   zJSON5Encoder._escape_ch  s    ::6995995::5::5::5::5::5::5::5GGu99 === 'k#e$*T*******r   c                    | j         r7t          |          }||v rt          d          |                    |           t	          |d          r+t	          |d          r|                     |||dz             }nnt	          |d          r+t	          |d          r|                     |||dz             }n3|                     |                     |          ||dz   d          }|J | j         r|	                    |           |S )NzCircular reference detected.rU   __getitem__r   __iter__Fr   )
rt   idr1   rR   hasattr_encode_dict_encode_arrayr   rx   remove)r   r}   r   r   ir2   s         r   r   z#JSON5Encoder._encode_non_basic_type  s   
  	3ADyy !?@@@HHQKKK
 3 	!GC$?$? 	!!!#tUQY77AAS-(( 	!WS*-E-E 	!""3eai88AADLL--tUQYuMMA=== 	KKNNNr   c                 j   |sdS |                      |          \  }}| j        |z   }| j        }| j        r"t	          |                                          }n|                                }d|z   }	d}
t                      }|D ]}	 |                     |||d          }n# t          $ r | j	        rY 0 w xY w| j
        s8||v rt          dt          |                     |                    |           |
rd}
n|	|z  }	|                     ||         ||d          }|	||z   |z   z  }	|	|dz   z  }	|	S )Nz{}{Tr   zduplicate key F})_spacersr   r   ry   sortedrU   rQ   r   r   rr   r)   r1   reprrR   )r   r}   r   r   
indent_strend_stritem_sepkv_seprU   r2   	first_keynew_keysrV   key_strval_strs                  r   r   zJSON5Encoder._encode_dict-  s    	4"mmE22
G&3"> 	#((**%%DD88::D*	55 	, 	,C++c4t+DD   = H
 , &h&&$%Ad3ii%A%ABBBW%%% !		Xkk#c(D%kFFG6!G++AA	Ws]s   BB42B4c                      |sdS                                 \  }} j        |z   }d|z   |                     fd|D                       z   |z   dz   S )Nz[][c              3   J   K   | ]}                     |d           V  dS )Fr   N)r   )rj   rk   r   r   r   s     r   	<genexpr>z-JSON5Encoder._encode_array.<locals>.<genexpr>_  sH        ?ABeE::     r   ])r   r   r   )r   r}   r   r   r   r   r   s   ` ``   r   r   zJSON5Encoder._encode_arrayV  s     	4"mmE22
G&3mm      EH    
  	
r   c                     | j         d}| j        rd}t          | j         t                    r:| j         dk    r'dd| j         z  |z  z   }|dd| j         z  |dz
  z  z   z  }n-d}|dz  }n%d| j         |z  z   }|d| j         |dz
  z  z   z  }nd}d}||fS )Nr   r   r   r    r   )rv   r{   r>   rX   )r   r   r   r   s       r   r   zJSON5Encoder._spacersf  s    ;"G# $+s++ 	<;??!%dk(9E(A!AJtcDK&7519&EEEGG!%JtOGG!DK%$77
4$+";;;JG7""r   rV   c                     |r%|                      |d                   s|d         dvrdS |dd         D ]}|                     |          s|dvr dS dS )aJ  Returns whether the string could be used as a legal
        EcmaScript/JavaScript identifier.

        There should normally be no reason to override this, unless
        the definition of identifiers change in later versions of the
        JSON5 spec and this implementation hasn't been updated to handle
        the changes yet.r   )$r5   Fr   NT)_is_id_start_is_id_continue)r   rV   r   s      r   r   zJSON5Encoder.is_identifierz  s     	$$SV,,	 Aj((5abb' 	 	B''++ *0D0Duutr   c                 .    t          j        |          dv S )N)LuLlLiLtLmLoNlunicodedatacategoryr   r   s     r   r   zJSON5Encoder._is_id_start  s    #B'' ,
 
 	
r   c                 .    t          j        |          dv S )N)r   r   r   r   r   r   r   NdMnMcPcr   r   s     r   r   zJSON5Encoder._is_id_continue  s    #B'' ,
 
 	
r   c                     t           /t          j        dd                    g d          z   dz             a t                               |          duS )a  Returns whether the key is a reserved word.

        There should normally be no need to override this, unless there
        have been reserved words added in later versions of the JSON5
        spec and this implementation has not yet been updated to handle
        the changes yet.N(|)-breakcasecatchclassconstcontinuedebuggerrx   deletedoelseenumexportextendsr   finallyforfunctionif
implementsimportin
instanceof	interfaceletnewr   packageprivate	protectedpublicr-   staticsuperswitchthisthrowr   trytypeofvarvoidwhilewithyieldz)$)r   recompiler   match)r   rV   s     r   r   zJSON5Encoder.is_reserved_word  sn     $
 !#
((. . .0 01d e24! 4!j !&&s++477r   )!r   r   r   r   r   boolr   r   rX   rB   r
   r   r   r   rx   r	   r   r   r   rM   r   r   r   r   r   rQ   r   r   r   r   r   r   r   r   r   r   r~   r~   %  s        !#,00426  $%)",":&' &' &' &' 	&'
 &' &' sCx)&' U38_-&' (C5#:./&' &' &' &' #&'  &' &' &' &'P$3 $3 $ $ $ $'='= '= 	'= '= 
'= '= '= '=Rc d x}    0)s )t ) ) ) ) )) )4 )C ) ) ) )$	>s 	>t 	> 	> 	> 	> 	>8(c 8(
 8(s 8( 8( 8( 8(t+S +S + + + +@ C C    4' '3 's 's ' ' ' 'R
 
C 
 
 
 
 
 
 #c #eCHo # # # #(     &	
s 	
t 	
 	
 	
 	

# 
$ 
 
 
 
B8C B8D B8 B8 B8 B8 B8 B8r   c                 @    t          t          |            d          )Nz is not JSON5 serializable)r   r   )r}   s    r   r   r     s    
tCyy<<<
=
==r   )#r  r   r*  typingr   r   r   r   r   r   r	   r
   r   r   r   json5.parserr   r   Pattern__annotations__Enumr   rB   r-  rX   r6   r8   r0   rA   rY   r   r   r   r~   r   r   r   r   <module>r4     s     				                                  +/ 8BJ' . . .$ $ $ $ $ $ $ $J #@D260459 	!%!G G G
G smG 
	G
 (GCH$5#6#;<=G (C5#:./G #,-G XseSj12G G  (5c?+,c12G G G C=G  	!G G G GZ #@D260459 	!%!; ; ;
; sm; 
	;
 (GCH$5#6#;<=; (C5#:./; #,-; XseSj12; ;  (5c?+,c12; ; ; C=; ; ; ;B #@D260459 	!%!g! g! g!
g! smg! 
	g!
 (GCH$5#6#;<=g! (C5#:./g! #,-g! XseSj12g! g!  (5c?+,c12g! g! g! C=g! g! g! g!TL L LB%*xc3h01367%* %* %* %*X *.(,,0.2 !%(6!/ / /	/
/ 	/
 / / / 
$~&	'/ U38_%/ sCx)/ hucz*+/ / / / /  !/ / / /j *.(,,0.2 !%(6l> l> l>	l> l> 	l>
 l> l> 
$~&	'l> U38_%l> sCx)l> hucz*+l> l> l> l> l> l> l> l> l>^D8 D8 D8 D8 D8 D8 D8 D8N>c > > > > > >r   