mfOrddgZddlmZddlTGddeZGddZGddZd S) Scanner ScannerError)MarkedYAMLError)*ceZdZdS)rN)__name__ __module__ __qualname__C/opt/imunify360/venv/lib64/python3.11/site-packages/yaml/scanner.pyrr sDr ceZdZdZdS) SimpleKeycZ||_||_||_||_||_||_dSN) token_numberrequiredindexlinecolumnmark)selfrrrrrrs r __init__zSimpleKey.__init__&s1(      r N)rr r rr r r rr#s#r rc6eZdZdZdZdZdZdZdZdZ dZ d Z d Z d Z d Zd ZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZ dZ!d Z"d!Z#d"Z$d#Z%d$Z&d%Z'd&Z(d'Z)d(Z*d)Z+d*Z,d+Z-d,Z.d-Z/d.Z0d/Z1d0Z2d1Z3d2Z4d3Z5d4Z6d5Z7d6Z8d7Z9d8Z:d9Z;d:Zd=Z?d>Z@id?d@dAdBdCdDdEdFdFdFdGdHdIdJdKdLdMdNdOdPdQdQdRdRdSdSdTdTdUdVdWdXdYdZd[d\iZAd]d^d_d`ZBdaZCdbZDdcZEddZFdeZGdfZHdgZIdhZJdiZKdjS)krcd|_d|_g|_|d|_d|_g|_d|_i|_dS)zInitialize the scanner.FTN) done flow_leveltokensfetch_stream_start tokens_takenindentindentsallow_simple_keypossible_simple_keysrs r rzScanner.__init__0sg   !!!  ,!%%'!!!r c|r(||(|jr'|sdS|D] }t|jd|rdS!dS)NTrF)need_more_tokensfetch_more_tokensr isinstance)rchoiceschoices r check_tokenzScanner.check_tokenqs##%% %  " " $ $ $##%% % ;  t!  dk!nf55 44 ur c|r(||(|jr |jdSdS)Nr)r)r*r r's r peek_tokenzScanner.peek_token}s[##%% %  " " $ $ $##%% % ; ;q> !4r c|r(||(|jr*|xjdz c_|jdSdS)Nrr)r)r*r r"popr's r get_tokenzScanner.get_tokensz##%% %  " " $ $ $##%% % ; &    "  ;??1%% % & &r c|jrdS|jsdS|||jkrdSdS)NFT)rr stale_possible_simple_keysnext_possible_simple_keyr"r's r r)zScanner.need_more_tokenss\ 9 5{ 4 '')))  ( ( * *d.? ? ?4 @ ?r c4||||j|}|dkr|S|dkr(|r|S|dkr(|r| S|dkr(| r| S|dkr| S|dkr| S|dkr|S|dkr|S|d kr|S|dkr(|r|S|d kr(|r|S|d kr(|r|S|d kr|S|d kr|S|dkr|S|dkr|js|S|dkr|js|S|dkr|S|dkr|S|r| StCddd|z|")N%-.[{]},?:r&!|>'"z!while scanning for the next tokenz.found character %r that cannot start any token)#scan_to_next_tokenr5 unwind_indentrpeekfetch_stream_endcheck_directivefetch_directivecheck_document_startfetch_document_startcheck_document_endfetch_document_endfetch_flow_sequence_startfetch_flow_mapping_startfetch_flow_sequence_endfetch_flow_mapping_endfetch_flow_entrycheck_block_entryfetch_block_entry check_key fetch_key check_value fetch_value fetch_alias fetch_anchor fetch_tagr fetch_literal fetch_folded fetch_single fetch_double check_plain fetch_plainrget_markrchs r r*zScanner.fetch_more_tokenss2 !!! ''))) 4;'''YY[[ ::((** * 99--//9'')) ) 9922449,,.. . 9900229**,, , 991133 3 990022 2 99//11 1 99..00 0 99((** * 99//119))++ + 99))9>>## # 99))++9##%% % 99##%% % 99$$&& & 99>>## # 99T_9%%'' ' 99T_9$$&& & ::$$&& & ::$$&& &      &##%% %>@2E !! !r c`d}|jD]#}|j|}| |j|kr|j}$|Sr)r&r)rmin_token_numberlevelkeys r r6z Scanner.next_possible_simple_keysM . 4 4E+E2C'3+;>N+N+N# r ct|jD]j}|j|}|j|jks|j|jz dkr8|jr)t d|jd||j|=kdS)Niwhile scanning a simple keycould not find expected ':')listr&rrrrrrg)rrlrms r r5z"Scanner.stale_possible_simple_keyss$344 5 5E+E2Cx49$$z#)+d22<L&'Dch94==??LLL-e4 5 5r c 0|j o|j|jk}|jrv||jt |jz}t|||j |j |j| }||j |j<dSdSr) rr#rr%remove_possible_simple_keyr"lenr rrrrgr&)rrrrms r save_possible_simple_keyz Scanner.save_possible_simple_key's &E4;$++E   =  + + - - -,S-=-==LL(J 4; IIC9$55666 r c|d|d|_|j|dS)NrF)rJrsr%r rxscan_directiver's r rNzScanner.fetch_directives^ 2 ''))) % 4..0011111r c:|tdSr)fetch_document_indicatorDocumentStartTokenr's r rPzScanner.fetch_document_starts %%&899999r c:|tdSr)rDocumentEndTokenr's r rRzScanner.fetch_document_ends %%&677777r c(|d|d|_|}|d|}|j|||dS)NrF)rJrsr%rgforwardr rxr TokenClass start_markend_marks r rz Scanner.fetch_document_indicators 2 ''))) %]]__  Q==?? ::j(;;<<<<?????r c||xjdz c_d|_|}||}|j|||dS)NrT)rurr%rgrr rxrs r rz#Scanner.fetch_flow_collection_starts %%''' 1!%]]__  ==?? ::j(;;<<<<*h??@@@@@r c|js|js$tddd|||jr<|}|jt||n d|_| |}| |}|jt||dS)Nz%sequence entries are not allowed hereT) rr%rrgr{rr rxBlockSequenceStartTokenrsrBlockEntryTokenrrrrs r rYzScanner.fetch_block_entrys ( )"4? ))) t{++ H}} ""#:4#F#FGGG !% '')))]]__  ==?? ?:x@@AAAAAr c |js|js$tddd|||jr<|}|jt|||j |_| |}| |}|jt||dS)Nz!mapping keys are not allowed here) rr%rrgr{rr rxBlockMappingStartTokenrsrKeyTokenrs r r[zScanner.fetch_keys G( )"4; ))) t{++ G}} ""#9$#E#EFFF%)O 3 '')))]]__  ==?? 8J99:::::r c|j|jvr|j|j}|j|j=|j|j|jz t |j|j|jsZ||j r@|j|j|jz t|j|jd|_ n|js+|j s$tddd| |jsV||j r<| }|jt|||j |_ || }|| }|jt#||dS)NFz#mapping values are not allowed here)rr&r insertrr"rrr{rrr%rrgrxrsr ValueToken)rrmrrrs r r]zScanner.fetch_value!s ?d7 7 7+DO> >r cB|jrdS|ddvSrrr's r r\zScanner.check_valuerr c|}|dvp(|ddvo|dkp |j o|dvS)Nu …

