Viewing File: /opt/imunify360/venv/lib/python3.11/site-packages/simplejson/__pycache__/encoder.cpython-311.pyc



]jw(dZddlmZddlZddlmZddlZddlZddlm	Z	m
Z
mZmZm
Z
ejdkZdZe\ZZZdd	lmZdd
lmZejdZejdZejd
ZddddddddZedD]%Zee edefz&[e!Z"ejdkre#e$fZ%ne#Z%e
dfdZ&e
fdZ'epe'Z(epe&Z)Gdde*Z+Gdde+Z,e
e-ede#e%e.e/ee0e1e2e3e4fd Z5dS)!zImplementation of JSONEncoder
)absolute_importN)
itemgetter)binary_type	text_typestring_types
integer_typesPY3)cZ	ddlm}|j|j|jfS#t
$rYdSwxYw)Nr	_speedups)NNN)rencode_basestring_asciiencode_basestringmake_encoderImportErrorrs t/builddir/build/BUILD/imunify360-venv-2.6.3/opt/imunify360/venv/lib64/python3.11/site-packages/simplejson/encoder.py_import_speedupsrs[ 1+&(	(    s
**)PosInf)RawJSONz[\x00-\x1f\\"]z([\\"]|[^\ -~])z[\x80-\xff]z\\z\"z\bz\fz\nz\rz\t)\"

	 \u%04x)rrcV|rWt|trt|d}nt|turt|}nt|tr+t
|t|d}nmt|ttfvrPt|trt|}n t|d}d}|t
||z|zS)z5Return a JSON representation of a Python string

    utf-8NrcBt|dS)Nr)
ESCAPE_DCTgroup)matchs rreplacez%py_encode_basestring.<locals>.replaceKs%++a..)))
isinstancebytesstrtype__str__HAS_UTF8searchunicode__getnewargs__ESCAPEsub)s_PY3_qr)s    rpy_encode_basestringr95s1a	AwAA
!WWC

AAa		1(//!"4"4"@7##AA
!WWS'N
*
*!S!!
1KKNN**1--a0***


7A&&&++r*cp|rWt|trt|d}nt|turt|}nt|tr+t
|t|d}nmt|ttfvrPt|trt|}n t|d}d}dtt
||zdzS)zAReturn an ASCII-only JSON representation of a Python string

    r$Nrc|d}	t|S#t$r?t|}|dkrd|fzcYS|dz}d|dz	dzz}d|dzz}d||fzcYSwxYw)	Nrir!i
