Hacked By AnonymousFox

Current Path : /opt/alt/python37/lib64/python3.7/site-packages/yaml/__pycache__/
Upload File :
Current File : //opt/alt/python37/lib64/python3.7/site-packages/yaml/__pycache__/scanner.cpython-37.pyc

B

b�`M��@sLddgZddlmZddlTGdd�de�ZGdd�d�ZGdd�d�Zd	S)
�Scanner�ScannerError�)�MarkedYAMLError)�*c@seZdZdS)rN)�__name__�
__module__�__qualname__�r	r	�?/opt/alt/python37/lib64/python3.7/site-packages/yaml/scanner.pyr sc@seZdZdd�ZdS)�	SimpleKeycCs(||_||_||_||_||_||_dS)N)�token_number�required�index�line�column�mark)�selfrr
rrrrr	r	r
�__init__&szSimpleKey.__init__N)rrrrr	r	r	r
r#src@szeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�Zd%d&�Zd'd(�Zd)d*�Zd+d,�Zd-d.�Zd/d0�Zd1d2�Zd3d4�Zd5d6�Zd7d8�Zd9d:�Zd;d<�Z d=d>�Z!d?d@�Z"dAdB�Z#dCdD�Z$dEdF�Z%dGdH�Z&dIdJ�Z'dKdL�Z(dMdN�Z)dOdP�Z*dQdR�Z+dSdT�Z,dUdV�Z-dWdX�Z.dYdZ�Z/d[d\�Z0d]d^�Z1d_d`�Z2dadb�Z3dcdd�Z4dedf�Z5dgdh�Z6didj�Z7dkdl�Z8dmdn�Z9dodp�Z:dqdr�Z;dsdt�Z<dudv�Z=dwdx�Z>dydz�Z?d{d|�Z@d}d~dd�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d��ZAd�d�d�d��ZBd�d��ZCd�d��ZDd�d��ZEd�d��ZFd�d��ZGd�d��ZHd�d��ZId�d��ZJd�d��ZKd�S)�rcCs<d|_d|_g|_|��d|_d|_g|_d|_i|_dS)zInitialize the scanner.F����TN)	�done�
flow_level�tokens�fetch_stream_start�tokens_taken�indent�indents�allow_simple_key�possible_simple_keys)rr	r	r
r0szScanner.__init__cGsJx|��r|��qW|jrF|s$dSx |D]}t|jd|�r*dSq*WdS)NTrF)�need_more_tokens�fetch_more_tokensr�
isinstance)r�choices�choicer	r	r
�check_tokenqs

zScanner.check_tokencCs.x|��r|��qW|jr&|jdSdSdS)Nr)rr r)rr	r	r
�
peek_token}s


zScanner.peek_tokencCs:x|��r|��qW|jr6|jd7_|j�d�SdS)Nrr)rr rr�pop)rr	r	r
�	get_token�s

zScanner.get_tokencCs2|jr
dS|jsdS|��|��|jkr.dSdS)NFT)rr�stale_possible_simple_keys�next_possible_simple_keyr)rr	r	r
r�szScanner.need_more_tokenscCs�|��|��|�|j�|��}|dkr4|��S|dkrL|��rL|��S|dkrd|��rd|�	�S|dkr||�
�r||��S|dkr�|��S|dkr�|�
�S|dkr�|��S|dkr�|��S|d	kr�|��S|dkr�|��r�|��S|d
kr�|��r�|��S|dk�r|���r|��S|dk�r*|��S|d
k�r<|��S|dk�rN|��S|dk�rh|j�sh|��S|dk�r�|j�s�|��S|dk�r�|��S|dk�r�|��S|���r�|� �St!ddd||�"���dS)N��%�-�.�[�{�]�}�,�?�:r�&�!�|�>�'�"z!while scanning for the next tokenz.found character %r that cannot start any token)#�scan_to_next_tokenr(�
unwind_indentr�peek�fetch_stream_end�check_directive�fetch_directive�check_document_start�fetch_document_start�check_document_end�fetch_document_end�fetch_flow_sequence_start�fetch_flow_mapping_start�fetch_flow_sequence_end�fetch_flow_mapping_end�fetch_flow_entry�check_block_entry�fetch_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_plainr�get_mark)r�chr	r	r
r �s^	





