mfchddgZddlmZddlTddlTddlTGddeZGddZdS)Parser ParserError)MarkedYAMLError)*ceZdZdS)rN)__name__ __module__ __qualname__B/opt/imunify360/venv/lib64/python3.11/site-packages/yaml/parser.pyrrEsDr ceZdZdddZdZdZdZdZdZd Z d Z d Z d Z d Z dZdZdZdZd%dZdZdZdZdZdZdZdZd&dZdZdZdZdZd&d Zd!Z d"Z!d#Z"d$S)'r!ztag:yaml.org,2002:)rz!!cdd|_d|_i|_g|_g|_|j|_dSN) current_event yaml_version tag_handlesstatesmarksparse_stream_startstateselfs r __init__zParser.__init__Qs6!   , r c"g|_d|_dSr)rrrs r disposezParser.disposeYs  r c|j |jr||_|j!|sdS|D]}t|j|rdSdS)NTF)rr isinstance)rchoiceschoices r check_eventzParser.check_event^sp   %z 2%)ZZ\\"   ) t!  d0&99 44 ur c^|j |jr||_|jSrrrrs r peek_eventzParser.peek_eventks.   %z 2%)ZZ\\"!!r cp|j |jr||_|j}d|_|Srr$)rvalues r get_eventzParser.get_eventrs:   %z 2%)ZZ\\""! r c|}t|j|j|j}|j|_|S)N)encoding) get_tokenStreamStartEvent start_markend_markr*parse_implicit_document_startrrtokenevents r rzParser.parse_stream_startsF   !15>)))7  r cF|tttsh|j|_|}|jx}}t||d}|j |j |j |_ |S|S)NFexplicit) check_tokenDirectiveTokenDocumentStartTokenStreamEndToken DEFAULT_TAGSr peek_tokenr-DocumentStartEventrappendparse_document_endparse_block_noderparse_document_start)rr1r-r.r2s r r/z$Parser.parse_implicit_document_starts0B   /#0D OO%%E$)$4 4J&z8"$$$E K  t6 7 7 7.DJL,,.. .r c,|tr.||t.|ts|}|j}|\}}|tsCtddd|j z|j|}|j }t||d||}|j |j|j|_nG|}t#|j|j }|j rJ|jrJd|_|S)Nz)expected '', but found %rT)r5versiontags)r6DocumentEndTokenr+r9r;r-process_directivesr8ridr.r<rr=r>parse_document_contentrStreamEndEventr)rr1r-rBrCr.r2s r r@zParser.parse_document_starts/00  NN   /00 // OO%%E)J 3355MGT##$677 6!$C//++./))4666NN$$E~H&z8!7???E K  t6 7 7 74DJJNN$$E"5#3U^DDE{ " "?z ! !>DJ r c|}|jx}}d}|tr|}|j}d}t |||}|j|_|S)NFTr4) r;r-r6rDr+r.DocumentEndEventr@r)rr1r-r.r5r2s r r>zParser.parse_document_ends!! % 00 X   , - - NN$$E~HH X!###.  r c|ttttrL||j}|j |_ |S| Sr) r6r7r8rDr9process_empty_scalarr;r-rpoprr?)rr2s r rGzParser.parse_document_contentsp   N"$4n F F +--doo.?.?.JKKE**DJL((** *r cd|_i|_|tr|}|jdkrR|jt ddd|j|j\}}|dkrt ddd|j|j|_nB|jdkr7|j\}}||jvrt ddd|z|j||j|<|t|jr!|j|j f}n |jdf}|j D] }||jvr|j ||j|<!|S)NYAMLzfound duplicate YAML directiverz:found incompatible YAML document (version 1.* is required)TAGzduplicate tag handle %r) rrr6r7r+namerr-r'copyr:)rr1majorminorhandleprefixr'keys r rEzParser.process_directivess ~.. 2NN$$EzV##$0%dDNPPP${ uA::%dDX!,...%*K!!u$$!&T---%dD5>!,...,2 (%~.. 2&   ,%t'7'<'<'>'>>EE%t+E$ ? ?C$***(,(9#(> % r c.|dS)NT)block parse_noders r r?zParser.parse_block_nodesT***r c*|SrrZrs r parse_flow_nodezParser.parse_flow_node s   r c0|ddS)NT)rYindentless_sequencerZrs r 'parse_block_node_or_indentless_sequencez.Parser.parse_block_node_or_indentless_sequencesTtDDDr Fc 4 |trT|}t|j|j|j}|j|_ n)d}d}dx}x}} |trm|}|j}|j}|j}|tr)|}|j} |j}|j}n|trg|}|jx}} |j}|j}|tr"|}|j}|j}|8|\} } | /| |j vrtd|d| z| |j | | z}n| }||jx}}d}|dup|dk} |rT|tr:|j}t!||| ||}|j|_ n^|t$rt|}|j}|jr||dkrd} n|d} nd} t)||| |j|||j}|j|_ n|t,r<|j}t!||| ||d }|j|_ nz|t0r<|j}t3||| ||d }|j|_ n$|rU|t6r;|j}t!||| ||d }|j|_ n|rU|t:r;|j}t3||| ||d }|j|_ nv||5t)||| d fd ||}|j|_ n=|rd } nd } |}td| z|d|jz|j|S)Nzwhile parsing a nodezfound undefined tag handle %rrTF)FTFF)styleT flow_styleFrYflowzwhile parsing a %s nodez'expected the node content, but found %r) r6 AliasTokenr+ AliasEventr'r-r.rrMr AnchorTokenTagTokenrrr;BlockEntryTokenSequenceStartEventparse_indentless_sequence_entry ScalarTokenplain ScalarEventrdFlowSequenceStartTokenparse_flow_sequence_first_entryFlowMappingStartTokenMappingStartEventparse_flow_mapping_first_keyBlockSequenceStartToken parse_block_sequence_first_entryBlockMappingStartTokenparse_block_mapping_first_keyrF)rrYr_r1r2anchortagr-r.tag_markrUsuffiximplicitnodes r r[zParser.parse_nodes   J ' 'a .NN$$Eu{E,##H--& NN,,E$/H$~H+C!!(++ )(((-(88 X >k##K00) NN,,E$~H"[F!$%T%555)*@* ?& H (****6269CC C !(,(9(9(DD XEt 1sczH"4 .t'7'7'H'H4 .??,,5*63"H..!A ##K00.. NN,,E$~H 2 s #0#0#1'Xu{& EEEE!%!2!2DJJ%%&<==".#009H.vsH&TCCCE!%!EDJJ%%&;<<.#009H-fc8&TCCCE!%!BDJJ.t//0GHH.#00;H.vsH&UDDDE!%!FDJJ.t//0FGG.#00;H-fc8&UDDDE!%!CDJJ'3?(h5F&22E!%!2!2DJJ&&% OO--E%&?$&F EP!,... r c|}|j|j|Sr)r+rr=r-parse_block_sequence_entryrr1s r ryz'Parser.parse_block_sequence_first_entryxs<   %*+++..000r c|tr|}|tts3|j|j|S|j|_| |j S|ts>| }td|j dd|jz|j|}t!|j|j }|j|_|j |S)Nz while parsing a block collection"expected , but found %r)r6rmr+ BlockEndTokenrr=rr?rrLr.r;rrrFr-SequenceEndEventrMr0s r rz!Parser.parse_block_sequence_entry}s.   O , , ANN$$E##O]CC A ""4#BCCC,,...!< 00@@@ .. WOO%%E@$*R.858CUEUWW W   !15>BB[__&&   r c|tr|}|tttt s3|j|j| S|j|_ | |j S| }t|j|j}|j|_ |Sr)r6rmr+KeyToken ValueTokenrrr=ror?rrLr.r;rr-rMr0s r roz&Parser.parse_indentless_sequence_entrys   O , , ANN$$E##Oj-99 A ""4#GHHH,,...!A 00@@@!! !153CDD[__&&  r c|}|j|j|Sr)r+rr=r-parse_block_mapping_keyrs r r{z$Parser.parse_block_mapping_first_keys<   %*+++++---r c|tr|}|ttts3|j|j|S|j|_ | |j S|ts>| }td|jdd|jz|j|}t#|j|j }|j|_ |j|S)Nzwhile parsing a block mappingrr)r6rr+rrrr=parse_block_mapping_valuer`rrLr.r;rrrFr-MappingEndEventrMr0s r rzParser.parse_block_mapping_keys0   H % % ANN$$E##Hj-HH A ""4#ABBBCCEEE!; 00@@@ .. WOO%%E=tz"~858CUEUWW W   0%.AA[__&&   r c|tr|}|ttts3|j|j|S|j|_ | |j S|j|_ | }| |j Sr)r6rr+rrrr=rr`rrLr.r;r-rs r rz Parser.parse_block_mapping_values   J ' ' ?NN$$E##Hj-HH A ""4#?@@@CCEEE!9 00@@@5DJOO%%E,,U-=>> >r c|}|j|j|dSNT)first)r+rr=r-parse_flow_sequence_entryrs r rtz&Parser.parse_flow_sequence_first_entrysA   %*+++--D-999r c4|ts|sm|tr|n>|}t d|jdd|jz|j|trA|}tddd|j|j d}|j |_ |S|ts3|j|j|S|}t%|j|j }|j|_ |j|S)Nzwhile parsing a flow sequencerzexpected ',' or ']', but got %rTre)r6FlowSequenceEndTokenFlowEntryTokenr+r;rrrFr-rrvr.%parse_flow_sequence_entry_mapping_keyrrr=rr]rrMrrr1r2s r rz Parser.parse_flow_sequence_entrysy 455 . \##N33\NN$$$$ OO--E%&EtzRT~=H%JZ\\\)) .)))$d(%.#')))"G  %%&:;; . ""4#ABBB++---   !15>BB[__&&   r c(|}|ttts3|j|j|S|j|_ | |j Sr) r+r6rrrrr='parse_flow_sequence_entry_mapping_valuer]rrLr.rs r rz,Parser.parse_flow_sequence_entry_mapping_keys|    466 = K  tK L L L'')) )EDJ,,U^<< > >r cv|j|_|}t|j|jSr)rrr;rr-rs r rz,Parser.parse_flow_sequence_entry_mapping_ends13 !!u/1ABBBr c|}|j|j|dSr)r+rr=r-parse_flow_mapping_keyrs r rwz#Parser.parse_flow_mapping_first_keysA   %*+++***666r c|tsi|sm|tr|n>|}t d|jdd|jz|j|tr|}|ttts3|j |j |S|j |_||jS|ts3|j |j|S|}t'|j|j}|j |_|j|S)Nzwhile parsing a flow mappingrzexpected ',' or '}', but got %r)r6FlowMappingEndTokenrr+r;rrrFr-rrrr=parse_flow_mapping_valuer]rrLr.parse_flow_mapping_empty_valuerrMrs r rzParser.parse_flow_mapping_keys 344 . \##N33\NN$$$$ OO--E%&DdjQSn=H%JZ\\\)) .(('' &(;==EK&&t'DEEE//111!%!>DJ44U^DDD%%&9:: . ""4#FGGG++---   0%.AA[__&&   r c|tr|}|tts3|j|j|S|j|_ | |j S|j|_ | }| |j Sr)r6rr+rrrr=rr]rrLr.r;r-rs r rzParser.parse_flow_mapping_value9s   J ' ' ?NN$$E##N4GHH A ""4#>???++---!8 00@@@4DJOO%%E,,U-=>> >r cr|j|_||jSr)rrrLr;r-rs r rz%Parser.parse_flow_mapping_empty_valueGs-0 (():):)EFFFr c*tdddd||S)Nrbrg)rr)rmarks r rLzParser.process_empty_scalarKs4}b$EEEr Nrc)F)#rr r r:rrr"r%r(rr/r@r>rGrEr?r]r`r[ryrror{rrrtrrrrrwrrrrLr r r rrHs #L ---   """   ///(>$+++^+++!!!EEEccccN111 *   (... & ? ? ?2::: 4=== ? ? ?CCC777 6 ? ? ?GGGFFFFFr N)__all__errorrtokenseventsscannerrrr r r rs| ] #""""""     /   DFDFDFDFDFDFDFDFDFDFr