iiz\u%04x\u%04x)r'r&KeyErrorord)r(r6ns1s2s     rr)z+py_encode_basestring_ascii.<locals>.replacefsKKNN	3a= 		3		3		3AA7{{ A4''''WR501q5y)'2r(2222		3s$%A-A-,A-r)r+r,r-r.r/r0r1r2r3ESCAPE_ASCIIr5)r6r7r)s   rpy_encode_basestring_asciirCPs1a	AwAA
!WWC

AAa		1(//!"4"4"@7##AA
!WWS'N
*
*!S!!
1KKNN**1--a0
3
3
3\%%gq11222S88r*cBeZdZdZdZdZ							ddZd	Zd
ZdZ	dS)
JSONEncoderaZExtensible JSON <http://json.org> encoder for Python data structures.

    Supports the following objects and types by default:

    +-------------------+---------------+
    | Python            | JSON          |
    +===================+===============+
    | dict, namedtuple  | object        |
    +-------------------+---------------+
    | list, tuple       | array         |
    +-------------------+---------------+
    | str, unicode      | string        |
    +-------------------+---------------+
    | int, long, float  | number        |
    +-------------------+---------------+
    | True              | true          |
    +-------------------+---------------+
    | False             | false         |
    +-------------------+---------------+
    | None              | null          |
    +-------------------+---------------+

    To extend this to recognize other objects, subclass and implement a
    ``.default()`` method with another method that returns a serializable
    object for ``o`` if possible, otherwise it should call the superclass
    implementation (to raise ``TypeError``).

    z, z: FTNr$cf||_||_||_||_||_|
|_||_||_||_|
|_	||_
||_||_||_
|t|ts|dz}||_||\|_|_n	|d|_|	|	|_||_dS)aConstructor for JSONEncoder, with sensible defaults.

        If skipkeys is false, then it is a TypeError to attempt
        encoding of keys that are not str, int, long, float or None.  If
        skipkeys is True, such items are simply skipped.

        If ensure_ascii is true, the output is guaranteed to be str
        objects with all incoming unicode characters escaped.  If
        ensure_ascii is false, the output will be unicode object.

        If check_circular is true, then lists, dicts, and custom encoded
        objects will be checked for circular references during encoding to
        prevent an infinite recursion (which would cause an OverflowError).
        Otherwise, no such check takes place.

        If allow_nan is true (default: False), then out of range float
        values (nan, inf, -inf) will be serialized to
        their JavaScript equivalents (NaN, Infinity, -Infinity)
        instead of raising a ValueError. See
        ignore_nan for ECMA-262 compliant behavior.

        If sort_keys is true, then the output of dictionaries will be
        sorted by key; this is useful for regression tests to ensure
        that JSON serializations can be compared on a day-to-day basis.

        If indent is a string, then JSON array elements and object members
        will be pretty-printed with a newline followed by that string repeated
        for each level of nesting. ``None`` (the default) selects the most compact
        representation without any newlines. For backwards compatibility with
        versions of simplejson earlier than 2.1.0, an integer is also accepted
        and is converted to a string with that many spaces.

        If specified, separators should be an (item_separator, key_separator)
        tuple.  The default is (', ', ': ') if *indent* is ``None`` and
        (',', ': ') otherwise.  To get the most compact JSON representation,
        you should specify (',', ':') to eliminate whitespace.

        If specified, default is a function that gets called for objects
        that can't otherwise be serialized.  It should return a JSON encodable
        version of the object or raise a ``TypeError``.

        If encoding is not None, then all input strings will be
        transformed into unicode using that encoding prior to JSON-encoding.
        The default is UTF-8.

        If use_decimal is true (default: ``True``), ``decimal.Decimal`` will
        be supported directly by the encoder. For the inverse, decode JSON
        with ``parse_float=decimal.Decimal``.

        If namedtuple_as_object is true (the default), objects with
        ``_asdict()`` methods will be encoded as JSON objects.

        If tuple_as_array is true (the default), tuple (and subclasses) will
        be encoded as JSON arrays.

        If *iterable_as_array* is true (default: ``False``),
        any object not in the above table that implements ``__iter__()``
        will be encoded as a JSON array.

        If bigint_as_string is true (not the default), ints 2**53 and higher
        or lower than -2**53 will be encoded as strings. This is to avoid the
        rounding that happens in Javascript otherwise.

        If int_as_string_bitcount is a positive number (n), then int of size
        greater than or equal to 2**n or lower than or equal to -2**n will be
        encoded as strings.

        If specified, item_sort_key is a callable used to sort the items in
        each dictionary. This is useful if you want to sort items other than
        in alphabetical order by key.

        If for_json is true (not the default), objects with a ``for_json()``
        method will use the return value of that method for encoding as JSON
        instead of the object.

        If *ignore_nan* is true (default: ``False``), then out of range
        :class:`float` values (``nan``, ``inf``, ``-inf``) will be serialized
        as ``null`` in compliance with the ECMA-262 specification. If true,
        this will override *allow_nan*.

        N ,)skipkeysensure_asciicheck_circular	allow_nan	sort_keysuse_decimalnamedtuple_as_objecttuple_as_arrayiterable_as_arraybigint_as_string
item_sort_keyfor_json
ignore_nanint_as_string_bitcountr+rindentitem_separator
key_separatordefaultencoding)selfrIrJrKrLrMrW
separatorsr[rZrNrOrPrRrSrTrUrVrQs                   r__init__zJSONEncoder.__init__sr!
(,""&$8!,!2 0* 
$&<#j&F&Fc\F!6@3D!3!3

"%D"DL 


r*c:td|jjz)a$Implement this method in a subclass such that it returns
        a serializable object for ``o``, or calls the base implementation
        (to raise a ``TypeError``).

        For example, to support arbitrary iterators, you could
        implement default like this::

            def default(self, o):
                try:
                    iterable = iter(o)
                except TypeError:
                    pass
                else:
                    return list(iterable)
                return JSONEncoder.default(self, o)

        z*Object of type %s is not JSON serializable)	TypeError	__class____name__)r\os  rrZzJSONEncoder.defaults&$D,-..	.r*ct|tr|j}||dkst||}t|tr%|jrt
|St|S||}t|ttfst|}|jrd|Sd|S)zReturn a JSON string representation of a Python data structure.

        >>> from simplejson import JSONEncoder
        >>> JSONEncoder().encode({"foo": ["bar", "baz"]})
        '{"foo": ["bar", "baz"]}'

        Nr$r)r+rr[rrrJrr
iterencodelisttuplejoin)r\rc	_encodingchunkss    rencodezJSONEncoder.encode$sa%%	,
I%yG/C/Ca++a&&	, 
,.q111(+++##&4-00	"&\\F	$776??"88F###r*c4|jri}nd}|jrt}nt}|jdkr|j||jfd}|j|jtttfd}i}|j	rdn|j
}txt||j||j
|j|j|j|j|j||j|j|j||j|j|j|jt.j|j}nlt5||j||j
||j|j|j|j|j|j|j||j|j|j|jt.j}	||d|S#|wxYw)zEncode the given object and yield each string
        representation as available.

        For example::

            for chunk in JSONEncoder().iterencode(bigobject):
                mysocket.write(chunk)

        Nr$cbt|trt||}||SN)r+rr)rc
_orig_encoderris   r_encoderz(JSONEncoder.iterencode.<locals>._encoderTs3a--0!!Y//A$}Q'''r*c||krd}nD||krd}n;||krd}n2t|tkrt|}||S|rd}n!|stdt|z|S)NNaNInfinityz	-Infinitynullz2Out of range float values are not JSON compliant: )r.float
ValueErrorrepr)rcrLrU_repr_inf_neginftexts       rfloatstrz(JSONEncoder.iterencode.<locals>.floatstrYsAvvd!g"77e##aAuQxx

 HGGKr*5)Decimalr)rKrJrrr[rLrU
FLOAT_REPRrrRrVc_make_encoderrZrWrYrXrMrIrNrOrPrSrTdecimalr~rQ_make_iterencodeclear)r\rcmarkersrpr|key_memorV_iterencodes        rrezJSONEncoder.iterencodeAs	GGG	).HH(H=G##
(A*2dm
(
(
(
(
#'.T_ vw				6'HBBT-H	%(x"D$7
t~x9I)4+>&"DM4=$2HJJKK+xh"D$7
t/)4+>&"DM4=&AAAK	;q!$$NNHNNs!FF)FTTFFNNr$NTTTFNFFNF)
rb
__module____qualname____doc__rXrYr^rZrkrer*rrErE}s8NM48AFIM8<7<@E@E
p!p!p!p!d...*$$$:KKKKKr*rEc(eZdZdZdZfdZxZS)JSONEncoderForHTMLa3An encoder that produces JSON safe to embed in HTML.

    To embed JSON content in, say, a script tag on a web page, the
    characters &, < and > should be escaped. They cannot be escaped
    with the usual entities (e.g. &amp;) because they are not expanded
    within <script> tags.

    This class also escapes the line separator and paragraph separator
    characters U+2028 and U+2029, irrespective of the ensure_ascii setting,
    as these characters are not valid in JavaScript strings (see
    http://timelessrepo.com/json-isnt-a-javascript-subset).
    c||}|jrd|Sd|S)Nr)rerJrh)r\rcrjs   rrkzJSONEncoderForHTML.encodesB##	$776??"88F###r*c#XKtt||}|D]{}|dd}|dd}|dd}|js,|dd}|d	d
}|V|dS)N&z\u0026<z\u003c>z\u003eu
z\u2028u
z\u2029)superrrer)rJ)r\rcrjchunkras    rrezJSONEncoderForHTML.iterencodes)400;;A>>				EMM#y11EMM#y11EMM#y11E$
<

