ok

Mini Shell

Direktori : /opt/alt/python38/lib64/python3.8/site-packages/yaml/__pycache__/
Upload File :
Current File : //opt/alt/python38/lib64/python3.8/site-packages/yaml/__pycache__/scanner.cpython-38.pyc

U

b�`M��@sLddgZddlmZddlTGdd�de�ZGdd�d�ZGdd�d�Zd	S)
�Scanner�ScannerError�)�MarkedYAMLError)�*c@seZdZdS)rN)�__name__�
__module__�__qualname__�r	r	�?/opt/alt/python38/lib64/python3.8/site-packages/yaml/scanner.pyr sc@seZdZdd�ZdS)�	SimpleKeycCs(||_||_||_||_||_||_dS�N)�token_number�required�index�line�column�mark)�selfr
rrrrrr	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__cGsD|��r|��q|jr@|s dS|D]}t|jd|�r$dSq$dS)NTrF)�need_more_tokens�fetch_more_tokensr�
isinstance)r�choicesZchoicer	r	r
�check_tokenqs
zScanner.check_tokencCs*|��r|��q|jr"|jdSdSdS)Nr)r!r"rr r	r	r
�
peek_token}s


zScanner.peek_tokencCs6|��r|��q|jr2|jd7_|j�d�SdS)Nrr)r!r"rr�popr r	r	r
�	get_token�s

zScanner.get_tokencCs2|jr
dS|jsdS|��|��|jkr.dSdS)NFT)rr�stale_possible_simple_keys�next_possible_simple_keyrr r	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_tokenscCs6d}|jD]&}|j|}|dks*|j|kr
|j}q
|Sr)rr
)rZmin_token_number�level�keyr	r	r
r*s

z Scanner.next_possible_simple_keycCs\t|j�D]L}|j|}|j|jks4|j|jdkr
|jrNtd|jd|����|j|=q
dS)Ni�while scanning a simple key�could not find expected ':')�listrrrrrrrZ)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<dSr)
rrrr�remove_possible_simple_keyr�lenrrrrrZr)rrr
r^r	r	r
�save_possible_simple_key's�z Scanner.save_possible_simple_keycCs@|j|jkr<|j|j}|jr2td|jd|����|j|j=dS)Nr_r`)rrrrrrZ)rr^r	r	r
rb8s�z"Scanner.remove_possible_simple_keycCs@|jr
dS|j|kr<|��}|j��|_|j�t||��q
dSr)rrrZrr'r�appendZ
BlockEndToken)rrrr	r	r
r=Es
zScanner.unwind_indentcCs&|j|kr"|j�|j�||_dSdS)NTF)rrre)rrr	r	r
�
add_indent]s

zScanner.add_indentcCs$|��}|j�t|||jd��dS)N)�encoding)rZrreZStreamStartTokenrg�rrr	r	r
rgs�zScanner.fetch_stream_startcCsB|�d�|��d|_i|_|��}|j�t||��d|_dS)NrFT)	r=rbrrrZrreZStreamEndTokenrrhr	r	r
r?ss
zScanner.fetch_stream_endcCs,|�d�|��d|_|j�|���dS)NrF)r=rbrrre�scan_directiver r	r	r
rA�s
zScanner.fetch_directivecCs|�t�dSr)�fetch_document_indicatorZDocumentStartTokenr r	r	r
rC�szScanner.fetch_document_startcCs|�t�dSr)rjZDocumentEndTokenr r	r	r
rE�szScanner.fetch_document_endcCsH|�d�|��d|_|��}|�d�|��}|j�|||��dS)NrF�)r=rbrrZ�forwardrre�r�
TokenClass�
start_mark�end_markr	r	r
rj�s

