a ReW @sddlZddlmZddlmZmZmZmZmZm Z m Z m Z m Z ddl mZmZmZmZmZmZmZmZmZer|ddlmZeddedDeed BZeed Zeed ZeZeed Z eZ!ed Z"e"edBZ#eej$ej%dZ&e&edBZ'edd ddddddZ(ee)gefZ*e e)dfZ+e,Z-Gddde.Z/e0de e*ee)efdddZ1e0de)e*ee)efddd Z2Gd!d"d"Z3Gd#d$d$Z4Gd%d&d&Z5e)e-e e)e-d'd(d)Z6e)e-e)ee)e7e-d*d+d,Z8e)e-e-d-d.d/Z9e)e-e-d-d0d1Z:e)e-e3e-d2d3d4Z;e)e-e3e-d2d5d6Ze)e-e e-e+fd-d=d>Z?e)e-e e-e)fd-d?d@Z@e)e-e e-e)fd-dAdBZAe)e-e*e e-eBfd:dCdDZCe)e-e*e e-eDfd:dEdFZEdGdHe)e-e7e e-e)fdIdJdKZFe)e-e e-e)fd-dLdMZGe)e-e,e e-e)fdNdOdPZHe)e-e e-e)fd-dQdRZIe)e-e7e e-e)fdSdTdUZJe)e-e7e e-e)fdIdVdWZKe)e-dXe e-e)fdYdZd[ZLe)e-e*e e-efd:d\d]ZMe)e-e)e/d^d_d`ZNe,e7dadbdcZOdS)dN)MappingProxyType) TYPE_CHECKINGAnyCallableDict FrozenSetIterableOptionalTextIOTuple) RE_BIN RE_DATETIMERE_HEX RE_LOCALTIME RE_NUMBERRE_OCTmatch_to_datetimematch_to_localtimematch_to_number)Patternccs|]}t|VqdSN)chr).0ir/builddir/build/BUILDROOT/alt-python39-pip-21.3.1-2.el8.x86_64/opt/alt/python39/lib/python3.9/site-packages/pip/_vendor/tomli/_parser.py r  z z z  z-_z"'  "\)z\bz\tz\nz\fz\rz\"z\\.c@seZdZdZdS)TOMLDecodeErrorz0An error raised if a document is not valid TOML.N)__name__ __module__ __qualname____doc__rrrrr'Bsr' parse_float)fpr-returncCs|}t||dS)zParse TOML from a file object.r,)readloads)r.r-srrrloadFsr3)r2r-r/cCsL|dd}d}t}t||t}z ||}WntyFYqDYn0|dkrZ|d7}q|tvr~t||||}t||t}nt|dkrz||d}Wntyd}Yn0|dkrt|||}n t|||}t||t}n|dkrt ||dt ||}z ||}Wnty"YqDYn0|dkr:t ||d |d7}q|j j S) zParse TOML from a string.z r!r[N#zInvalid statementz5Expected newline or end of document after a statement) replaceState skip_charsTOML_WS IndexErrorKEY_INITIAL_CHARSkey_value_rulecreate_list_rulecreate_dict_rule suffixed_err skip_commentoutdict)r2r-srcposstatechar second_charrrrr1LsH              r1c@seZdZddddZdS)r8Nr/cCst|_t|_d|_dS)Nr) NestedDictrBFlagsflagsheader_namespaceselfrrr__init__szState.__init__)r(r)r*rPrrrrr8sr8c@speZdZdZdZdZddddZeddd d Zeee dd d d Z ee e ddddZ ee e dddZ dS)rKz)Flags that map to parsed keys/namespaces.rr4NrIcCs i|_dSr_flagsrNrrrrPszFlags.__init__keyr/cCsF|j}|ddD]}||vr$dS||d}q||dddS)Nnested)rRpop)rOrTcontkrrr unset_alls zFlags.unset_all)head_keyrel_keyflagr/cCs|j}|D],}||vr*ttid||<||d}q |D]@}||vr\||d|n|htid||<||d}qt||d|dYn0||||}|rtt|}|||}t||d|d|S)Nz Expected "r%zFound invalid character ")index ValueErrorlenr@ intersectionnextiter) rDrEryrzr{new_pos bad_charsbad_charbad_posrrr skip_untils   rrDrEr/cCsFz ||}Wnty"d}Yn0|dkrBt||ddtddS|S)Nr6r4r!Frzr{)r;rILLEGAL_COMMENT_CHARS)rDrErGrrrrAs   rAcCs,|}t||t}t||}||kr|SqdSr)r9TOML_WS_AND_NEWLINErA)rDrEpos_before_skiprrrskip_comments_and_array_ws!s   r)rDrErFr/cCs|d7}t||t}t||\}}|j|tjsB|j|tjrVt||d|d|jj |tjddz|j |Wnt yt||dYn0||_ |||ddkrt||d|dS) Nr4zCan not declare z twiceFrdCan not overwrite a value]z.Expected "]" at the end of a table declaration)r9r: parse_keyrLrhrKrjrir@rarBrsrrrM)rDrErFrTrrrr?*s    r?cCs|d7}t||t}t||\}}|j|tjrDt||d||j||jj |tj ddz|j |Wnt yt||dYn0||_|||d}|dkrt||d|d|dS) N#Can not mutate immutable namespace Frrz]]zFound "z3" at the end of an array declaration. Expected "]]")r9r:rrLrhrKrir@rZrarjrBrwrrrM)rDrErFrT end_markerrrrr>=s(    r>)rDrErFr-r/c Cst|||\}}}|dd|d}}|j|}|j|tjrTt||d||j|j|tjz|j |} Wnt yt||dYn0|| vrt||dt |t tfr|j|} |jj| tjdd|| |<|S)NrUrrTr)parse_key_value_pairrMrLrhrKrir@rcrjrBrsrrrprCrqra) rDrErFr-rTvaluererfabs_key_parentnestabs_keyrrrr=Ys&     r=)rDrEr-r/cCstt||\}}z ||}Wnty0d}Yn0|dkrFt||d|d7}t||t}t|||\}}|||fS)N=z,Expected "=" after a key in a key/value pairr4)rr;r@r9r: parse_value)rDrEr-rTrGrrrrrrs     rcCst||\}}|g}t||t}z ||}WntyBd}Yn0|dkrX|t|fS|d7}t||t}t||\}}||t||t}q dS)N.r4)parse_key_partr9r:r;tuplert)rDrEkey_partrTrGrrrrs       rcCsz ||}Wnty"d}Yn0|tvrL|}t||t}||||fS|dkr^t||S|dkrpt||St||ddS)N'r%z(Invalid initial character for a key part)r;BARE_KEY_CHARSr9parse_literal_strparse_one_line_basic_strr@)rDrErG start_posrrrrs      rcCs|d7}t||ddS)Nr4F multiline)parse_basic_strrDrErrrrsrcCs|d7}g}t||}|||ddkr6|d|fSt|||\}}||t||}|||d}|dkr~|d|fS|dkrt||d|d7}t||}|||ddkr6|d|fSq6dS)Nr4r,zUnclosed array)rrrtr@)rDrEr-arrayvalcrrr parse_arrays"       rc Csf|d7}t}t}t||t}|||ddkrB|d|jfSt|||\}}}|dd|d}}||tjrt||d|z|j |dd} Wnt yt||dYn0|| vrt||d|d || |<t||t}|||d} | dkr|d|jfS| d kr*t||d t |tt frL|j |tjd d |d7}t||t}qBdS)Nr4}rUrFrnrzDuplicate inline table key "r%rzUnclosed inline tableTr)rJrKr9r:rCrrhrir@rsrrrprqra) rDrEr- nested_dictrLrTrrerfrrrrrparse_inline_tables6      rFr)rDrErr/cCs|||d}|d7}|r|dvr|dkrpt||t}|||d}|sT|dfS|dkrht||d|d7}t||t}|dfS|dkrt||d S|d krt||d Sz|t|fWStyt|dkrt||d t||dYn0dS) Nr>z\ \ z\ rr4r!zUnescaped "\" in a stringz\uz\UUnterminated string)r9r:r@rparse_hex_charBASIC_STR_ESCAPE_REPLACEMENTSrrr~)rDrEr escape_idrGrrrparse_basic_str_escapes.         rcCst||ddS)NTr)rrrrr parse_basic_str_escape_multilinesr)rDrEhex_lenr/cCsl||||}t||ks.tdd|Dr:t||d||7}t|d}t|s`t||d|t|fS)Ncss|]}|tjvVqdSr)string hexdigits)rrrrrrrz!parse_hex_char..zInvalid hex valuez/Escaped character is not a Unicode scalar value)r~anyr@rlis_unicode_scalar_valuer)rDrErhex_strhex_intrrrrs   rcCs2|d7}|}t||dtdd}|d|||fS)Nr4rTr)rILLEGAL_LITERAL_STR_CHARS)rDrErrrrrs  r)rDrEliteralr/cCs|d7}|||ddkr$|d7}|rTd}t||dtdd}|||}|d}nd}t||dd \}}|||d|kr||fS|d7}|||d|kr|||fS|d7}|||d fS) Nr4r!rz'''Trr%rr)r#ILLEGAL_MULTILINE_LITERAL_STR_CHARSr)rDrErdelimend_posresultrrrparse_multiline_strs.   rc Cs|rt}t}nt}t}d}|}z ||}WntyHt||dYn0|dkr|sn|d||||fS||d|ddkr|d||||fS|d7}q|dkr||||7}|||\}}||7}|}q||vrt||d|d|d7}qdS) Nrrr%r4r""r&zIllegal character ")!ILLEGAL_MULTILINE_BASIC_STR_CHARSrILLEGAL_BASIC_STR_CHARSrr;r@) rDrErrz parse_escapesrrrG parsed_escaperrrr6s6  rr)rDrEregexr/cCs,|||}|st||d||fS)NzUnexpected sequence)matchr@endgroup)rDrErrrrr parse_regexVs  rcCsz ||}Wnty"d}Yn0|dkr\||d|ddkrRt||ddSt||S|dkr||d|ddkrt||d dSt||S|d kr||d|d d kr|d d fS|d kr||d|ddkr|ddfSt||}|r8z t|}Wn ty*t||dYn0| |fSt ||}|rZ| t |fS|dkr||d|d}|dkrt ||dt \}}|t|dfS|dkrt ||dt\}} |t| dfS|dkrt ||dt\}} |t| dfSt||} | r | t| |fS|dkr6t|||S|dkrLt|||S|||d} | dvrv|d|| fS|||d } | dvr|d || fSt||ddS)Nr%r4rrF)rrz''TtrruefalsezInvalid date or datetime0rxrorbr5{>naninf>z+nanz+infz-infz-nanz Invalid value)r;rrrr rrr}r@rrrrrrlrr rrrr)rDrEr-rGdatetime_match datetime_objlocaltime_matchrHroct_strbin_str number_match first_three first_fourrrrr]sj                      r)rDrEmsgr/cCs,tttddd}t|d|||dS)zZReturn a `TOMLDecodeError` where error message is suffixed with coordinates in source.rcSsV|t|krdS|dd|d}|dkr4|d}n||dd|}d|d|S)Nzend of documentr!rr4zline z , column )r~countrindex)rDrElinecolumnrrr coord_reprs  z suffixed_err..coord_reprz (at ))strPosr')rDrErrrrrr@s r@) codepointr/cCs0d|kodknp.d|ko*dkSS)Nriiir)rrrrrsr)Prtypesrtypingrrrrrrr r r pip._vendor.tomli._rer r rrrrrrrrer frozensetranger ASCII_CTRLrrrrrr:r ascii_lettersdigitsrr<rr ParseFloatrkrlrr}r'floatr3r1r8rKrJr9rmrrArr?r>r=rrrrrqrrCrrrrrrrrrr@rrrrrs , ,  "         ? >"     !     P