ok

Mini Shell

Direktori : /proc/self/root/opt/alt/python37/lib64/python3.7/__pycache__/
Upload File :
Current File : //proc/self/root/opt/alt/python37/lib64/python3.7/__pycache__/tokenize.cpython-37.pyc

B

�x�c�i�/@s�dZdZdZddlmZddlmZmZddl	Z	ddl
mZddlm
Z
ddlZddlZddlZdd	lTe�d
ej�Ze�dej�ZddlZejdd
ddgZ[eeeeeeeeee e!e"e#e$e%e&e'e(e)e*e+e,e-e.e/e0e1e2e3e4e5e6e7e8e9e:e;e<e=e>e?e@eAeBeCeDd�.ZEGdd�de	�Fdd��ZGdd�ZHdd�ZIdd�ZJdZKdZLeKeIdeK�eJeL�ZMdZNdZOdZPdZQd ZReHeOePeQeR�ZSd!ZTeHd"d#�eJeT�ZUd$eTZVeHeUeV�ZWeHd%eWd&�ZXeHeXeWeS�ZYd'd(�ZZd)d*�Z[eHeZ��Z\d+Z]d,Z^d-Z_d.Z`eHe\d/e\d0�ZaeHe\d1e\d2�ZbeHd3d4d5d6d7d8d9d:�Zcd;ZdeHd<d=d>�ZeeHecedee�ZfeHeYefebeN�ZgeMegZheHe\d?eHd@d�e\dAeHdBd��ZieHdCeLea�ZjeKeHejeYefeieN�ZkiZlx@eZ�D]6Zme]elemd@<e^elemdB<e_elemd/<e`elemd0<�q�Wen�Zoen�Zpx\eZ�D]RZqx$eqdBeqd@fD]Zreo�ser��qWx$eqd0eqd/fD]Zrep�ser��q(W�q�WdDZtGdEdF�dFeu�ZvGdGdH�dHeu�ZwGdIdJ�dJ�ZxdKd�ZydLdM�ZzdNd
�Z{dOdP�ZdQd�Z|dRdS�Z}dTdU�Z~dVdW�Ze�dXk�r�e�dS)YaoTokenization help for Python programs.

tokenize(readline) is a generator that breaks a stream of bytes into
Python tokens.  It decodes the bytes according to PEP-0263 for
determining source file encoding.

It accepts a readline-like method which is called repeatedly to get the
next line of input (or b"" for EOF).  It generates 5-tuples with these
members:

    the token type (see token.py)
    the token (a string)
    the starting (row, column) indices of the token (a 2-tuple of ints)
    the ending (row, column) indices of the token (a 2-tuple of ints)
    the original line (string)