zScanner.fetch_more_tokenscCs:d}x0|jD]&}|j|}|dks,|j|kr|j}qW|S)N)rr)rZmin_token_number�level�keyr	r	r
r)s

z Scanner.next_possible_simple_keycCs`xZt|j�D]L}|j|}|j|jks6|j|jdkr|jrPtd|jd|����|j|=qWdS)Nizwhile scanning a simple keyzcould not find expected ':')�listrrrr
rrrY)rr[r\r	r	r
r(s
z"Scanner.stale_possible_simple_keyscCs^|jo|j|jk}|jrZ|��|jt|j�}t|||j	|j
|j|���}||j|j<dS)N)
rrrr�remove_possible_simple_keyr�lenrrrrrYr)rr
rr\r	r	r
�save_possible_simple_key'sz Scanner.save_possible_simple_keycCs@|j|jkr<|j|j}|jr2td|jd|����|j|j=dS)Nzwhile scanning a simple keyzcould not find expected ':')rrr
rrrY)rr\r	r	r
r^8sz"Scanner.remove_possible_simple_keycCsD|jr
dSx4|j|kr>|��}|j��|_|j�t||��qWdS)N)rrrYrr&r�appendZ
BlockEndToken)rrrr	r	r
r<EszScanner.unwind_indentcCs&|j|kr"|j�|j�||_dSdS)NTF)rrra)rrr	r	r
�
add_indent]s

zScanner.add_indentcCs$|��}|j�t|||jd��dS)N)�encoding)rYrraZStreamStartTokenrc)rrr	r	r
rgszScanner.fetch_stream_startcCsB|�d�|��d|_i|_|��}|j�t||��d|_dS)NrFT)	r<r^rrrYrraZStreamEndTokenr)rrr	r	r
r>ss
zScanner.fetch_stream_endcCs,|�d�|��d|_|j�|���dS)NrF)r<r^rrra�scan_directive)rr	r	r
r@�s
zScanner.fetch_directivecCs|�t�dS)N)�fetch_document_indicatorZDocumentStartToken)rr	r	r
rB�szScanner.fetch_document_startcCs|�t�dS)N)reZDocumentEndToken)rr	r	r
rD�szScanner.fetch_document_endcCsH|�d�|��d|_|��}|�d�|��}|j�|||��dS)NrF�)r<r^rrY�forwardrra)r�
TokenClass�
start_mark�end_markr	r	r
re�s

z Scanner.fetch_document_indicatorcCs|�t�dS)N)�fetch_flow_collection_startZFlowSequenceStartToken)rr	r	r
rE�sz!Scanner.fetch_flow_sequence_startcCs|�t�dS)N)rkZFlowMappingStartToken)rr	r	r
rF�sz Scanner.fetch_flow_mapping_startcCsJ|��|jd7_d|_|��}|��|��}|j�|||��dS)NrT)r`rrrYrgrra)rrhrirjr	r	r
rk�sz#Scanner.fetch_flow_collection_startcCs|�t�dS)N)�fetch_flow_collection_endZFlowSequenceEndToken)rr	r	r
rG�szScanner.fetch_flow_sequence_endcCs|�t�dS)N)rlZFlowMappingEndToken)rr	r	r
rH�szScanner.fetch_flow_mapping_endcCsJ|��|jd8_d|_|��}|��|��}|j�|||��dS)NrF)r^rrrYrgrra)rrhrirjr	r	r
rl�sz!Scanner.fetch_flow_collection_endcCs<d|_|��|��}|��|��}|j�t||��dS)NT)rr^rYrgrraZFlowEntryToken)rrirjr	r	r
rI�szScanner.fetch_flow_entrycCs�|jsF|jstddd|����|�|j�rF|��}|j�t||��nd|_|�	�|��}|�
�|��}|j�t||��dS)Nz%sequence entries are not allowed hereT)rrrrYrbrrraZBlockSequenceStartTokenr^rgZBlockEntryToken)rrrirjr	r	r
rK�s
zScanner.fetch_block_entrycCs�|jsD|jstddd|����|�|j�rD|��}|j�t||��|j|_|�	�|��}|�
�|��}|j�t||��dS)Nz!mapping keys are not allowed here)rrrrYrbrrra�BlockMappingStartTokenr^rg�KeyToken)rrrirjr	r	r
rMs

