QfgX HddlmZddlmZddlZddlmZddlmZm Z m Z ddl m Z m Z mZmZmZmZddlmZmZmZed ed Deed zZeed z Zeed z ZeZeZeZedZeedzZ eejBejDzdzZ#e#edzZ$eejJZ&edd ddddddZ'Gdde(Z)e*ddd#Z0 d?d$Z1d@d%Z2d@d&Z3dAd'Z4dAd(Z5 dBd)Z6 dCd*Z7dDd+Z8dEd,Z9dEd-Z:dFd.Z;dGd/ZdId4Z?dEd5Z@dJd6ZAdHd7ZB dKd8ZCdLd9ZDdMd:ZEdNd;ZFy)O) annotations)IterableN)MappingProxyType)AnyBinaryIO NamedTuple) RE_DATETIME RE_LOCALTIME RE_NUMBERmatch_to_datetimematch_to_localtimematch_to_number)Key ParseFloatPosc#2K|]}t|ywN)chr).0is 6/opt/alt/python312/lib64/python3.12/tomllib/_parser.py rs1y!s1vys  z z  z-_z"'  "\)z\bz\tz\nz\fz\rz\"z\\c eZdZy)TOMLDecodeErrorN)__name__ __module__ __qualname__rr$r$5s:r)r$ parse_floatc |j} |j}t ||S#t$r tddwxYw)NzEFile must be opened in binary mode, e.g. use `open('foo.toml', 'rb')`r*)readdecodeAttributeError TypeErrorloads)fpr+bss rloadr59sS/  A HHJ  ,,  S  s 0Ac |jdd}d}ttt}d}t |} t ||t } ||}|dk(r|dz }#|tvr!t|||||}t ||t }nr|dk(r[ ||dz}|jj|dk(rt|||\}}nt|||\}}t ||t }n|dk7r t||dt||} ||}|dk7r t||d |dz }#t$rY|j j"SwxYw#t$rd}YwxYw#t$rY|j j"SwxYw) Nz rrr(r [#zInvalid statementz5Expected newline or end of document after a statement)replaceOutput NestedDictFlagsmake_safe_parse_float skip_charsTOML_WS IndexErrorKEY_INITIAL_CHARSkey_value_ruleflagsfinalize_pendingcreate_list_rulecreate_dict_rule suffixed_err skip_commentdatadict)r4r+srcposoutheaderchar second_chars rr1r1Es# ))FD !C C uw 'CF' 4K c7+ s8D 4< 1HC  $ $ c3 DCS#w/C S[ #*-cAg,  II & & (c!.sC= V.sC= VS#w/C S[sC)<= =3$ s8D 4<SQ  qa   F 88==I  #"  #"   88== s6D'E E' EE EE E=<E=cFeZdZ dZdZd dZd dZd dZd dZd dZ ddZ y )r<rr c0i|_t|_yr)_flagsset_pending_flagsselfs r__init__zFlags.__init__s') 47Er)c>|jj||fyr)rUaddrWkeyflags r add_pendingzFlags.add_pendings d ,r)c|jD]\}}|j||d|jjy)NF recursive)rUrTclearr[s rrDzFlags.finalize_pendings:,,IC HHS$%H 0- !!#r)cv|j}|ddD]}||vry||d}|j|ddy)Nnested)rSpop)rWr\contks r unset_allzFlags.unset_allsG{{SbA}78$D R$r)c|j}|dd|d}}|D]'}||vrttid||<||d})||vrttid||<|||rdndj|y)Nrd)rCrecursive_flagsrererkrC)rSrTrZ)rWr\r]rarg key_parentkey_stemrhs rrTz Flags.sets{{"3BxRH A}$'EcerRQ78$D 4 '*uRTUDN XI(7CGGMr)c|sy|j}|ddD]}||vry||}||dvry|d}|d}||vr||}||dvxs||dvSy)NFrdrkTrerC)rS)rWr\r]rgrh inner_contrms ris_z Flags.is_s{{SbA}aJz"344h'D r7 t >D4=(KDD9J4K,K Kr)NreturnNone)r\rr]intrrrsr\rrrrs)r\rr]rtraboolrrrs)r\rr]rtrrrv) r%r&r'FROZEN EXPLICIT_NESTrXr^rDrirTrpr(r)rr<r<s23FM:-$   Nr)r<c4eZdZddZdd ddZd dZy) r;ci|_yr)rJrVs rrXzNestedDict.__init__s $& r)T access_listsc|j}|D]B}||vri||<||}|rt|tr|d}t|tr9td|S)Nrdz There is no nest behind this key)rJ isinstancelistKeyError)rWr\r|rgrhs rget_or_create_nestzNestedDict.get_or_create_nestsb IIA}Q7D 4 6BxdD)ABB r)c|j|dd}|d}||vr2||}t|ts td|j iyig||<y)Nrdz/An object other than list found behind this key)rr~rrappend)rWr\rglast_keylist_s rappend_nest_to_listzNestedDict.append_nest_to_lists_&&s3Bx0r7 t NEeT*PQQ LL  TDNr)Nrq)r\rr|rvrrrJru)r%r&r'rXrrr(r)rr;r;s2'"     " "r)r;c"eZdZUded<ded<y)r:r;rIr<rCN)r%r&r'__annotations__r(r)rr:r:s  Lr)r:cP |||vr |dz }|||vr |S#t$rY|SwxYw)Nr )r@)rKrLcharss rr>r>sJ #h% 1HC#h% J   J s  %%c |j||}|j |||s'|||vr |dz }|||vr t||d|||S#t$r!t|}|rt||d|dYfwxYw)Nz Expected r zFound invalid character )index ValueErrorlenrG isdisjoint)rKrLexpecterror_on error_on_eofnew_poss r skip_untilrsO))FC(   s3w/ 0#hh& 1HC#hh&3'?C|%LMM N Oc( sGy -CD$ N OsA'A;:A;cl ||}|dk(rt||dzdtdS|S#t$rd}Y+wxYw)Nr8r rFrr)r@rILLEGAL_COMMENT_CHARS)rKrLrOs rrHrHsSs8 s{ q$)>U   J s % 33cR |}t||t}t||}||k(r|S'r)r>TOML_WS_AND_NEWLINErH)rKrLpos_before_skips rskip_comments_and_array_wsrs7 c#673$ / !J r)c(|dz }t||t}t||\}}|jj |t j s*|jj |t jrt||d|d|jj|t j d |jj||jd|s t||d|dz|fS#t$rt||ddwxYw) Nr zCannot declare z twiceFr`Cannot overwrite a value]z.Expected ']' at the end of a table declaration)r>r? parse_keyrCrpr<rxrwrGrTrIrr startswithrKrLrMr\s rrFrFs1HC S#w 'Cc"HC yy}}S%--.#))--U\\2R3se6%BCCIIMM#u**eM<K ##C( >>#s #3%UVV 7C< K3%?@dJKs 8C99Dc|dz }t||t}t||\}}|jj |t j rt||d||jj||jj|t jd |jj||jd|s t||d|dz|fS#t$rt||ddwxYw)N"Cannot mutate immutable namespace Fr`rz]]z0Expected ']]' at the end of an array declaration)r>r?rrCrpr<rwrGrirTrxrIrrrrs rrErE.s1HC S#w 'Cc"HC yy}}S%,,'3'I#%OPPIIIIMM#u**eM<K $$S) >>$ $3%WXX 7C< K3%?@dJKs (C))Dc t|||\} } dd d}}|z} fdtdt D} | D]f} |jj | t j rt||d| |jj| t j h|jj |t jrt||d| |jj|} || vr t||dt|ttfr/|jj! zt jd|| |<|S#t$rt||ddwxYw) Nrdc3.K|] }d|zywrr()rrrNr\s rrz!key_value_rule..JsL9KAvBQ/9Ksr zCannot redefine namespace rrTr`)parse_key_value_pairrangerrCrpr<rxrGr^rwrIrrr~rJrrT) rKrLrMrNr+valuerlrmabs_key_parentrelative_path_cont_keyscont_keynestr\s ` @rrBrBCsi+3[AOCes8SWJj(NLq#c(9KL+ 99==5#6#6 7sC+EhZ)PQ Q h(;(;< , yy}}^U\\2 :>:JK  Kxx**>:43%?@@%$& fslELLD ADN J K3%?@dJKs (E E8ct||\}} ||}|dk7r t||d|dz }t||t}t |||\}}|||fS#t$rd}YJwxYw)N=z,Expected '=' after a key in a key/value pairr )rr@rGr>r? parse_value)rKrLr+r\rOrs rrresc"HCs8 s{3%STT1HC S#w 'CS#{3JC U? sA A! A!ct||\}}|f}t||t} ||}|dk7r||fS|dz }t||t}t||\}}||fz }t||t}L#t$rd}YSwxYw)N.r )parse_key_partr>r?r@)rKrLkey_partr\rOs rrrus"3,MC{C S#w 'C  "3xD 3;8O qc7+&sC0 X {c7+  D sA11 A?>A?c ||}|tvr|}t||t}||||fS|dk(r t||S|dk(r t ||St ||d#t$rd}Y^wxYw)N'r!z(Invalid initial character for a key part)r@BARE_KEY_CHARSr>parse_literal_strparse_one_line_basic_strrG)rKrLrO start_poss rrrss8 ~ c>2C #&&& s{ c** s{'S11 sC!K LL sA A&%A&c(|dz }t||dS)Nr F multiline)parse_basic_strrKrLs rrrs1HC 3u 55r)cX|dz }g}t||}|jd|r|dz|fS t|||\}}|j|t||}|||dz}|dk(r|dz|fS|dk7r t ||d|dz }t||}|jd|r|dz|fS~)Nr r,zUnclosed array)rrrrrG)rKrLr+arrayvalcs r parse_arrayrs1HCE $S# .C ~~c3Qw~ sC5S S(c2 cAg  87E> ! 8sC)9: : q(c2 >>#s #7E> ! r)c|dz }t}t}t||t}|j d|r|dz|j fS t |||\}}}|dd|d}}|j|tjrt||d| |j|d} || vrt||d ||| |<t||t}|||dz} | dk(r|dz|j fS| d k7r t||d t|t tfr"|j|tjd |dz }t||t} #t$rt||ddwxYw) Nr }TrdrFr{rzDuplicate inline table key rzUnclosed inline tabler`)r;r<r>r?rrJrrprwrGrrr~rrT) rKrLr+ nested_dictrCr\rrlrmrrs rparse_inline_tablers1HC,K GE S#w 'C ~~c3Qw (((( .sCES%"3BxRH 99S%,, 'sC+McU)ST T O11*51QD t sC+Fxl)ST TXc7+ cAg  87K,,, , 8sC)@A A edD\ * IIc5<<4I 8 qc7++  OsC)CD$ N Os EE0Frct|||dz}|dz }|rL|dvrH|dk7r.t||t} ||}|dk7r t||d|dz }t||t}|dfS|dk(r t ||d S|d k(r t ||d S |t |fS#t$r|dfcYSwxYw#t$rt||ddwxYw) Nr>\ \ \ rrzUnescaped '\' in a stringr z\uz\U)r>r?r@rGrparse_hex_charBASIC_STR_ESCAPE_REPLACEMENTSr)rKrLr escape_idrOs rparse_basic_str_escapers C#'"I1HCY"99  S#w/C 3xt|"3-IJJ 1HCc#67BwEc3**Ec3**M1)<<< Bw  M3%ABLMsB  B BBB7ct||dS)NTr)rrs r parse_basic_str_escape_multiliners !#sd ;;r)c||||z}t||k7stj|s t||d||z }t |d}t |s t||d|t |fS)NzInvalid hex valuez/Escaped character is not a Unicode scalar value)rHEXDIGIT_CHARS issupersetrGrtis_unicode_scalar_valuer)rKrLhex_lenhex_strhex_ints rrrsw#g &G 7|wn&?&?&H3%8997NC'2G "7 +3%VWW G r)cL|dz }|}t||dtd}|dz|||fS)Nr rTr)rILLEGAL_LITERAL_STR_CHARS)rKrLrs rrrs>1HCI  S# 9 C 7C #& &&r)c,|dz }|jd|r|dz }|r!d}t||dtd}|||}|dz}nd}t||d \}}|j||s||fS|dz }|j||s|||zfS|dz }|||d zzfS) Nrr r'''Trr!rr)rr#ILLEGAL_MULTILINE_LITERAL_STR_CHARSr)rKrLliteraldelimend_posresults rparse_multiline_strr s1HC ~~dC  q   8  S!k%c3$? V >>% %F{1HC >>% %FUN""1HC %!)$ $$r)cl|r t}t}n t}t}d}|} ||}|dk(r4|s |dz||||zfS|j d|r |dz||||zfS|dz }@|dk(r||||z }|||\}}||z }|}a||vrt ||d||dz }z#t$rt ||ddwxYw) NrzUnterminated stringr!r """rr"zIllegal character )!ILLEGAL_MULTILINE_BASIC_STR_CHARSrILLEGAL_BASIC_STR_CHARSrr@rGr) rKrLrr parse_escapesrrrO parsed_escapes rrr(s48 *. FI  Js8D 3;QwYs); ;;;~~eS)QwYs); ;;; 1HC  4< c)C( (F!.sC!8 C m #FI  8 sC+=dX)FG G q)  JsC)>?T I Js BB3c ||}|dk(r,|jd|rt||dSt||S|dk(r,|jd|rt||dSt ||S|dk(r|jd |r|d zdfS|d k(r|jd |r|d zdfS|dk(r t |||S|dk(r t |||Stj||}|r t|}|j|fStj||}|r|jt|fStj||}|r|jt!||fS|||dz} | dvr |dz|| fS|||d z} | dvr |d z|| fSt||d#t$rd}YwxYw#t$r}t||d|d}~wwxYw)Nr!rF)rrrTttruerffalser7{zInvalid date or datetimer>infnan>+inf+nan-inf-nanz Invalid value)r@rrrrrrr matchr rrGendr rr r) rKrLr+rOdatetime_match datetime_objelocaltime_match number_match first_three first_fours rrrHs1s8 s{ >>% %&sC? ?'S11 s{ >>% %&sC> > c** s{ >>&# &7D=  s{ >>'3 '7E> ! s{3[11 s{!#sK88!&&sC0N L,^.coord_reprsa #c(?$yyq#&* 191WF3::dAs33FtfIfX..r)z (at ))rKstrrLrrrr)r$)rKrLmsgr s rrGrGs./ cU% 3(<'=Q? @@r)cFd|cxkxrdkncxsd|cxkxrdkScS)Nriiir() codepoints rrrs'  #e # G))Fw)FG)FGr)c2 turtSdfd }|S)NcZ|}t|ttfr td|S)Nz*parse_float must not return dicts or lists)r~rJrr) float_str float_valuer+s rsafe_parse_floatz/make_safe_parse_float..safe_parse_floats-!), kD$< 0IJ Jr))rrrrr)float)r+rs` rr=r=s$e  r))r2rr+rrrdict[str, Any])r4rr+rrrr)rKrrLrrz Iterable[str]rrr) rKrrLrrrrzfrozenset[str]rrvrrr)rKrrLrrrr)rKrrLrrMr:rrtuple[Pos, Key]) rKrrLrrMr:rNrr+rrrr)rKrrLrr+rrrztuple[Pos, Key, Any])rKrrLrrrr)rKrrLrrrtuple[Pos, str])rKrrLrr+rrrztuple[Pos, list])rKrrLrr+rrrztuple[Pos, dict])rKrrLrrrvrrr)rKrrLrrrtrrr)rKrrLrrrvrrr)rKrrLrr+rrrztuple[Pos, Any])rKrrLrrrrrr$)rrtrrrv)r+rrrr)G __future__rcollections.abcrstringtypesrtypingrrr_rer r r r rr_typesrrr frozensetrr ASCII_CTRLrrrrrr?r ascii_lettersdigitsrrA hexdigitsrrrr$rr5r1r<r;r:r>rrHrrFrErBrrrrrrrrrrrrrrGrr=r(r)rr's #$ ",,)( 1uRy1 1Ic#h4G G %y6$.61B$B!3&G#/ E  $/6//&--?$FG"Yu%556++, 0 !;j;8= -38?D77t""DZ         , $* #-0?ID    %/   ,$ M 6 "0,B.3M MM&*MM:<'%>@A2 A2A2%/A2A2HA"Hr)