It is designed to match the working of the Python tokenizer exactly, except
that it produces COMMENT tokens for comments and gives type OP for all
operators.  Additionally, all token lists start with an ENCODING token
which tells you which encoding was used to decode the bytes stream.
zKa-Ping Yee <ping@lfw.org>zpGvR, ESR, Tim Peters, Thomas Wouters, Fred Drake, Skip Montanaro, Raymond Hettinger, Trent Nelson, Michael Foord�)�open)�lookup�BOM_UTF8N)�
TextIOWrapper)�chain)�*z&^[ \t\f]*#.*?coding[:=][ \t]*([-\w.]+)s^[ \t\f]*(?:[#\r\n]|$)�tokenize�detect_encoding�
untokenize�	TokenInfo).�(�)�[�]�:�,�;�+�-r�/�|�&�<�>�=�.�%�{�}z==z!=z<=z>=�~�^z<<z>>z**z+=z-=z*=z/=z%=z&=z|=z^=z<<=z>>=z**=z//z//=z...z->�@z@=c@s eZdZdd�Zedd��ZdS)rcCs$d|jt|jf}d|j|d�S)Nz%d (%s)z8TokenInfo(type=%s, string=%r, start=%r, end=%r, line=%r))�type)r"�tok_name�_replace)�selfZannotated_type�r&�-/opt/alt/python37/lib64/python3.7/tokenize.py�__repr___szTokenInfo.__repr__cCs(|jtkr|jtkrt|jS|jSdS)N)r"�OP�string�EXACT_TOKEN_TYPES)r%r&r&r'�
exact_typeds
zTokenInfo.exact_typeN)�__name__�
__module__�__qualname__r(�propertyr,r&r&r&r'r^sztype string start end linecGsdd�|�dS)Nrrr
)�join)�choicesr&r&r'�groupk�r3cGst|�dS)Nr)r3)r2r&r&r'�anylr4r5cGst|�dS)N�?)r3)r2r&r&r'�maybemr4r7z[ \f\t]*z	#[^\r\n]*z\\\r?\nz\w+z0[xX](?:_?[0-9a-fA-F])+z0[bB](?:_?[01])+z0[oO](?:_?[0-7])+z(?:0(?:_?0)*|[1-9](?:_?[0-9])*)z[eE][-+]?[0-9](?:_?[0-9])*z)[0-9](?:_?[0-9])*\.(?:[0-9](?:_?[0-9])*)?z\.[0-9](?:_?[0-9])*z[0-9](?:_?[0-9])*z[0-9](?:_?[0-9])*[jJ]z[jJ]cCsjddddddg}dh}xN|D]F}x@t�|�D]2}x,tjdd	�|D��D]}|�d�|��qFWq,WqW|S)
N�b�r�u�fZbrZfr�cSsg|]}||��f�qSr&)�upper)�.0�cr&r&r'�
<listcomp>�sz(_all_string_prefixes.<locals>.<listcomp>)�
_itertools�permutations�product�addr1)Z_valid_string_prefixes�result�prefix�tr:r&r&r'�_all_string_prefixes�s
rHcCst�|tj�S)N)�re�compile�UNICODE)Zexprr&r&r'�_compile�srLz[^'\\]*(?:\\.[^'\\]*)*'z[^"\\]*(?:\\.[^"\\]*)*"z%[^'\\]*(?:(?:\\.|'(?!''))[^'\\]*)*'''z%[^"\\]*(?:(?:\\.|"(?!""))[^"\\]*)*"""z'''z"""z'[^\n'\\]*(?:\\.[^\n'\\]*)*'z"[^\n"\\]*(?:\\.[^\n"\\]*)*"z\*\*=?z>>=?z<<=?z!=z//=?z->z[+\-*/%&@|^=<>]=?rz[][(){}]z\r?\nz\.\.\.z[:;.,@]z'[^\n'\\]*(?:\\.[^\n'\\]*)*�'z"[^\n"\\]*(?:\\.[^\n"\\]*)*�"z
\\\r?\n|\Z�c@seZdZdS)�
TokenErrorN)r-r.r/r&r&r&r'rP�srPc@seZdZdS)�StopTokenizingN)r-r.r/r&r&r&r'rQ�srQc@s,eZdZdd�Zdd�Zdd�Zdd�Zd	S)
�UntokenizercCsg|_d|_d|_d|_dS)N�r)�tokens�prev_row�prev_col�encoding)r%r&r&r'�__init__�szUntokenizer.__init__cCs�|\}}||jks&||jkr>||jkr>td�|||j|j���||j}|rb|j�d|�d|_||j}|r�|j�d|�dS)Nz+start ({},{}) precedes previous end ({},{})z\
r� )rUrV�
ValueError�formatrT�append)r%�start�rowZcolZ
row_offsetZ
col_offsetr&r&r'�add_whitespace�s