zScanner.fetch_keycCs|j|jkr||j|j}|j|j=|j�|j|jt|j|j��|jst|�|j	�rt|j�|j|jt
|j|j��d|_n\|js�|js�tddd|�
���|js�|�|j	�r�|�
�}|j�t
||��|j|_|��|�
�}|��|�
�}|j�t||��dS)NFz#mapping values are not allowed here)rrr�insertrrrnrrbrrmrrrYrar^rgZ
ValueToken)rr\rrirjr	r	r
rO!s2


zScanner.fetch_valuecCs$|��d|_|j�|�t��dS)NF)r`rrra�scan_anchorZ
AliasToken)rr	r	r
rPYszScanner.fetch_aliascCs$|��d|_|j�|�t��dS)NF)r`rrrarpZAnchorToken)rr	r	r
rQdszScanner.fetch_anchorcCs"|��d|_|j�|���dS)NF)r`rrra�scan_tag)rr	r	r
rRoszScanner.fetch_tagcCs|jdd�dS)Nr7)�style)�fetch_block_scalar)rr	r	r
rSzszScanner.fetch_literalcCs|jdd�dS)Nr8)rr)rs)rr	r	r
rT}szScanner.fetch_foldedcCs$d|_|��|j�|�|��dS)NT)rr^rra�scan_block_scalar)rrrr	r	r
rs�szScanner.fetch_block_scalarcCs|jdd�dS)Nr9)rr)�fetch_flow_scalar)rr	r	r
rU�szScanner.fetch_singlecCs|jdd�dS)Nr:)rr)ru)rr	r	r
rV�szScanner.fetch_doublecCs$|��d|_|j�|�|��dS)NF)r`rrra�scan_flow_scalar)rrrr	r	r
ru�szScanner.fetch_flow_scalarcCs"|��d|_|j�|���dS)NF)r`rrra�
scan_plain)rr	r	r
rX�szScanner.fetch_plaincCs|jdkrdSdS)NrT)r)rr	r	r
r?�s
zScanner.check_directivecCs.|jdkr*|�d�dkr*|�d�dkr*dSdS)Nrrfz---u
 	
…

T)r�prefixr=)rr	r	r
rA�s
zScanner.check_document_startcCs.|jdkr*|�d�dkr*|�d�dkr*dSdS)Nrrfz...u
 	
…

T)rrxr=)rr	r	r
rC�s
zScanner.check_document_endcCs|�d�dkS)Nru
 	
…

)r=)rr	r	r
rJ�szScanner.check_block_entrycCs|jr
dS|�d�dkSdS)NTru
 	
…

)rr=)rr	r	r
rL�szScanner.check_keycCs|jr
dS|�d�dkSdS)NTru
 	
…

)rr=)rr	r	r
rN�szScanner.check_valuecCs6|��}|dkp4|�d�dko4|dkp4|jo4|dkS)Nu  	
…

-?:,[]{}#&*!|>'"%@`ru
 	
…

r,z?:)r=r)rrZr	r	r
rW�szScanner.check_plaincCs�|jdkr|��dkr|��d}xb|s�x|��dkr@|��q*W|��dkrhx|��dkrf|��qPW|��r~|js�d|_q$d}q$WdS)NruF� �#u
…

T)rr=rg�scan_line_breakrr)r�foundr	r	r
r;�szScanner.scan_to_next_tokencCs�|��}|��|�|�}d}|dkr:|�|�}|��}n>|dkrV|�|�}|��}n"|��}x|��dkrv|��q`W|�|�t||||�S)NZYAMLZTAGu
…

)rYrg�scan_directive_name�scan_yaml_directive_value�scan_tag_directive_valuer=�scan_directive_ignored_lineZDirectiveToken)rri�name�valuerjr	r	r
rds