-?:,[]{}#&*!|>'"%@`rrr:z?:)rKrrhs r rezScanner.check_plainsYYY[[IIQIIaLL(CCP3YNt+>+M2: Qr c|jdkr,|dkr|d}|s|dkr,||dk,|dkr@|dvr*||dv*|r|jsd|_nd}|dSdS)NruF # …

T)rrKrscan_line_breakrr%)rfounds r rIzScanner.scan_to_next_tokens( :??tyy{{h66 LLNNN ))++$$ ))++$$yy{{c!!iikk)AAALLNNNiikk)AAA##%% 1,0D)     r c6|}|||}d}|dkr*||}|}n|dkr*||}|}nT|}|dvr*||dv*||t||||S)NYAMLTAGr)rgrscan_directive_namescan_yaml_directive_valuescan_tag_directive_valuerKscan_directive_ignored_lineDirectiveToken)rrnamevaluers r rzScanner.scan_directives]]__  '' 33 6>>22:>>E}}HH U]]11*==E}}HH}}H))++%=== ))++%=== ((444dE:x@@@r cPd}||}d|cxkrdks$nd|cxkrdksnd|cxkrdksn|dvrK|d z }||}d|cxkrdk'nd|cxkrdk6nd|cxkrdkEn|dvK|s'td |d |z|||}|||}|d vr'td |d |z||S) Nr09AZaz-_rwhile scanning a directive6expected alphabetic or numeric character, but found %r …

)rKrrgrr)rrlengthrirs r rzScanner.scan_directive_name&s YYv  R3#"2"2"2"2s"2"2"2"2cR6F6F6F6F36F6F6F6F:: aKF6""BR3#"2"2"2"2s"2"2"2"2cR6F6F6F6F36F6F6F6F:: +;ZL--//++ + F## V YY[[ . . .;ZL--//++ + r cN|dkr,||dk,||}|dkr9td|d|z||||}|dvr9td|d|z|||fS)Nrr;rz%expected a digit or '.', but found %rrz%expected a digit or ' ', but found %r)rKrscan_yaml_directive_numberrrg)rrmajorminors r rz!Scanner.scan_yaml_directive_value;siikkS  LLNNNiikkS  // ;; 99;;#  ;Z;diikkIMMOO%% % // ;; 99;;7 7 7;Z;diikkIMMOO%% %u~r c|}d|cxkrdks)ntd|d|z|d}d||cxkrdkr*nn'|dz }d||cxkrdk%nt||}|||S)Nrrrzexpected a digit, but found %rrr)rKrrgintrr)rrrirrs r rz"Scanner.scan_yaml_directive_numberLs YY[[r    S    ;Z4r94==??LL LTYYv&&----#----- aKFTYYv&&----#----DKK''(( V r cn|dkr,||dk,||}|dkr,||dk,||}||fS)Nr)rKrscan_tag_directive_handlescan_tag_directive_prefix)rrhandlers r rz Scanner.scan_tag_directive_valueYsiikkS  LLNNNiikkS  // ;;iikkS  LLNNNiikkS  // ;;r c|d|}|}|dkr'td|d|z||S)N directiverrexpected ' ', but found %r)scan_tag_handlerKrrgrrrris r rz!Scanner.scan_tag_directive_handlecs^$$[*== YY[[ 99;Z025t}}HH H r c|d|}|}|dvr'td|d|z||S)Nrrrr) scan_tag_urirKrrgrs r rz!Scanner.scan_tag_directive_prefixlsa!!+z:: YY[[ . . .;Z025t}}HH H r c|dkr,||dk,|dkr@|dvr*||dv*|}|dvr'td|d|z||dS)Nrrrr0expected a comment or a line break, but found %rrKrrrgrrrris r rz#Scanner.scan_directive_ignored_lineusiikkS  LLNNNiikkS  99;;#  ))++%=== ))++%=== YY[[ - - -;ZF"mmoo// / r c(|}|}|dkrd}nd}|d}||}d|cxkrdks$nd|cxkrdksnd |cxkrd ksn|d vrK|d z }||}d|cxkrdk'nd|cxkrdk6nd |cxkrd kEn|d vK|s*td |z|d|z|||}|||}|dvr*td |z|d|z||}||||S)Nraliasanchorrrrrrrrrrzwhile scanning an %sru …