zUntokenizer.add_whitespacecCs4t|�}g}d}�x|D�]
}t|�dkr8|�||�P|\}}}}	}
|tkrV||_q|tkr`P|tkrv|�|�qnl|tkr�|�	�|	\|_
|_qnL|tt
fkr�d}n:|r�|r�|d}|dt|�kr�|j�|�t|�|_d}|�|�|j�|�|	\|_
|_|tt
fkr|j
d7_
d|_qWd�|j�S)NF�T���rSrr<)�iter�len�compat�ENCODINGrW�	ENDMARKER�INDENTr\�DEDENT�poprUrV�NEWLINE�NLrTr_r1)r%�iterable�it�indents�	startlinerGZtok_type�tokenr]�end�line�indentr&r&r'r
�sF



zUntokenizer.untokenizec
Cs�g}|jj}|dttfk}d}x�t|g|�D]�}|dd�\}}	|tkrR|	|_q.|ttfkrf|	d7}	|t	kr�|rzd|	}	d}nd}|t
kr�|�|	�q.n>|tkr�|��q.n*|ttfkr�d}n|r�|r�||d�d}||	�q.WdS)NrFr`rYTra)
rTr\rjrkrrerW�NAME�NUMBER�STRINGrgrhri)
r%rprlrnZtoks_appendroZ
prevstringZtokZtoknumZtokvalr&r&r'rds8
zUntokenizer.compatN)r-r.r/rXr_r
rdr&r&r&r'rR�s
%rRcCs*t�}|�|�}|jdk	r&|�|j�}|S)aTransform tokens back into Python source code.
    It returns a bytes object, encoded using the ENCODING
    token, which is the first token sequence output by tokenize.

    Each element returned by the iterable must be a token sequence
    with at least two elements, a token number and token value.  If
    only two tokens are passed, the resulting output is poor.

    Round-trip invariant for full input:
        Untokenized source will match input source exactly

    Round-trip invariant for limited input:
        # Output bytes will tokenize back to the input
        t1 = [tok[:2] for tok in tokenize(f.readline)]
        newcode = untokenize(t1)
        readline = BytesIO(newcode).readline
        t2 = [tok[:2] for tok in tokenize(readline)]
        assert t1 == t2
    N)rRr
rW�encode)rlZut�outr&r&r'r
8s


cCsH|dd����dd�}|dks*|�d�r.dS|dks@|�d�rDd	S|S)
z(Imitates get_normal_name in tokenizer.c.N��_rzutf-8zutf-8-)zlatin-1z
iso-8859-1ziso-latin-1)zlatin-1-ziso-8859-1-ziso-latin-1-z
iso-8859-1)�lower�replace�
startswith)Zorig_encZencr&r&r'�_get_normal_nameSs
r~cs�y�jj�Wntk
r$d�YnXd�d}d}�fdd�}��fdd�}|�}|�t�rpd�|d	d�}d
}|s||gfS||�}|r�||gfSt�|�s�||gfS|�}|s�||gfS||�}|r�|||gfS|||gfS)a
    The detect_encoding() function is used to detect the encoding that should
    be used to decode a Python source file.  It requires one argument, readline,
    in the same way as the tokenize() generator.

    It will call readline a maximum of twice, and return the encoding used
    (as a string) and a list of any lines (left as bytes) it has read in.

    It detects the encoding from the presence of a utf-8 bom or an encoding
    cookie as specified in pep-0263.  If both a bom and a cookie are present,
    but disagree, a SyntaxError will be raised.  If the encoding cookie is an
    invalid charset, raise a SyntaxError.  Note that if a utf-8 bom is found,
    'utf-8-sig' is returned.

    If no encoding is specified, then the default of 'utf-8' will be returned.
    NFzutf-8cs y��Stk
rdSXdS)Nr4)�
StopIterationr&)�readliner&r'�read_or_stopvsz%detect_encoding.<locals>.read_or_stopcs�y|�d�}Wn4tk
rBd}�dk	r6d�|��}t|��YnXt�|�}|sVdSt|�d��}yt|�}Wn:t	k
r��dkr�d|}nd��|�}t|��YnX�r�|dkr؈dkr�d}n
d���}t|��|d	7}|S)
Nzutf-8z'invalid or missing encoding declarationz{} for {!r}rSzunknown encoding: zunknown encoding for {!r}: {}zencoding problem: utf-8z encoding problem for {!r}: utf-8z-sig)
�decode�UnicodeDecodeErrorr[�SyntaxError�	cookie_re�matchr~r3r�LookupError)rrZline_string�msgr�rWZcodec)�	bom_found�filenamer&r'�find_cookie|s6