z Scanner.fetch_document_indicatorcCs|�t�dSr)�fetch_flow_collection_startZFlowSequenceStartTokenr r	r	r
rF�sz!Scanner.fetch_flow_sequence_startcCs|�t�dSr)rqZFlowMappingStartTokenr r	r	r
rG�sz Scanner.fetch_flow_mapping_startcCsJ|��|jd7_d|_|��}|��|��}|j�|||��dS)NrT)rdrrrZrlrrermr	r	r
rq�sz#Scanner.fetch_flow_collection_startcCs|�t�dSr)�fetch_flow_collection_endZFlowSequenceEndTokenr r	r	r
rH�szScanner.fetch_flow_sequence_endcCs|�t�dSr)rrZFlowMappingEndTokenr r	r	r
rI�szScanner.fetch_flow_mapping_endcCsJ|��|jd8_d|_|��}|��|��}|j�|||��dS)NrF)rbrrrZrlrrermr	r	r
rr�sz!Scanner.fetch_flow_collection_endcCs<d|_|��|��}|��|��}|j�t||��dS�NT)rrbrZrlrreZFlowEntryToken)rrorpr	r	r
rJ�szScanner.fetch_flow_entrycCs�|jsF|jstddd|����|�|j�rF|��}|j�t||��nd|_|�	�|��}|�
�|��}|j�t||��dS)Nz%sequence entries are not allowed hereT)rrrrZrfrrreZBlockSequenceStartTokenrbrlZBlockEntryToken�rrrorpr	r	r
rL�s�zScanner.fetch_block_entrycCs�|jsD|jstddd|����|�|j�rD|��}|j�t||��|j|_|�	�|��}|�
�|��}|j�t||��dS)Nz!mapping keys are not allowed here)rrrrZrfrrre�BlockMappingStartTokenrbrl�KeyTokenrtr	r	r
rNs�
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
rrvrrfrrurrrZrerbrlZ
ValueToken)rr^rrorpr	r	r
rP!s8
���
zScanner.fetch_valuecCs$|��d|_|j�|�t��dS�NF)rdrrre�scan_anchorZ
AliasTokenr r	r	r
rQYszScanner.fetch_aliascCs$|��d|_|j�|�t��dSrx)rdrrreryZAnchorTokenr r	r	r
rRdszScanner.fetch_anchorcCs"|��d|_|j�|���dSrx)rdrrre�scan_tagr r	r	r
rSoszScanner.fetch_tagcCs|jdd�dS)Nr8��style��fetch_block_scalarr r	r	r
rTzszScanner.fetch_literalcCs|jdd�dS)Nr9r{r}r r	r	r
rU}szScanner.fetch_foldedcCs$d|_|��|j�|�|��dSrs)rrbrre�scan_block_scalar�rr|r	r	r
r~�szScanner.fetch_block_scalarcCs|jdd�dS)Nr:r{��fetch_flow_scalarr r	r	r
rV�szScanner.fetch_singlecCs|jdd�dS)Nr;r{r�r r	r	r
rW�szScanner.fetch_doublecCs$|��d|_|j�|�|��dSrx)rdrrre�scan_flow_scalarr�r	r	r
r��szScanner.fetch_flow_scalarcCs"|��d|_|j�|���dSrx)rdrrre�
scan_plainr r	r	r
rY�szScanner.fetch_plaincCs|jdkrdSdS)NrT)rr r	r	r
r@�s
zScanner.check_directivecCs.|jdkr*|�d�dkr*|�d�dkr*dSdS)Nrrk�---�
 	
…

T�r�prefixr>r r	r	r
rB�s

�zScanner.check_document_startcCs.|jdkr*|�d�dkr*|�d�dkr*dSdS)Nrrk�...r�Tr�r r	r	r
rD�s

�zScanner.check_document_endcCs|�d�dkS)Nrr�)r>r r	r	r
rK�szScanner.check_block_entrycCs|jr
dS|�d�dkSdS�NTrr��rr>r r	r	r
rM�szScanner.check_keycCs|jr
dS|�d�dkSdSr�r�r r	r	r
rO�szScanner.check_valuecCs6|��}|dkp4|�d�dko4|dkp4|jo4|dkS)Nu  	
…