zScanner.scan_directivecCs�d}|�|�}x`d|kr$dksZnd|kr:dksZnd|krPdksZn|dkrn|d	7}|�|�}qW|s�td
|d||����|�|�}|�|�|��}|dkr�td
|d||����|S)
Nr�0�9�A�Z�a�zz-_rzwhile scanning a directivez6expected alphabetic or numeric character, but found %ru 
…

)r=rrYrxrg)rri�lengthrZr�r	r	r
r}&s$
D

zScanner.scan_directive_namecCs�x|��dkr|��qW|�|�}|��dkrJtd|d|��|����|��|�|�}|��dkr�td|d|��|����||fS)Nryr-zwhile scanning a directivez%expected a digit or '.', but found %ru 
…

z%expected a digit or ' ', but found %r)r=rg�scan_yaml_directive_numberrrY)rri�major�minorr	r	r
r~;s





z!Scanner.scan_yaml_directive_valuecCs�|��}d|krdks4ntd|d||����d}x*d|�|�krTdkrbnn
|d7}q:Wt|�|��}|�|�|S)Nr�r�zwhile scanning a directivezexpected a digit, but found %rrr)r=rrY�intrxrg)rrirZr�r�r	r	r
r�Ls 
z"Scanner.scan_yaml_directive_numbercCsPx|��dkr|��qW|�|�}x|��dkr<|��q&W|�|�}||fS)Nry)r=rg�scan_tag_directive_handle�scan_tag_directive_prefix)rri�handlerxr	r	r
rYs

z Scanner.scan_tag_directive_valuecCs6|�d|�}|��}|dkr2td|d||����|S)N�	directiveryzwhile scanning a directivezexpected ' ', but found %r)�scan_tag_handler=rrY)rrir�rZr	r	r
r�csz!Scanner.scan_tag_directive_handlecCs6|�d|�}|��}|dkr2td|d||����|S)Nr�u 
…

zwhile scanning a directivezexpected ' ', but found %r)�scan_tag_urir=rrY)rrir�rZr	r	r
r�lsz!Scanner.scan_tag_directive_prefixcCsrx|��dkr|��qW|��dkr@x|��dkr>|��q(W|��}|dkrftd|d||����|��dS)Nryrzu
…

zwhile scanning a directivez0expected a comment or a line break, but found %r)r=rgrrYr{)rrirZr	r	r
r�usz#Scanner.scan_directive_ignored_linec	Cs
|��}|��}|dkrd}nd}|��d}|�|�}x`d|krNdks�nd|krddks�nd	|krzd
ks�n|dkr�|d7}|�|�}q:W|s�td
||d||����|�|�}|�|�|��}|dkr�td
||d||����|��}||||�S)Nr�alias�anchorrr�r�r�r�r�r�z-_rzwhile scanning an %sz6expected alphabetic or numeric character, but found %ru 	
…