z$detect_encoding.<locals>.find_cookieT�z	utf-8-sig)�__self__�name�AttributeErrorr}r�blank_rer�)r�rW�defaultr�r��firstZsecondr&)r�r�r�r'r	^s8
&




cCsVt|d�}y0t|j�\}}|�d�t||dd�}d|_|S|���YnXdS)zXOpen a file in read only mode using the encoding detected by
    detect_encoding().
    �rbrT)�line_bufferingr9N)�
_builtin_openr	r��seekr�mode�close)r��bufferrW�lines�textr&r&r'r�s

rcCsBddlm}m}t|�\}}t|d�}|d�}t||||�j|�S)a�
    The tokenize() generator requires one argument, readline, which
    must be a callable object which provides the same interface as the
    readline() method of built-in file objects.  Each call to the function
    should return one line of input as bytes.  Alternatively, readline
    can be a callable function terminating with StopIteration:
        readline = open(myfile, 'rb').__next__  # Example of alternate readline

    The generator produces 5-tuples with these members: the token type; the
    token string; a 2-tuple (srow, scol) of ints specifying the row and
    column where the token begins in the source; a 2-tuple (erow, ecol) of
    ints specifying the row and column where the token ends in the source;
    and the line on which the token was found.  The line passed is the
    logical line; continuation lines are included.

    The first token sequence will always be an ENCODING token
    which tells you which encoding was used to decode the bytes stream.
    r)r�repeatr4)�	itertoolsrr�r	rb�	_tokenize�__next__)r�rr�rW�consumedZrl_gen�emptyr&r&r'r�s

ccs�d}}}d}d\}}d}dg}	|dk	rH|dkr6d}tt|ddd�Vd}
d}�x�y|}
|�}Wntk
rzd}YnX|dk	r�|�|�}|d	7}dt|�}}
|�rt|s�td
|��|�|�}|�r
|�d�}}tt||d|�|||f||�Vd\}}d}nf|�r^|dd�dk�r^|d
d�dk�r^tt	||||t|�f|�Vd}d}qTn||}||}qT�n�|dk�r|�s|�s�Pd}xf||
k�r�||dk�r�|d	7}n6||dk�r�|t
d	t
}n||dk�r�d}nP|d	7}�q�W||
k�rP||dk�r�||dk�r`||d��d�}tt|||f||t|�f|�V|t|�7}tt
||d�||f|t|�f|�VqT||	dk�r�|	�|�tt|d|�|df||f|�Vxp||	dk�r||	k�r�tdd|||f��|	dd�}	ttd||f||f|�V�q�Wn|�s0td|df��d}�x�||
k�r�tt��||�}|�r�|�d	�\}}||f||f|}}}||k�r��q8|||�||}}||k�s�|dk�r�|dk�r�|dk�r�tt||||�V�q�|dk�r|dk�rtt
||||�Vntt||||�V�q�|dk�rN|�d��r8t�tt||||�V�q�|tk�r�tt|�}|�||�}|�r�|�d�}|||�}tt||||f|�Vn||f}||d�}|}P�q�|tk�s�|dd�tk�s�|dd�tk�rb|ddk�rN||f}tt�|��p0t�|d	��p0t�|d��}||d�d	}}|}Pntt||||�Vnf|���r�tt||||�VnH|dk�r�d	}n8|dk�r�|d	7}n|d k�r�|d	8}tt||||�Vn*tt	||||f||d	f|�V|d	7}�q8WqTW|
�r@|
ddk�r@ttd|d	t|
�f|d	t|
�d	fd�Vx0|	d	d�D] }ttd|df|dfd�V�qNWtt d|df|dfd�VdS)!NrZ
0123456789)r<rz	utf-8-sigzutf-8)rrr<r4rSzEOF in multi-line string���z\
���z\
rY�	�z#
�#z
raz3unindent does not match any outer indentation levelz
<tokenize>zEOF in multi-line statementrz...�
r`r��\z([{z)]})!rrerr�rcrPr�rqrvZ
ERRORTOKEN�tabsize�rstripZCOMMENTrkr\rg�IndentationErrorrhrL�PseudoToken�spanrurj�endswith�AssertionError�
triple_quoted�endpats�
single_quoted�get�isidentifierrtr)rf)r�rWZlnumZparenlevZ	continuedZnumcharsZcontstrZneedcontZcontlinern�	last_linerr�pos�maxZstrstartZendprogZendmatchrq�columnZ
comment_tokenZpseudomatchr]ZsposZeposrpZinitialrsr&r&r'r��s