-?:,[]{}#&*!|>'"%@`rr�r-z?:)r>rr[r	r	r
rX�s
�zScanner.check_plaincCs~|jdkr|��dkr|��d}|sz|��dkr<|��q&|��dkr^|��dkr^|��qH|��rt|jsxd|_q"d}q"dS)NruF� �#�
…

T)rr>rl�scan_line_breakrr)r�foundr	r	r
r<�s

zScanner.scan_to_next_tokencCs�|��}|��|�|�}d}|dkr:|�|�}|��}n:|dkrV|�|�}|��}n|��}|��dkrt|��q^|�|�t||||�S)NZYAMLZTAGr�)rZrl�scan_directive_name�scan_yaml_directive_value�scan_tag_directive_valuer>�scan_directive_ignored_lineZDirectiveToken)rro�name�valuerpr	r	r
ris






zScanner.scan_directivecCs�d}|�|�}d|kr"dksXnd|kr8dksXnd|krNdksXn|dkrl|d	7}|�|�}q|s�td
|d||����|�|�}|�|�|��}|dkr�td
|d||����|S)
Nr�0�9�A�Z�a�z�-_r�while scanning a directive�6expected alphabetic or numeric character, but found %r� 
…

)r>rrZr�rl)rro�lengthr\r�r	r	r
r�&s2
B���

��zScanner.scan_directive_namecCs�|��dkr|��q|�|�}|��dkrFtd|d|��|����|��|�|�}|��dkr~td|d|��|����||fS)Nr�r.r�z%expected a digit or '.', but found %rr�z%expected a digit or ' ', but found %r)r>rl�scan_yaml_directive_numberrrZ)rro�major�minorr	r	r
r�;s 


�

�z!Scanner.scan_yaml_directive_valuecCs||��}d|krdks4ntd|d||����d}d|�|�krRdkr`nn
|d7}q8t|�|��}|�|�|S)Nr�r�r�zexpected a digit, but found %rrr)r>rrZ�intr�rl)rror\r�r�r	r	r
r�Ls�

z"Scanner.scan_yaml_directive_numbercCsH|��dkr|��q|�|�}|��dkr6|��q |�|�}||fS)Nr�)r>rl�scan_tag_directive_handle�scan_tag_directive_prefix)rro�handler�r	r	r
r�Ys



z Scanner.scan_tag_directive_valuecCs6|�d|�}|��}|dkr2td|d||����|S)N�	directiver�r��expected ' ', but found %r)�scan_tag_handler>rrZ�rror�r\r	r	r
r�cs�z!Scanner.scan_tag_directive_handlecCs6|�d|�}|��}|dkr2td|d||����|S)Nr�r�r�r�)�scan_tag_urir>rrZr�r	r	r
r�ls�z!Scanner.scan_tag_directive_prefixcCsj|��dkr|��q|��dkr8|��dkr8|��q"|��}|dkr^td|d||����|��dS)Nr�r�r�r��0expected a comment or a line break, but found %r�r>rlrrZr��rror\r	r	r
r�us

��z#Scanner.scan_directive_ignored_linec	Cs|��}|��}|dkrd}nd}|��d}|�|�}d|krLdks�nd|krbdks�nd	|krxd
ks�n|dkr�|d7}|�|�}q8|s�td
||d||����|�|�}|�|�|��}|dkr�td
||d||����|��}||||�S)Nr�aliasZanchorrr�r�r�r�r�r�r�rzwhile scanning an %sr�u 	
…

?:,]}%@`)rZr>rlrr�)	rrnroZ	indicatorr�r�r\r�rpr	r	r
ry�s@	
B�
��


��zScanner.scan_anchorc	Cs"|��}|�d�}|dkrdd}|�d�|�d|�}|��dkrZtd|d|��|����|��nz|dkr~d}d	}|��n`d}d
}|dkr�|d	kr�d}q�|d7}|�|�}q�d	}|r�|�d|�}nd	}|��|�d|�}|��}|dk�rtd
|d||����||f}|��}t|||�S)Nr�<��tagr9zwhile parsing a tagzexpected '>', but found %rr�r7Fr�Tzwhile scanning a tagr�)rZr>rlr�rr�ZTagToken)	rror\r��suffixr�Z
use_handler�rpr	r	r
rz�sN