?:,]}%@`)rYr=rgrrx)	rrhriZ	indicatorr�r�rZr�rjr	r	r
rp�s2	
D



zScanner.scan_anchorc	Cs&|��}|�d�}|dkrdd}|�d�|�d|�}|��dkrZtd|d|��|����|��n~|dkr~d}d	}|��ndd}d
}x,|dkr�|d	kr�d}P|d7}|�|�}q�Wd	}|r�|�d|�}nd	}|��|�d|�}|��}|dk�r
td
|d||����||f}|��}t|||�S)Nr�<��tagr8zwhile parsing a tagzexpected '>', but found %ru
 	
…

r6Fu 
…

Tzwhile scanning a tagzexpected ' ', but found %r)rYr=rgr�rr�ZTagToken)	rrirZr��suffixr�Z
use_handler�rjr	r	r
rq�sH







zScanner.scan_tagcCs�|dkrd}nd}g}|��}|��|�|�\}}|�|�|jd}|dkrTd}|dkrv|��\}}	}
t||	�}n||d}|�|�\}}
d}x�|j|k�rv|�	�dk�rv|�
|�|�	�dk}
d}x|�	|�d	kr�|d7}q�W|�|�|��|�|�|�
�}|�|�\}}
|j|k�rr|�	�dk�rr|�rf|d
k�rf|
�rf|�	�dk�rf|�sp|�d�n
|�|�q�Pq�W|dk	�r�|�|�|dk�r�|�
|�td�|�d||
|�S)Nr8TFr�r*z 	ru
…

�
ry)rYrg�scan_block_scalar_indicators�scan_block_scalar_ignored_liner�scan_block_scalar_indentation�max�scan_block_scalar_breaksrr=�extendrarxr{�ScalarToken�join)rrr�folded�chunksri�chomping�	incrementZ
min_indent�breaks�
max_indentrjr�
line_breakZleading_non_spacer�r	r	r
rt�sP







zScanner.scan_block_scalarcCs�d}d}|��}|dkrn|dkr&d}nd}|��|��}|dkr�t|�}|dkrdtd|d|����|��n\|dkr�t|�}|dkr�td|d|����|��|��}|dkr�|dkr�d}nd}|��|��}|d	kr�td|d
||����||fS)Nz+-�+TF�
0123456789rzwhile scanning a block scalarz<expected indentation indicator in the range 1-9, but found 0u 
…

z9expected chomping or indentation indicators, but found %r)r=rgr�rrY)rrir�r�rZr	r	r
r�sF


z$Scanner.scan_block_scalar_indicatorscCsrx|��dkr|��qW|��dkr@x|��dkr>|��q(W|��}|dkrftd|d||����|��dS)Nryrzu
…

zwhile scanning a block scalarz0expected a comment or a line break, but found %r)r=rgrrYr{)rrirZr	r	r
r�Ds
z&Scanner.scan_block_scalar_ignored_linecCshg}d}|��}xL|��dkr\|��dkrB|�|���|��}q|��|j|kr|j}qW|||fS)Nru 
…

ry)rYr=rar{rgr)rr�r�rjr	r	r
r�Rs


z%Scanner.scan_block_scalar_indentationcCs�g}|��}x"|j|kr.|��dkr.|��qWxJ|��dkrz|�|���|��}x"|j|krv|��dkrv|��qVWq2W||fS)Nryu

…

)rYrr=rgrar{)rrr�rjr	r	r
r�asz Scanner.scan_block_scalar_breakscCs�|dkrd}nd}g}|��}|��}|��|�|�||��x4|��|krt|�|�||��|�|�||��qBW|��|��}td�|�d|||�S)Nr:TFr�)rYr=rgr��scan_flow_scalar_non_spaces�scan_flow_scalar_spacesr�r�)rrr�doubler�ri�quoterjr	r	r
rvnszScanner.scan_flow_scalarr*���	r����
�ryr:�\�/�…� u
u
)r�r��b�tr��n�v�f�r�eryr:r�r��N�_�L�Pr���)�x�u�Uc	Cs�g}�x�d}x|�|�dkr&|d7}qW|rF|�|�|��|�|�|��}|s~|dkr~|�d�dkr~|�d�|�d�q|r�|dks�|s�|dkr�|�|�|��q|�r�|dk�r�|��|��}||jkr�|�|j|�|��n�||jk�rz|j|}|��xBt|�D]6}|�|�dk�rtd	|d
||�|�f|�����qWt	|�|�d�}|�t
|��|�|�n<|dk�r�|��|�|�
||��ntd	|d
||����q|SqWdS)Nru'"\ 	
…

rr9r�z"\r��0123456789ABCDEFabcdefz%while scanning a double-quoted scalarz?expected escape sequence of %d hexdecimal numbers, but found %r�u

…

z!found unknown escape character %r)r=rarxrg�ESCAPE_REPLACEMENTS�ESCAPE_CODES�rangerrYr��chrr{r��scan_flow_scalar_breaks)rr�rir�r�rZ�k�coder	r	r
r��sL







z#Scanner.scan_flow_scalar_non_spacesc	Cs�g}d}x|�|�dkr"|d7}q
W|�|�}|�|�|��}|dkr\td|d|����nT|dkr�|��}|�||�}|dkr�|�|�n|s�|�d	�|�|�n
|�|�|S)
Nrz 	rr*zwhile scanning a quoted scalarzfound unexpected end of streamu

…

r�ry)	r=rxrgrrYr{r�rar�)	rr�rir�r��whitespacesrZr�r�r	r	r
r��s(



zScanner.scan_flow_scalar_spacescCs�g}xx|�d�}|dks |dkr@|�d�dkr@td|d|����x|��dkrX|��qBW|��dkrv|�|���q|SqWdS)	Nrfz---z...u
 	
…

zwhile scanning a quoted scalarz#found unexpected document separatorz 	u

…

)rxr=rrYrgrar{)rr�rir�rxr	r	r
r��s
zScanner.scan_flow_scalar_breakscCsg}|��}|}|jd}g}x�d}|��dkr2PxV|�|�}|dks||dkrn|�|d�d|jrfdndks||jr~|dkr~P|d7}q4W|dkr�Pd	|_|�|�|�|�|��|�|�|��}|�	||�}|r�|��dks�|js |j
|kr Pq Wtd�|�d
||�S)Nrrrzu
 	
…

r4z,[]{}r�z,?[]{}FT)
rYrr=rrr�rarxrg�scan_plain_spacesrr�r�)rr�rirjr�spacesr�rZr	r	r
rw�s<



zScanner.scan_plainc
Cs.g}d}x|�|�dkr"|d7}q
W|�|�}|�|�|��}|dk�r|��}d|_|�d�}|dksr|dkr�|�d�d	kr�dSg}	x`|��d
kr�|��dkr�|��q�|	�|���|�d�}|dks�|dkr�|�d�d	kr�dSq�W|dkr�|�|�n|	�s|�d�|�|	�n|�r*|�|�|S)Nrryru