i;;

i;;KKKK				r*)rbrrrrkre
__classcell__)ras@rrrsQ$$$r*rc	

 !"#$	rtj
rt
std|r
st	d
!dksstdd$fd !"
	$fd"	fd#
 !"
#	$fd! !"
	$fd	  S)
Nz&item_sort_key must be None or callablerz1int_as_string_bitcount must be a positive integerc~t||d}t|r	|fS#t$rYnwxYwdSrn)getattrcallabler`)objmethod_namemethods   rcall_methodz%_make_iterencode.<locals>.call_methods[k400F	
{"



ts
-
::cdupdk}t|vrt|}|sdz|cxkr	dzkrnn|Sd|zdzS)Nrr)r.int)valueskip_quoting_int_as_string_bitcountr	r-s  r_encode_intz%_make_iterencode.<locals>._encode_ints#t+
(#a'	
;;m++JJE	
*
*
+
+
+
+
)
)
+
+
+
+
+3u::SSZZ#%%r*c34K|sdVdS'#|}|'vrd|'|<d}|dz
}d|zz}|z}||z
}nd}}d}t|D]\}}|rd}n|}	%|)r||zVnr%%|tr||zVn|%|tr||jzVn]|	|dzVnR|dur	|d	zVnE|dur	|d
zVn8%|$r||zVn%|"r||zVnr%|r|(|zVn|Vo |d}	|	r|	d|}
no |d
}|rE|d}%|!s$t	dt|j||}
nY%|&r
||}
n@r%|*r
||}
n%%|r
||}
n||}
|
D]}
|
V#t$r9}tr,|	dt|j|fzd}~wwxYw|rdVn||dz}d|zzVdV''|=dSdS)Nz[]Circular reference detected[rrTFrttruefalserTr_asdict"_asdict() must return a dict, not zwhen serializing %s item %d])
	enumerater,rencoded_jsonr`r.rb
BaseException
_HAS_ADD_NOTEadd_note)+lst_current_indent_levelmarkeridbufnewline_indent	separatorfirstirrTrjrdctrexcr~rvr7_dict_typesrrpri	_floatstr	_for_json_indent_item_separatorr_iterencode_dict_iterencode_list_namedtuple_as_object_tuple_as_array_use_decimalrdictruidr	r+rfrr-rrgs+               rrz*_make_iterencode.<locals>._iterencode_lists	JJJFr#wwH7"" j!>??? #GH!Q&!!W/D%DEN'.8I>!CC!N'I!#4	4	HAu
 /
:e\22($/////&$jj66&$9;P/////Zw//$$ 222222],&&&&d]],&&&&e^^-''''Z}55$E 2 222222Zu--$		% 0 000000!$jj&@&@$E

*****III(K[[
-K-KHO!,Xa[:O!P!P"7"YKKy<Y<Y"
O")!*C#-:c4#8#8p&/iZ^_bZcZcZlZl0n&o&o o%5%5c6K&M&MFF'Zt44O%5%5e=R%S%SFF,OE51I1IO%5%5e=R%S%SFF'Z{;;O%5%5e=R%S%SFF%0[8M%N%NF!'$$# 


 3LL599-q12333
	JJJJ)%*%g(==>>>>III!!!s,GH//
I294I--I2c	|rnr 	|tr

|}n	|r|}n|durd}n|durd}nx|d}ns	|r,t|vrt|}
|}n;r	|r
|}n!rd}ntd|jjz|S)NTrFrrtz2keys must be str, int, float, bool or None, not %s)r,r.rr`rarb)keyr~r7rir	_skipkeysrrur	r+r-rs r_stringify_keyz(_make_iterencode.<locals>._stringify_keyDs=:c<((	?
	?jje,,	?1F#c9%%CC
ZU
#
#	?)C..CC
D[[CC
E\\CC
[CC
Z]
+
+	?Cyy
--#hh#c((CC
	?jjg66	?#c((CC
	?CC%'*}'=>??
?
r*c3VK|sdVdS,(|}|,vrd|,|<dV|dz
}d|zz}|z}|Vnd}}d}r|}n|}rdg}|D]6\}}	*|.s"|}||||	f7|n|}|D]&\}
}s*|
.s"|
}
|
"|rd}n|V|
V V	*|.r|Vnr"*|tr|Vnc*|t
r|jVnG|d	Vn?|durd
Vn5|durdVn+*|)r|Vn*|'r|Vn$r*|r-|Vnډo%|d}|r|d
|}
n!o%|d}|rE|d
}*|&s$tdt|j	||}
nY*|+r
||}
n@#r*|/r
||}
n%*|r
||}
n||}
|
D]}|V#t$r:}tr-|dt|j	d|
d}~wwxYw||dz}d|zzVdV,,|=dSdS)Nz{}r{rrT)rFrtrrrTrrrzwhen serializing z item })
items	iteritemsappendsortr,rrr`r.rbrrr)0rrrrrXrrrkvrrrTrjrrrr~rvr7rrrprirrrr_item_sort_keyrrr_key_separatorrrrrrrrurr	r+rfrr-rrgs0                 rrz*_make_iterencode.<locals>._iterencode_dict_s8	JJJFr#wwH7"" j!>??? #GH			!Q&!!W/D%DEN,~=N     !N,N	(		II

I
	E		
%
%1!z!\22!&q))Ay aV$$$$JJ>J****E:	:	JC"
jjl&C&C
$nS));
%$$$$(3--    .
:e\22'$"(5//))))%$jj66%$9;P"(5//))))Zw//#$,,,,,] LLLLd]] LLLLe^^!MMMMZ}55$%+e,,,,,,Zu--$#)E******!$jj&@&@$#e**$$$$(K[[
-K-KHO!,Xa[:O!P!P"7"YKKy<Y<Y"
O")!*C#-:c4#8#8p&/iZ^_bZcZcZlZl0n&o&o o%5%5c6K&M&MFF'Zt44O%5%5e=R%S%SFF,OE51I1IO%5%5e=R%S%SFF'Z{;;O%5%5e=R%S%SFF%0[8M%N%NF!'$$# 


 5LLL99---ss4555
%!Q&!'$99::::			!!!s"F"K
L
5LL
c3K|#r|VdS
r"|tr|VdS|tr|jVdS|dVdS|durdVdS|durdVdS|r
|VdS|r|VdSo|d}|r|d|D]}|VdSo|d}|rM|d}|s$td	t	|j||D]}|VdS| r||D]}|VdSr!|$r||D]}|VdS|r||D]}|VdSr|r"|VdSr2	|}n#t$rYnwxYw||D]}|VdS!|}|!vr	d
|!|<	|}||D]}|VnD#t$r7}tr*|dt	|jzd}~wwxYw!!|=dSdS)NrtTrFrrTrrrrzwhen serializing %s object)	r,rrr`r.rbrrr)%rcrrTrrrrrr~rvr7_defaultrrrprirr_iterable_as_arrayrrrrrrrrrurr	r+iterrfrr-rrgs%        rrz%_make_iterencode.<locals>._iterencodesw:a&&C	.(1++
A	.jjE**A	.y/D(1++
Z7
#
#?	..     
YLLLLL
$YYLLLLL
%ZZMMMMM
Z=
)
)7	.+a..     
Z5
!
!5	.)A,, ?[[J%?%?H1
.([!6KLL  EKKKK  0MKK94M4M,.!!*C%:c400h'iRVWZR[R[RdRd(fggg!1!1#7L!M!M$$#$$Z4((&.!1!1!5J!K!K$$#$$%#.**Q*>*>#.!1!1!5J!K!K$$#$$Z;// .!1!1!5J!K!K$$#$$!.jjG&<&<.#a&&LLLLL,	" $QAA("""!E"%5%5a9N%O%O((E"'KKKK*#%2a55#w..",*-J"K"KK,-)	$HQKK%0[4I%J%J((E"'KKKK(((4LL <"&q''"2!3444*#H---+*s*>G


GGH00
I1:2I,,I1)rr~rr`r)%rrrprrrr
_sort_keysrrrrrrrirrr7rvrr~rrrurr	r+rfr-rgrrrrrrrs%``````` ```````````````````````@@@@@@rrrs,"/'h~66'@AAA	'N'#A+	 A	%	%
Z/
?
?
&KLLL&&&&&&&$Q"Q"Q"Q"Q"Q"Q"Q"Q"Q"Q"Q"Q"Q"Q"Q"Q"Q"Q"Q"Q"Q"Q"Q"Q"Q"Q"Q"Q"Q"Q"Q"f6b"b"b"b"b"b"b"b"b"b"b"b"b"b"b"b"b"b"b"b"b"b"b"b"b"b"b"b"b"b"b"b"b"b"b"HD.D.D.D.D.D.D.D.D.D.D.D.D.D.D.D.D.D.D.D.D.D.D.D.D.D.D.D.D.D.D.D.D.Lr*)6r
__future__rreoperatorrrsyscompatrrrr	r
version_inforrc_encode_basestring_asciic_encode_basestringrdecoderrraw_jsonrcompiler4rBr0r&ranger
setdefaultchrrwrr
frozendictrr9rCrrobjectrErrvrurr+rfr-rgrrrr*r<module>rs&&&&&&				



LLLLLLLLLLLLLL G+
   ?.	%	&	&rz,--2:n%%
	






t44A##a&&)qd"23333

w$KKK!$,,,,6(+$9$9$9$9P;!;//OOOOO&OOOd""""""""X!

#

)UUUUUUr*
Back to Directory File Manager