�


�zScanner.scan_tagcCs�|dkrd}nd}g}|��}|��|�|�\}}|�|�|jd}|dkrTd}|dkrv|��\}}	}
t||	�}n||d}|�|�\}}
d}|j|k�rr|�	�dk�rr|�
|�|�	�dk}
d}|�	|�d	kr�|d7}q�|�|�|��|�|�|�
�}|�|�\}}
|j|k�rr|�	�dk�rr|�r`|d
k�r`|
�r`|�	�dk�r`|�sj|�d�n
|�|�q��qrq�|dk	�r�|�|�|dk�r�|�
|�td�|�d||
|�S)Nr9TFr�r+� 	rr��
r�)rZrl�scan_block_scalar_indicators�scan_block_scalar_ignored_liner�scan_block_scalar_indentation�max�scan_block_scalar_breaksrr>�extendrer�r��ScalarToken�join)rr|Zfolded�chunksro�chomping�	incrementZ
min_indent�breaks�
max_indentrpr�
line_breakZleading_non_spacer�r	r	r
r�sX




�
�



�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�
0123456789r�while scanning a block scalarz<expected indentation indicator in the range 1-9, but found 0r�z9expected chomping or indentation indicators, but found %r)r>rlr�rrZ)rror�r�r\r	r	r
r�sP�
���z$Scanner.scan_block_scalar_indicatorscCsj|��dkr|��q|��dkr8|��dkr8|��q"|��}|dkr^td|d||����|��dS)Nr�r�r�r�r�r�r�r	r	r
r�Ds

�z&Scanner.scan_block_scalar_ignored_linecCsdg}d}|��}|��dkrZ|��dkr@|�|���|��}q|��|j|kr|j}q|||fS)Nr� 
…

r�)rZr>rer�rlr)rr�r�rpr	r	r
r�Rs

z%Scanner.scan_block_scalar_indentationcCsxg}|��}|j|kr,|��dkr,|��q|��dkrp|�|���|��}|j|kr,|��dkr,|��qNq,||fS)Nr��

…

)rZrr>rlrer�)rrr�rpr	r	r
r�as
z Scanner.scan_block_scalar_breakscCs�|dkrd}nd}g}|��}|��}|��|�|�||��|��|krr|�|�||��|�|�||��q@|��|��}td�|�d|||�S)Nr;TFr�)rZr>rlr��scan_flow_scalar_non_spaces�scan_flow_scalar_spacesr�r�)rr|�doubler�roZquoterpr	r	r
r�ns �zScanner.scan_flow_scalarr+���	r����
�r�r;�\�/�…� u
u
)r�r��b�tr��n�v�f�r�er�r;r�r��N�_�L�Pr���)�x�u�Uc	Cs�g}d}|�|�dkr |d7}q|r>|�|�|��|�|�|��}|sv|dkrv|�d�dkrv|�d�|�d�q|r�|dks�|s�|dkr�|�|�|��q|�r�|dk�r�|��|��}||jkr�|�|j|�|��n�||jk�rn|j|}|��t|�D]6}|�|�dk�rtd	|d
||�|�f|�����qt	|�|�d�}|�t
|��|�|�n<|dk�r�|��|�|�
||��ntd	|d
||����q|SqdS)Nru'"\ 	
…

rr:r�z"\r��0123456789ABCDEFabcdefz%while scanning a double-quoted scalarz?expected escape sequence of %d hexdecimal numbers, but found %r�r�z!found unknown escape character %r)r>rer�rl�ESCAPE_REPLACEMENTS�ESCAPE_CODES�rangerrZr��chrr�r��scan_flow_scalar_breaks)rr�ror�r�r\�k�coder	r	r
r��sT







