f0 dZddlZddlmZ ddlmZddgZejejzejzZ e dZe dZe d ZGd deZeeed Zej(d e Zd ddddddddZdZdeej0fdZexseZej(de ZdZdej0efdZej0efdZGddeZy#e$rdZYwxYw)zImplementation of JSONDecoder N)scanner) scanstring JSONDecoderJSONDecodeErrornaninfz-infceZdZdZdZdZy)ra Subclass of ValueError with the following additional properties: msg: The unformatted error message doc: The JSON document being parsed pos: The start index of doc where parsing failed lineno: The line corresponding to pos colno: The column corresponding to pos c|jdd|dz}||jdd|z }d||||fz}tj||||_||_||_||_||_y)N rz%s: line %d column %d (char %d)) countrfind ValueError__init__msgdocposlinenocolno)selfrrrrrerrmsgs #/usr/lib/python3.12/json/decoder.pyrzJSONDecodeError.__init__sv4C(1,ciia--2c65#5NND&)  c`|j|j|j|jffS)N) __class__rrr)rs r __reduce__zJSONDecodeError.__reduce__*s$~~$((DHH===rN)__name__ __module__ __qualname____doc__rrrrrrs >r)z -InfinityInfinityNaNz(.*?)(["\\\x00-\x1f])"\/ r   )r$r%r&bfnrtc||dz|dz}t|dk(r|ddvr t|dSd}t|||#t$rYwxYw)Nr xXzInvalid \uXXXX escape)lenintrr)srescrs r _decode_uXXXXr9;sg C!GC!G C 3x1}Qt+ sB<  #C #q# &&   s = A A Tcg}|j}|dz } |||}| td|||j}|j\} } | r|| | dk(rn| dk7r)|rdj | } t| |||| z ||} | dk7r || } |dz }nht||}|d z }d |cxkrd krAnn>|||d zd k(r3t||dz}d|cxkrdkrnnd|d z dz|dz zz}|dz }t|} || dj||fS#t $rtd||dwxYw#t $rdj | } t| ||wxYw)aScan the string s for a JSON string. End is the index of the character in s after the quote that started the JSON string. Unescapes all valid JSON string escape sequences and raises ValueError on attempt to decode an invalid string. If strict is False then literal control characters are allowed in the string. Returns a tuple of the decoded string and the index of the character in s after the end quote.r NzUnterminated string starting atr$r%z"Invalid control character {0!r} atuzInvalid \escape: {0!r}r1iiz\uiii ) appendrendgroupsformat IndexErrorKeyErrorr9chrjoin)r7rAstrict_b_mchunks_appendbeginchunkcontent terminatorrr8charuniuni2s r py_scanstringrTEsFmmG !GE 1c  =!"CQN Niik#lln  G     4 :AA*M%c1c22 # 6C&C #: 3#w 1HC3'C 1HC&&1Sq>U+B$Qa0T+V+!sV|&:tf}%MNC1HCs8D W X 776?C + 6!"C"#U,15 6 6 3/66s;%c1c22 3sD*E*E(E-z [ \t\n\r]*z cL|\}} g} | j} |i}|j} || | dz} | dk7r^| |vr||| j} || | dz} | dk(r$||| }|| dzfSi} ||| } | | dzfS| dk7r td|| | dz } t || |\}} | ||}|| | dzdk7r/||| j} || | dzdk7r td|| | dz } || |vr&| dz } || |vr||| dzj} ||| \}} | ||f || } | |vr||| dzj} || } | dz } | dk(rnP| d k7rtd || dz ||| j} || | dz} | dz } | dk7rtd|| dz !| || }|| fSt| } ||| } | | fS#t $rYwxYw#t $r}td||jdd}~wwxYw#t $rd} YwxYw) Nr r$}z1Expecting property name enclosed in double quotes:zExpecting ':' delimiterExpecting valuer?,Expecting ',' delimiter) r@ setdefaultrArrrD StopIterationvaluedict) s_and_endrH scan_once object_hookobject_pairs_hookmemo_w_wsr7rApairs pairs_appendmemo_getnextcharresultkeyr]errs r JSONObjectrms FAs E< ! _!CQM M1HC af-SsC  Sq>S Q*.."CS1W~$%&?CHH q v}qS6S=Qa.,,.C M"1c*JE3 c5\" vH3C!Gn((*S6 q s?  _!";QaH HCjnnSq> q s?!CQaQ QS V$"5)s{ KEE" #:C     M!"3Q B L M H s<.-G G,3(H G)(G), H5H  H H#"H#c:|\}}g}|||dz}||vr"|||dzj}|||dz}|dk(r||dzfS|j} |||\} }|| |||dz}||vr"|||dzj}|||dz}|dz }|dk(r ||fS|dk7rtd||dz  |||vr&|dz }|||vr|||dzj}#t$r} td|| jdd} ~ wwxYw#t $rY5wxYw)Nr ]rXrYrZ)rAr@r\rr]rD) r_r`rdrer7rAvaluesrirLr]rls r JSONArrayrqs FAs FS1W~H3C!Gn  "Sq>3sQwmmG  M"1c*JE3 Sq> s?Qa.$$&CS1W~H q s?  3;_!";QaH H v}qS6S=Qa.,,.C'  M!"3Q B L M"   s* C%7-D% D .DD  DDcLeZdZdZddddddddZej fdZddZy) raSimple JSON decoder Performs the following translations in decoding by default: +---------------+-------------------+ | JSON | Python | +===============+===================+ | object | dict | +---------------+-------------------+ | array | list | +---------------+-------------------+ | string | str | +---------------+-------------------+ | number (int) | int | +---------------+-------------------+ | number (real) | float | +---------------+-------------------+ | true | True | +---------------+-------------------+ | false | False | +---------------+-------------------+ | null | None | +---------------+-------------------+ It also understands ``NaN``, ``Infinity``, and ``-Infinity`` as their corresponding ``float`` values, which is outside the JSON spec. NT)ra parse_float parse_intparse_constantrHrbc ||_|xst|_|xst|_|xst j |_||_||_ t|_ t|_ t|_i|_t#j$||_y)a``object_hook``, if specified, will be called with the result of every JSON object decoded and its return value will be used in place of the given ``dict``. This can be used to provide custom deserializations (e.g. to support JSON-RPC class hinting). ``object_pairs_hook``, if specified will be called with the result of every JSON object decoded with an ordered list of pairs. The return value of ``object_pairs_hook`` will be used instead of the ``dict``. This feature can be used to implement custom decoders. If ``object_hook`` is also defined, the ``object_pairs_hook`` takes priority. ``parse_float``, if specified, will be called with the string of every JSON float to be decoded. By default this is equivalent to float(num_str). This can be used to use another datatype or parser for JSON floats (e.g. decimal.Decimal). ``parse_int``, if specified, will be called with the string of every JSON int to be decoded. By default this is equivalent to int(num_str). This can be used to use another datatype or parser for JSON integers (e.g. float). ``parse_constant``, if specified, will be called with one of the following strings: -Infinity, Infinity, NaN. This can be used to raise an exception if invalid JSON numbers are encountered. If ``strict`` is false (true is the default), then control characters will be allowed inside strings. Control characters in this context are those with character codes in the 0-31 range, including ``'\t'`` (tab), ``'\n'``, ``'\r'`` and ``'\0'``. N)rafloatrsr6rt _CONSTANTS __getitem__rurHrbrm parse_objectrq parse_arrayr parse_stringrcr make_scannerr`)rrarsrtrurHrbs rrzJSONDecoder.__init__syF'&/%")c,F 0F0F !2&$&  --d3rc|j|||dj\}}|||j}|t|k7r td|||S)zlReturn the Python representation of ``s`` (a ``str`` instance containing a JSON document). r)idxz Extra data) raw_decoderAr5r)rr7rdobjrAs rdecodezJSONDecoder.decodeLsW ??1"Q(,,.?9SCjnn #a&=!,37 7 rc |j||\}}||fS#t$r}td||jdd}~wwxYw)a=Decode a JSON document from ``s`` (a ``str`` beginning with a JSON document) and return a 2-tuple of the Python representation and the index in ``s`` where the document ended. This can be used to decode a JSON document from a string that may have extraneous data at the end. rXN)r`r\rr])rr7rrrArls rrzJSONDecoder.raw_decodeWsQ M~~a-HCCx M!"3Q B L Ms A<A)r) rrrr r WHITESPACEmatchrrr!rrrrs3:'+4"-4`&++  r) r rejsonr_jsonr c_scanstring ImportError__all__VERBOSE MULTILINEDOTALLFLAGSrwr#PosInfNegInfrrrxcompile STRINGCHUNK BACKSLASHr9rrTrWHITESPACE_STRrmrqobjectrr!rrrs3 0 + , R\\!BII- El u v>j>6  bjj159 Ds Dt$T  '"& **9 z *] RZZ u - Z-->Ob(2'7'7^"Jf&fmLsC!!C+*C+