*



"
"













. r�cCs
t|d�S)N)r�)r�r&r&r'�generate_tokens�sr�c

s(ddl}dd��d�fdd�	}|jdd�}|jdd	d
dd�|jd
ddddd�|��}y�|jr�|j}t|d��}tt|j��}WdQRXnd}t	t
jjd�}xF|D]>}|j}|j
r�|j}d|j|j}	td|	t||jf�q�WW�n8tk
�r:}
z0|
jddd�\}}||
jd|||f�Wdd}
~
XYn�tk
�r�}
z(|
jd\}}||
jd|||f�Wdd}
~
XYn�tk
�r�}
z||
|�Wdd}
~
XYnxtk
�r�}
z||
�Wdd}
~
XYnNtk
�r�td�Yn2tk
�r"}
z�d|
��Wdd}
~
XYnXdS)NrcSst|tjd�dS)N)�file)�print�sys�stderr)�messager&r&r'�perror�szmain.<locals>.perrorcsR|r"|f||f}�d|�n"|r8�d||f�n�d|�t�d�dS)Nz%s:%d:%d: error: %sz
%s: error: %sz	error: %srS)r��exit)r�r��location�args)r�r&r'�error�szmain.<locals>.errorzpython -m tokenize)Zprogr�r6zfilename.pyz'the file to tokenize; defaults to stdin)�destZnargsZmetavar�helpz-ez--exact�exactZ
store_truez(display token names using the exact type)r��actionr�r�z<stdin>z%d,%d-%d,%d:z%-20s%-15s%-15rrSr�zinterrupted
zunexpected error: %s)NN)�argparseZArgumentParserZadd_argumentZ
parse_argsr�r��listrr�r�r��stdinr"r�r,r]rqr�r#r*r�r�rPr��OSError�KeyboardInterrupt�	Exception)
r�r�Zparserr�r�r;rTrpZ
token_typeZtoken_range�errrrr�r&)r�r'�main�sN
&&r��__main__)��__doc__�
__author__Z__credits__�builtinsrr��codecsrr�collections�iorr�rrArIr�rprJ�ASCIIr�r��__all__ZLPARZRPARZLSQBZRSQBZCOLONZCOMMAZSEMIZPLUSZMINUSZSTARZSLASHZVBARZAMPERZLESSZGREATERZEQUALZDOTZPERCENTZLBRACEZRBRACEZEQEQUALZNOTEQUALZ	LESSEQUALZGREATEREQUALZTILDEZ
CIRCUMFLEXZ	LEFTSHIFTZ
RIGHTSHIFTZ
DOUBLESTARZ	PLUSEQUALZMINEQUALZ	STAREQUALZ
SLASHEQUALZPERCENTEQUALZ
AMPEREQUALZ	VBAREQUALZCIRCUMFLEXEQUALZLEFTSHIFTEQUALZRIGHTSHIFTEQUALZDOUBLESTAREQUALZDOUBLESLASHZDOUBLESLASHEQUALZELLIPSISZRARROW�ATZATEQUALr+�
namedtuplerr3r5r7Z
WhitespaceZCommentZIgnoreZNameZ	HexnumberZ	BinnumberZ	OctnumberZ	DecnumberZ	IntnumberZExponentZ
PointfloatZExpfloatZFloatnumberZ
ImagnumberZNumberrHrLZStringPrefixZSingleZDoubleZSingle3ZDouble3ZTripleZStringZOperatorZBracketZSpecialZFunnyZ
PlainTokenZTokenZContStrZPseudoExtrasr�r�Z_prefix�setr�r�rGr:rDr�r�rPrQrRr
r~r	rr�r�r�r-r&r&r&r'�<module>s






_]:<


Zerion Mini Shell 1.0