?:,]}%@`)rgrKrrr) rrr indicatorrrrirrs r rzScanner.scan_anchors ]]__ IIKK   DDD  YYv  R3#"2"2"2"2s"2"2"2"2cR6F6F6F6F36F6F6F6F:: aKF6""BR3#"2"2"2"2s"2"2"2"2cR6F6F6F6F36F6F6F6F:: +5', but found %rrrDFrTzwhile scanning a tagr)rgrKrrrrTagToken) rrrirsuffixr use_handlerrs r rzScanner.scan_tags]]__ YYq\\ 99F LLOOO&&uj99Fyy{{c!!"#8*4tyy{{B ))) LLNNNN . . .FF LLNNNNFJ55599!%J! YYv&& 555 F --eZ@@ &&uj99F YY[[ . . .5z025t}}HH H ==??z8444r c<|dkrd}nd}g}|}|||\}}|||jdz}|dkrd}|)|\}} } t || } n ||zdz } || \}} d} |j| krx| dkr_| || dv} d}| |d vr|dz }| |d v| | |||| } || \}} |j| krf| dkrN|r6| d kr0| r.| dvr|s| d n| | nn$|j| kr| dk_|dur| | |dur| |td|d|| |S) NrFTFrr8 rr r)rgrscan_block_scalar_indicatorsscan_block_scalar_ignored_liner#scan_block_scalar_indentationmaxscan_block_scalar_breaksrrKextendrxrr ScalarTokenjoin)rrfoldedchunksrchomping increment min_indentbreaks max_indentrr# line_breakleading_non_spacers r rzScanner.scan_block_scalars C<<FFF]]__  "?? KK) ++J777[] >>J  +/+M+M+O+O (FJZ00FF )!+F#<>&'F Z MMOO---  <  BIA~~"#BJV ))) LLNNNBTzz99#HH$H  YY[[ . . .> O--//++ +""r c|dkr,||dk,|dkr@|dvr*||dv*|}|dvr'td|d|z||dS)Nrrrr'rrrs r rz&Scanner.scan_block_scalar_ignored_lineDsiikkS  LLNNNiikkS  99;;#  ))++%=== ))++%=== YY[[ - - -> FKMMOO%% % r cg}d}|}|dvr|dkr<|||}n&||j|kr|j}|dv|||fS)Nr …

r)rgrKrxrrr)rrr!rs r rz%Scanner.scan_block_scalar_indentationRs ==??iikk444yy{{c!! d2244555==?? ;++!%Jiikk444z8++r clg}|}|j|krO|dkr7||j|kr|dk7|dvr|||}|j|krO|dkr7||j|kr|dk7|dv||fS)Nr …

)rgrrKrrxr)rr#rrs r rz Scanner.scan_block_scalar_breaksas==??kF""tyy{{c'9'9 LLNNNkF""tyy{{c'9'9iikk333 MM$..00 1 1 1}}H+&&499;;#+=+= +&&499;;#+=+=iikk333 xr c|dkrd}nd}g}|}|}|||||||krj||||||||||kj||}t d|d|||S)NrHTFr)rgrKrrscan_flow_scalar_non_spacesscan_flow_scalar_spacesrr)rrdoublerrquoters r rzScanner.scan_flow_scalarns C<<FFF]]__    d66vzJJKKKiikkU"" MM$66vzJJ K K K MM$::6:NN O O OiikkU"" ==??2776??E:x r rr8rbt nrv f r errH\/N…_ Lu
Pu
r )xuUc g} d}||dvr|dz }||dv|r=||||||}|sK|dkrE|ddkr,|d|dn|r|dks|s/|dvr+|||n|r|dkr||}||jvr6||j||nU||jvr|j|}|t |D]U}||d vr| | | ||n)td |d|z||S)NTru'"\ …

rrGr z"\r@0123456789ABCDEFabcdefz%while scanning a double-quoted scalarz@expected escape sequence of %d hexadecimal numbers, but found %rr,z!found unknown escape character %r)rKrxrrESCAPE_REPLACEMENTS ESCAPE_CODESrangerrgrchrrrscan_flow_scalar_breaks)rr0rrrrikcodes r r.z#Scanner.scan_flow_scalar_non_spacess& F))F##+LLL! ))F##+LLL % dkk&11222 V$$$B bDjjTYYq\\T-A-A d### Q R4ZZZB&LL b!!!  B$JJ YY[[111MM$":2">???LLNNNN4,,,!.r2FLLNNN"6]]QQ99Q<%?@D #Q#QQHt{{622B77DMM#d)),,,LL((((111((***MM$">">vz"R"RSSSS&'NPZ?"DdmmooWWW M& r c\g}d}||dvr|dz }||dv||}|||}|dkr$td|d||dvrs|}|||}|dkr||n|s|d ||n|||S) Nrrrr8while scanning a quoted scalarzfound unexpected end of streamr,rr) rKrrrrgrrTrxr) rr0rrr whitespacesrir"r s r r/zScanner.scan_flow_scalar_spacess=ii5(( aKFii5((kk&))  V YY[[ ::?4dmmooGG G ) ) )--//J11&*EEFT!! j)))) # c""" MM& ! ! ! ! MM+ & & & r cg} |d}|dks|dkr;|ddvr$td|d||dvr*||dv*|d vr(||n|S) NTrrrrrXz#found unexpected document separatorrr,)rrKrrgrrxr)rr0rrrs r rTzScanner.scan_flow_scalar_breakss [[^^F%6U?? ! (CCC"#CZ=t}}PPP))++&& ))++&&yy{{444 d22445555  r cg}|}|}|jdz}g} d}|dkrn ||}|dvs7|dkr&||dzd|jrdndzvs |jr|d vrn|dz }W|dkrnd |_||||||||}| ||}|r*|dks|js |j |krn-td |d||S) NrTrrrrBz,[]{}rz,?[]{}F) rgr#rKrr%rrxrrscan_plain_spacesrrr)rrrrr#spacesrris r rzScanner.scan_plains ]]__ Q  Fyy{{c!! YYv&&444#II $ &( 3 37R59_)M#8O!O!O O!O02h!  {{$)D ! MM& ! ! ! MM$++f-- . . . LL }}H++FJ??F TYY[[C// O004 f0D0D/ 02776??D*hGGGr cg}d}||dvr|dz }||dv||}|||}|dvrZ|}d|_|d}|dks|dkr|dd vrdSg} |d vr|dkr|na| ||d}|dks|dkr|dd vrdS|d v|d kr||n| s|d|| n|r|||S) Nrrrr,Trrrrr*r)rKrrrr%rxr) rr#rrrrYrir"rr s r r\zScanner.scan_plain_spacessii3&& aKFii3&&kk&))  V YY[[ ' ' '--//J$(D ![[^^F%6U?? ! (CCCF))++!88899;;#%%LLNNNNMM$"6"6"8"8999![[^^F%6U?? $ ! 0K K K))++!888T!! j)))) # c""" MM& ! ! ! !  ' MM+ & & & r c|}|dkr*td|z|d|z|d}||}|dkrd|cxkrdks$nd|cxkrd ksnd |cxkrd ksn|d vrK|dz }||}d|cxkrdk'nd|cxkrd k6nd |cxkrd kEn|d vK|dkr?||td|z|d|z||dz }||}|||S) NrDwhile scanning a %szexpected '!', but found %rrrrrrrrrr)rKrrgrr)rrrrirrs r rzScanner.scan_tag_handleDsYY[[ 994t;Z025t}}HH H YYv   99""""s""""cR&6&6&6&63&6&6&6&6#:J:J:J:Js:J:J:J:JTzz! YYv&&""""s""""cR&6&6&6&63&6&6&6&6#:J:J:J:Js:J:J:J:JTzzSyy V$$$"#84#?4r94==??LLL aKF F## V r cg}d}||}d|cxkrdks$nd|cxkrdksnd|cxkrdksn|dvr|d kri|||||d}||||n|d z }||}d|cxkrdknd|cxkrdknd|cxkrdkn|dv|r?|||||d}|s*t d |z|d |z|d |S)Nrrrrrrrz-;/?:@&=+$,_.!~*'()[]%r9rzwhile parsing a %szexpected URI, but found %rr)rKrxrrscan_uri_escapesrrgr)rrrrrris r rzScanner.scan_tag_uri\s YYv  R3#"2"2"2"2s"2"2"2"2cR6F6F6F6F36F6F6F6F222Syy dkk&11222 V$$$ d33D*EEFFFF! 6""BR3#"2"2"2"2s"2"2"2"2cR6F6F6F6F36F6F6F6F222   MM$++f-- . . . LL F H3d:J025t}}HH Hwwvr c g}|}|dkr|tdD]V}||dvr=t d|z|d||z|W|t |dd|d|dk t| d}n4#t$r'}t d|z|t||d}~wwxYw|S)Nr9r rNr`zCexpected URI escape sequence of 2 hexadecimal numbers, but found %rrOzutf-8) rgrKrrRrrxrrbytesdecodeUnicodeDecodeErrorstr)rrrcodesrrUrexcs r rbzScanner.scan_uri_escapesusW}}iikkS  LLNNN1XX = =99Q<<'???&' ! ! LLNNNIrr N)Lrr r rr.r0r3r)r*r6r5rursrJr{r!rLrNrPrRrrSrTrrUrVrrWrYr[r]r^r_r`rarbrrcrdrrfrMrOrQrXrZr\rerIrrrrrrrrrrrrrrrrrPrQr.r/rTrr\rrrbrr r r rr.s\='='='B   &&&   h!h!h!X    555 ===" ; ; ;:::0 % % %& 2 2 2:::888=== AAA@@@==="===<<<===" A A ABBBB;;;86=6=6=p 9 9 9 : : : , , ,++++++ : : :+++*** 9 9 9 . . .;;; ??????QQQ*!!!FAAA&*"         "7"7"7H'5'5'5RJJJX&#&#&#P    , , ,    0                   !" #$ %,L )))V0$'H'H'HR###J02&r N)__all__errorrr rrrr r r rms6 n %""""""     ?           mmmmmmmmmmr