��
�z#Scanner.scan_flow_scalar_non_spacesc	Cs�g}d}|�|�dkr |d7}q|�|�}|�|�|��}|dkrXtd|d|����nT|dkr�|��}|�||�}|dkr�|�|�n|s�|�d	�|�|�n
|�|�|S)
Nrr�rr+�while scanning a quoted scalarzfound unexpected end of streamr�r�r�)	r>r�rlrrZr�r�rer�)	rr�ror�r��whitespacesr\r�r�r	r	r
r��s,


�

zScanner.scan_flow_scalar_spacescCszg}|�d�}|dks|dkr>|�d�dkr>td|d|����|��dkrT|��q>|��dkrp|�|���q|SqdS)	Nrkr�r�r�r�z#found unexpected document separatorr�r�)r�r>rrZrlrer�)rr�ror�r�r	r	r
r��s
��
zScanner.scan_flow_scalar_breakscCsg}|��}|}|jd}g}d}|��dkr0q�|�|�}|dks�|dkrj|�|d�d|jrbdndks�|jrz|dkrzq�|d7}q0|dkr�q�d	|_|�|�|�|�|��|�|�|��}|�	||�}|r�|��dks�|js|j
|krq�qtd�|�d
||�S)Nrrr�r�r5z,[]{}r�z,?[]{}FT)
rZrr>rrr�rer�rl�scan_plain_spacesrr�r�)rr�rorprZspacesr�r\r	r	r
r��sJ

�����


��zScanner.scan_plainc
Cs&g}d}|�|�dkr |d7}q|�|�}|�|�|��}|dk�r|��}d|_|�d�}|dksn|dkr�|�d�d	kr�dSg}	|��d
kr�|��dkr�|��q�|	�|���|�d�}|dks�|dkr�|�d�d	kr�dSq�|dkr�|�|�n|	�s|�d�|�|	�n|�r"|�|�|S)Nrr�rr�Trkr�r�r�r�r�)r>r�rlr�rrer�)
rrror�r�r�r\r�r�r�r	r	r
r�sB




�

�

zScanner.scan_plain_spacescCs�|��}|dkr*td||d||����d}|�|�}|dkr�d|krTdks�nd|krjd	ks�nd
|kr�dks�n|dkr�|d7}|�|�}q@|dkr�|�|�td||d||����|d7}|�|�}|�|�|S)
Nr7�while scanning a %szexpected '!', but found %rrr�r�r�r�r�r�r�r�)r>rrZrlr�)rr�ror\r�r�r	r	r
r�Ds0
�
B�

�

zScanner.scan_tag_handlecCs�g}d}|�|�}d|kr&dks\nd|kr<dks\nd|krRdks\n|dkr�|d	kr�|�|�|��|�|�d}|�|�||��n|d
7}|�|�}q|r�|�|�|��|�|�d}|s�td||d||����d
�|�S)Nrr�r�r�r�r�r�z-;/?:@&=+$,_.!~*'()[]%r,rzwhile parsing a %szexpected URI, but found %rr�)r>rer�rl�scan_uri_escapesrrZr�)rr�ror�r�r\r	r	r
r�\s.
B�


�zScanner.scan_tag_uric
Cs�g}|��}|��dkr~|��td�D]2}|�|�dkr(td||d|�|�|����q(|�t|�d�d��|�d�qzt|��	d�}Wn8t
k
r�}ztd||t|�|��W5d}~XYnX|S)Nr,r�r�r�zBexpected URI escape sequence of 2 hexdecimal numbers, but found %rr�zutf-8)rZr>rlr�rrer�r��bytes�decode�UnicodeDecodeError�str)rr�roZcodesrr�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>r�rlr[r	r	r
r��s	zScanner.scan_line_breakN)Lrrrrr%r&r(r!r"r*r)rdrbr=rfrr?rArCrErjrFrGrqrHrIrrrJrLrNrPrQrRrSrTrUr~rVrWr�rYr@rBrDrKrMrOrXr<rir�r�r�r�r�r�r�ryrzrr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r	r	r	r
r.s�A

l

!8

#

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

Zerion Mini Shell 1.0