mfrddgZddlmZddlTGddeZGddZGddZd S) Emitter EmitterError) YAMLError)*ceZdZdS)rN)__name__ __module__ __qualname__C/opt/imunify360/venv/lib64/python3.11/site-packages/yaml/emitter.pyrrsDr ceZdZdZdS)ScalarAnalysisc v||_||_||_||_||_||_||_||_dSNscalarempty multilineallow_flow_plainallow_block_plainallow_single_quotedallow_double_quoted allow_block) selfrrrrrrrrs r __init__zScalarAnalysis.__init__sG  " 0!2#6 #6 &r N)rr r rr r r rrs# ' ' ' ' 'r rceZdZdddZ dRdZdZdZdZd ZdSd Z d Z d Z dZ dTdZ dZdZ dUdZdZdZdZdZdZdZdZdZdZdZdZdZdTdZd Zd!ZdTd"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-d0Z.d1Z/d2Z0d3Z1d4Z2d5Z3 dSd6Z4d7Z5dVd8Z6d9Z7d:Z8dWd<Z9d=d>d?d@dAdBdCdDdEdFdGdHdIdJdKdLZ:dWdMZ;dNZdWdQZ?dS)Xr!z!!)rztag:yaml.org,2002:Nc||_d|_g|_|j|_g|_d|_g|_d|_d|_ d|_ d|_ d|_ d|_ d|_d|_d|_d|_d|_||_||_d|_|rd|cxkrdkr nn||_d|_|r||jdzkr||_d|_|d vr||_d|_d|_d|_d|_d|_dS) NFTr P ) r$z )streamencodingstatesexpect_stream_startstateeventseventindentsindent flow_level root_contextsequence_contextmapping_contextsimple_key_contextlinecolumn whitespace indention open_ended canonical allow_unicode best_indent best_widthbest_line_break tag_prefixesprepared_anchor prepared_taganalysisstyle)rr&r9r.widthr: line_breaks r rzEmitter.__init__&sN   -     " %$"'   #*  &a&oooo2ooooo%D   $UT-a///#DO# - - -#-D ! $   r c"g|_d|_dSr)r(r*rs r disposezEmitter.disposejs  r c|j||sP|jd|_|d|_|NdSdSNr )r+appendneed_more_eventspopr,r*rr,s r emitz Emitter.emitos 5!!!'')) ++DJ JJLLLDJ''))     r c.|jsdS|jd}t|tr|dSt|tr|dSt|t r|dSdS)NTr rr!F)r+ isinstanceDocumentStartEvent need_eventsSequenceStartEventMappingStartEventrMs r rKzEmitter.need_more_eventsxs{ 4 A e/ 0 0 ##A&& & 1 2 2 ##A&& & 0 1 1 ##A&& &5r c(d}|jddD]f}t|ttfr|dz }n9t|tt fr|dz}nt|t rd}|dkrdSgt|j|dzkS)Nr rF)r+rQrRCollectionStartEventDocumentEndEventCollectionEndEventStreamEndEventlen)rcountlevelr,s r rSzEmitter.need_eventss[_  E%"46J!KLL  E$46H#IJJ  E>22 qyyuuDK  57*+r Fc|j|j|j|r|j|_dSd|_dS|s|xj|jz c_dSdSrI)r-rJr.r;)rflow indentlesss r increase_indentzEmitter.increase_indentsl DK((( ;  ".   , KK4+ +KKKK , ,r c t|jtrT|jjr&t |jds|jj|_||j|_dStd|jz)Nr'z%expected StreamStartEvent, but got %s) rQr,StreamStartEventr'hasattrr&write_stream_startexpect_first_document_startr*rrFs r r)zEmitter.expect_stream_starts dj"2 3 3 "z" 474; +K+K 4 $ 3  # # % % %9DJJJFj !"" "r c0td|jz)Nzexpected nothing, but got %s)rr,rFs r expect_nothingzEmitter.expect_nothings9DJFGGGr c.|dSNT)first)expect_document_startrFs r rgz#Emitter.expect_first_document_starts)))555r ct|jtr|jjs |jjr1|jr*|dd||jjr4||jj}| ||j |_ |jjrt|jj}|D]^}|jj|}||j |<||}||}|||_|oC|jj o6|j o.|jj o!|jj o| }|sE||dd|jr||j|_dSt|jt.rS|jr*|dd|||j|_dSt5d|jz)N...T---z'expected DocumentStartEvent, but got %s)rQr,rRversiontagsr8write_indicator write_indentprepare_versionwrite_version_directiveDEFAULT_TAG_PREFIXEScopyr>sortedkeysprepare_tag_handleprepare_tag_prefixwrite_tag_directiveexplicitr9check_empty_documentexpect_document_rootr*r[write_stream_endrir) rrl version_texthandleshandleprefix handle_text prefix_textimplicits r rmzEmitter.expect_document_starts dj"4 5 5! " " $djo $4? $$$UD111!!###z! ;#33DJ4FGG ,,\::: $ 9 > > @ @D z G !5!5!7!788%GGF!Z_V4F06D%f-"&"9"9&"A"AK"&"9"9&"A"AK,,[+FFFF8dj&9"98$.>P8 J..87;z3F8 55777  (!!###$$UD111>(%%'''2DJJJ  N 3 3 " $$$UD111!!###  ! ! # # #,DJJJHj !"" "r c<t|jtrl||jjr*|dd|||j|_dStd|jz)NroTz%expected DocumentEndEvent, but got %s) rQr,rYrtr~rs flush_streamrmr*rrFs r expect_document_endzEmitter.expect_document_ends dj"2 3 3 "      z" $$$UD111!!###      3DJJJFj !"" "r cp|j|j|ddS)NT)root)r(rJr expect_noderFs r rzEmitter.expect_document_roots8 43444 d#####r c||_||_||_||_t |jt r|dSt |jttfrC| d| t |jtr| dSt |jtrZ|js'|js |jjs|r|dS|dSt |jt(rZ|js'|js |jjs|r|dS|dSdSt1d|jz)N&zexpected NodeEvent, but got %s)r0r1r2r3rQr, AliasEvent expect_alias ScalarEventrXprocess_anchor process_tag expect_scalarrTr/r9 flow_stylecheck_empty_sequenceexpect_flow_sequenceexpect_block_sequencerUcheck_empty_mappingexpect_flow_mappingexpect_block_mappingr)rrsequencemapping simple_keys r rzEmitter.expect_nodes  (&", dj* - - N          [2F$G H H N    $ $ $      $*k22 0""$$$$$DJ(:;; 0?1dn1 8M144661--/////..00000DJ(9:: 0?0dn0 8M033550,,.....--/////  0 0?$*LMM Mr c|jjtd|d|j|_dS)Nz!anchor is not specified for aliasr)r,anchorrrr(rLr*rFs r rzEmitter.expect_aliassG :  $BCC C C   [__&& r c|d||j|_|j|_dS)NTr`)rbprocess_scalarr-rLr.r(r*rFs r rzEmitter.expect_scalar sW $''' l&&(( [__&& r c|ddd|xjdz c_|d|j|_dS)N[Tr6rr)rsr/rbexpect_first_flow_sequence_itemr*rFs r rzEmitter.expect_flow_sequencesR S$4888 1 $'''9 r ct|jtrd|j|_|xjdzc_|dd|j|_ dS|j s|j |j kr| |j|j|ddS)Nr]FTr)rQr,SequenceEndEventr-rLr.r/rsr(r*r9r5r<rtrJexpect_flow_sequence_itemrrFs r rz'Emitter.expect_first_flow_sequence_items dj"2 3 3 ,,**,,DK OOq OO  e , , ,**DJJJ~ $t!>!>!!### K  t= > > >   d  + + + + +r cPt|jtr|j|_|xjdzc_|jr*|dd| |dd|j |_ dS|dd|js|j |j kr| |j |j|ddS)Nr,FrTr)rQr,rr-rLr.r/r9rsrtr(r*r5r<rJrrrFs r rz!Emitter.expect_flow_sequence_item$s dj"2 3 3 ,,**,,DK OOq OO~ $$$S%000!!###  e , , ,**DJJJ  e , , ,~ $t!>!>!!### K  t= > > >   d  + + + + +r c|ddd|xjdz c_|d|j|_dS)N{Trrr)rsr/rbexpect_first_flow_mapping_keyr*rFs r rzEmitter.expect_flow_mapping6sR S$4888 1 $'''7 r ct|jtrd|j|_|xjdzc_|dd|j|_ dS|j s|j |j kr| |j sL|r8|j|j|dddS|dd|j|j|ddS)Nr}FTrr?r)rQr,MappingEndEventr-rLr.r/rsr(r*r9r5r<rtcheck_simple_keyrJ expect_flow_mapping_simple_valuerexpect_flow_mapping_valuerFs r rz%Emitter.expect_first_flow_mapping_key<s3 dj/ 2 2 /,**,,DK OOq OO  e , , ,**DJJJ~ $t!>!>!!###> /d&;&;&=&= / ""4#HIII  $ ?????$$S$/// ""4#ABBB   .....r c"t|jtr|j|_|xjdzc_|jr*|dd| |dd|j |_ dS|dd|js|j |j kr| |jsL|r8|j |j|dddS|dd|j |j|ddS) NrrFrTrrr)rQr,rr-rLr.r/r9rsrtr(r*r5r<rrJrrrrFs r expect_flow_mapping_keyzEmitter.expect_flow_mapping_keyMs{ dj/ 2 2 /,**,,DK OOq OO~ $$$S%000!!###  e , , ,**DJJJ  e , , ,~ $t!>!>!!###> /d&;&;&=&= / ""4#HIII  $ ?????$$S$/// ""4#ABBB   .....r c|dd|j|j|ddSN:FTr)rsr(rJrrrFs r rz(Emitter.expect_flow_mapping_simple_valuebsN S%((( 47888 &&&&&r c|js|j|jkr||dd|j|j|ddS)NrTr) r9r5r<rtrsr(rJrrrFs r rz!Emitter.expect_flow_mapping_valuegsx > T[4?::       S$''' 47888 &&&&&r cj|jo|j }|d||j|_dS)NF)r`ra)r2r7rb expect_first_block_sequence_itemr*)rras r rzEmitter.expect_block_sequenceps;*A4>/A  %J???: r c.|dSrk)expect_block_sequence_itemrFs r rz(Emitter.expect_first_block_sequence_itemus..T.:::r c||sXt|jtr>|j|_|j|_dS|| ddd|j |j | ddS)N-Tr7r) rQr,rr-rLr.r(r*rtrsrJrrrrls r rz"Emitter.expect_block_sequence_itemxs ,DJ0@AA ,,**,,DK**DJJJ        dd ; ; ; K  t> ? ? ?   d  + + + + +r cJ|d|j|_dS)NFr)rbexpect_first_block_mapping_keyr*rFs r rzEmitter.expect_block_mappings' %(((8 r c.|dSrk)expect_block_mapping_keyrFs r rz&Emitter.expect_first_block_mapping_keys,,4,888r c|sXt|jtr>|j|_|j|_dS|| r8|j |j | dddS| ddd|j |j| ddS)NTrrrr)rQr,rr-rLr.r(r*rtrrJ!expect_block_mapping_simple_valuerrsexpect_block_mapping_valuers r rz Emitter.expect_block_mapping_keys /DJ@@ /,**,,DK**DJJJ      $$&& / ""4#IJJJ  $ ?????$$S$$$??? ""4#BCCC   .....r c|dd|j|j|ddSr)rsr(rJrrrFs r rz)Emitter.expect_block_mapping_simple_valuesN S%((( 48999 &&&&&r c||ddd|j|j|ddS)NrTrr)rtrsr(rJrrrFs r rz"Emitter.expect_block_mapping_valuese  S$$777 48999 &&&&&r ct|jto&|jot|jdtSrI)rQr,rTr+rrFs r rzEmitter.check_empty_sequences<4:'9::At{At{1~/?@@ Br ct|jto&|jot|jdtSrI)rQr,rUr+rrFs r rzEmitter.check_empty_mappings;4:'899@dk@t{1~?? Ar ct|jtr|jsdS|jd}t|to#|jduo|jduo|jo |jdkS)NFr ) rQr,rRr+rrtagrvaluerMs r rzEmitter.check_empty_documents}$*&899  5 A5+..O5<43GOI%O*/.O=B[B=N Pr cnd}t|jtrN|jjB|j$||jj|_|t |jz }t|jttfrN|jj B|j $| |jj |_ |t |j z }t|jtrG|j $| |jj|_ |t |j jz }|dkout|jt p[t|jto|j j o |j j p'|p|S)Nr )rQr, NodeEventrr?prepare_anchorr\rrXrr@ prepare_tagrAanalyze_scalarrrrrrrr)rlengths r rzEmitter.check_simple_keys dj) , , 01B1N#+'+':':4:;L'M'M$ c$.// /F dj;0D"E F F -JN. ($($4$4TZ^$D$D! c$+,, ,F dj+ . . 0}$ $ 3 3DJ4D E E c$-.// /F J*TZ"D"D#I4:{33P M//P8< 8O4O#I((**#I/3.F.F.H.H Kr c|jj d|_dS|j$||jj|_|jr|||jzdd|_dS)NT)r,rr?rrs)r indicators r rzEmitter.process_anchorsv :  $#'D F   '#'#6#6tz7H#I#ID   G  4+?!? F F F#r cX|jj}t|jtr|j||_|jr|C|jdkr|jjds|jdkr|jjdr d|_dS|jjdr | d}d|_n|jr||jjr d|_dS|td|j| ||_|jr| |jdd|_dS)Nrr rrztag is not specifiedT) r,rrQrrBchoose_scalar_styler9rr@rrrs)rrs r rzEmitter.process_tags:jn dj+ . . z!!5577 ^ s{*""tz':1'=" J",,1DQ1G,$(!z"1% )#+$(!N cktz7Jk$(! ;566 6   $ $ 0 0 5 5D    :  !2D 9 9 9 r cR|j$||jj|_|jjdks|jrdS|jjsY|jjdrG|jr|jjs4|jj s(|j r |jj s|j s|jj rdS|jjr4|jjdvr&|j s|js|jj r |jjS|jjr|jjdkr!|jjr|jr |jj sdSdS)N"r rz|>')rArr,rrBr9rr3rrr/rrrrrFs r rzEmitter.choose_scalar_stylesO =  // 0@AADM : s " "dn "3z DJ$7$: , ]( ,0M,C _ )-)G !O 15 0O r :  ( 0D 8 8O (D,C ( 1 (z''z 4:#3t#;#; 1 0 59]5L tsr cd|j$||jj|_|j||_|j }|jdkr!||jj|n|jdkr!| |jj|nv|jdkr | |jjnK|jdkr | |jjn | |jj|d|_d|_dS)Nrr>|) rArr,rrBrr3write_double_quotedrwrite_single_quoted write_folded write_literal write_plain)rsplits r rzEmitter.process_scalars! =  // 0@AADM : 1133DJ,, :    $ $T]%95 A A A A Z4    $ $T]%95 A A A A Z3     dm2 3 3 3 3 Z3     t}3 4 4 4 4   T]15 9 9 9  r cN|\}}|dkrtd||fzd||fzS)Nrzunsupported YAML version: %d.%dz%d.%dr)rrqmajorminors r ruzEmitter.prepare_versions; u A::@E5>QRR R%''r c"|std|ddks |ddkrtd|z|ddD]H}d|cxkrdks9nd |cxkrd ks*nd |cxkrd ksn|d vstd|d|I|S)Nztag handle must not be emptyr rrWz*tag handle must start and end with '!': %rr09AZaz-_invalid character z in the tag handle: r)rrchs r r{zEmitter.prepare_tag_handle!s ?=>> > !9  vbzS00KfTUU U2, ( (B2$$$$$$$$r(8(8(8(8S(8(8(8(8C2> > !9  CCKKBbC3"#3#3#3#3#3#3#3#3sb7G7G7G7GC7G7G7G7G555q3;;MM&s"3444!!e#yy))66BMM(SWW"45555CKK 3;; MM&s+ , , ,wwvr c|std|dkr|Sd}|}t|j}|D]a}||rJ|dks t |t |kr$|j|}|t |d}bg}dx}}|t |kr||} d| cxkrdks0nd| cxkrdks!nd| cxkrd ksn| d vs | dkr |dkr|d z }n\||kr|||||d zx}}| d } | D]} |d | z|t |k||kr||||d|} |r|| Sd| zS)Nztag must not be emptyrr rrrrrrz-;/?:@&=+$,_.~*'()[]rrrrz!<%s>) rryr>rz startswithr\rJrr) rrrsuffixprefixesrrrrrr suffix_texts r rzEmitter.prepare_tagDs1 8677 7 #::J$+002233 + +F~~f%% +3#f++C*@*@*62S[[\\*CKKBbC3"#3#3#3#3#3#3#3#3sb7G7G7G7GC7G7G7G7G444c fmmq3;;MM&s"3444!!e#yy))11BMM(R-0000CKK 3;; MM&s+ , , ,ggfoo  )#V[[1 1[( (r c|std|D]H}d|cxkrdks9nd|cxkrdks*nd|cxkrdksn|dvstd |d |I|S) Nzanchor must not be emptyrrrrrrrrz in the anchor: r)rrrs r rzEmitter.prepare_anchorhs ;9:: : ( (B2$$$$$$$$r(8(8(8(8S(8(8(8(8C2'"%@`z?:rz,?[]{}r# …

r$ ~… ퟿�u𐀀u􏿿)rr r\r:)rrblock_indicatorsflow_indicators line_breaksspecial_characters leading_space leading_breaktrailing_spacetrailing_break break_space space_breakpreceded_by_whitespacefollowed_by_whitespaceprevious_spaceprevious_breakindexrunicode_charactersrrrrrs r rzEmitter.analyze_scalarrsn '!tu%*d(,$ %''' ' ! "       U # # #v'8'8'?'? ## "O"&#&f++"2#9q 88 c&kk!!Bzz---&*O'+$::&*O-0+/(99!79&*O'+$>>&*O99&*O-0+/(99!79&*O'+$)))" $JJ&B"8"8"8"8&"8"8"8"8&LLFb$<$<$<$T]55h?? > K  hoodm<< = = = = = > > > >r c.|dSr)rrFs r rzEmitter.write_stream_ends r c|js|s|}nd|z}||_|jo||_|xjt|z c_d|_|jr||j}|j|dS)NrF) r6r7r5r\r8r'rr&r-)rrneed_whitespacer6r7rs r rszEmitter.write_indicator s ? !/ !DDy=D$5I s4yy  = .;;t}--D $r cN|jpd}|jr|j|ks|j|kr|js||j|krXd|_d||jz z}||_|jr||j}|j|dSdS)Nr Tr) r.r7r5r6write_line_breakr'rr&r-)rr.rs r rtzEmitter.write_indent.s!~ $v!5!5K6))$/)  ! ! # # # ;  "DOt{*+D DK} 2{{4=11 K  d # # # # # r c||j}d|_d|_|xjdz c_d|_|jr||j}|j|dS)NTrr ) r=r6r7r4r5r'rr&r-)rrs r r2zEmitter.write_line_break;sl <'D Q  = .;;t}--D $r cd|z}|jr||j}|j||dS)Nz %%YAML %sr'rr&r-r2)rrrs r rvzEmitter.write_version_directiveFsW\) = .;;t}--D $ r cd|d|}|jr||j}|j||dS)Nz%TAG rr5)rrrrs r r}zEmitter.write_tag_directiveMs_ + [[9 = .;;t}--D $ r Tc|ddd}d}dx}}|t|krDd}|t|kr||}|r||dkr|dz|kr@|j|jkr0|r.|dkr(|t|kr|nb|||}|xjt|z c_|jr||j}|j||}n|rz||dvrs||dkr| |||D]2} | dkr| | | 3||}nv| |d vs|dkrj||krd|||}|xjt|z c_|jr||j}|j||}|dkrRd }|xjd z c_|jr||j}|j||dz}| |dk}|dv}|dz }|t|kD|dddS) NrTFr rrrr$ …

z''r!) rsr\r5r<rtr'rr&r-r2) rtextrspacesbreaksrrrrbrs r rzEmitter.write_single_quotedVs T4(((SYYBSYY#Y $:sQw#~~$+*G*GE*G % sc$ii/?/?))++++#E#I s4yy0 =>#';;t}#=#=D ))$///E $:+?!?!?E{d**--///"59o66:: 113333 11"5555%%'''E:'#';;t}#=#=D ))$/// #Tzz q =6;;t}55D !!$'''a~) 44 1HC]SYY^ T5)))))r rrbtnvfrer\N_LP) r$  r%rrDrru
u
c:|dddx}}|t|krd}|t|kr||}|;|dvs7d|cxkrdksPn|jr d|cxkrdks9nd |cxkrd ks)n||krd|||}|xjt|z c_|jr||j}|j||}|||jvrd |j|z}nD|d krd t|z}n+|dkrdt|z}ndt|z}|xjt|z c_|jr||j}|j||dz}d|cxkrt|dz krnn|dks||kr |j||z z|j kr|r|||d z}||kr|}|xjt|z c_|jr||j}|j|| d|_ d|_ ||dkrZd }|xjt|z c_|jr||j}|j||dz }|t|k|dddS)NrTr u "\…

rrrrrrrDÿz\x%02Xu￿z\u%04Xz\U%08XrF)rsr\r:r5r'rr&r-ESCAPE_REPLACEMENTSrr<rtr6r7)rr9rrrrrs r rzEmitter.write_double_quotedse S$'''SYYBSYY#YzR#>>>"b2222F2222 .3!'2!9!9!9!9!9!9!9!9#+r#=#=#=#=X#=#=#=#=3;;c ?DKK3t99,KK}:#{{4=99K%%d+++E>T555#D$#';;t}#=#=D ))$///E:'#';;t}#=#=D ))$///E 111E{d**--///"59o66:: 113333 11"5555%%'''&+DO%*DNE:'>> ).      $ $ $           4*4*4*4*n$4)4)4)4)l   444l!!!F999999r N)__all__errorrr+rrrr r r r^s n %     9    ' ' ' ' ' ' ' 'RRRRRRRRRRr