…

Trfz---z...u
 	
…

u 
…

r�)r=rxrgr{rrar�)
rrrir�r�r�rZr�rxr�r	r	r
r�s>







zScanner.scan_plain_spacescCs�|��}|dkr*td||d||����d}|�|�}|dkr�x`d|krVdks�nd|krld	ks�nd
|kr�dks�n|dkr�|d7}|�|�}qBW|dkr�|�|�td||d||����|d7}|�|�}|�|�|S)
Nr6zwhile scanning a %szexpected '!', but found %rrryr�r�r�r�r�r�z-_)r=rrYrgrx)rr�rirZr�r�r	r	r
r�Ds&

D



zScanner.scan_tag_handlecCs�g}d}|�|�}x�d|kr(dks^nd|kr>dks^nd|krTdks^n|dkr�|d	kr�|�|�|��|�|�d}|�|�||��n|d
7}|�|�}qW|r�|�|�|��|�|�d}|s�td||d||����d
�|�S)Nrr�r�r�r�r�r�z-;/?:@&=+$,_.!~*'()[]%r+rzwhile parsing a %szexpected URI, but found %rr�)r=rarxrg�scan_uri_escapesrrYr�)rr�rir�r�rZr	r	r
r�\s(
D


zScanner.scan_tag_uric
Cs�g}|��}xx|��dkr�|��x>td�D]2}|�|�dkr,td||d|�|�|����q,W|�t|�d�d��|�d�qWyt|��	d�}Wn8t
k
r�}ztd||t|�|��Wdd}~XYnX|S)Nr+r�r�zwhile scanning a %szBexpected URI escape sequence of 2 hexdecimal numbers, but found %rr�zutf-8)rYr=rgr�rrar�rx�bytes�decode�UnicodeDecodeError�str)rr�ri�codesrr�r��excr	r	r
r�us 
(zScanner.scan_uri_escapescCsN|��}|dkr6|�d�dkr*|�d�n|��dS|dkrJ|��|SdS)Nu
…r�z
r�u

r�)r=rxrg)rrZr	r	r
r{�s	zScanner.scan_line_breakN)Lrrrrr$r%r'rr r)r(r`r^r<rbrr>r@rBrDrerErFrkrGrHrlrIrKrMrOrPrQrRrSrTrsrUrVrurXr?rArCrJrLrNrWr;rdr}r~r�rr�r�r�rprqrtr�r�r�r�rvr�r�r�r�r�rwr�r�r�r�r{r	r	r	r
r.s�A

l

!8

#

		$)L(
+)%N)�__all__�errorrrrrrr	r	r	r
�<module>s


Hacked By AnonymousFox1.0, Coded By AnonymousFox