ok

Mini Shell

Direktori : /proc/thread-self/root/opt/alt/python34/lib64/python3.4/__pycache__/
Upload File :
Current File : //proc/thread-self/root/opt/alt/python34/lib64/python3.4/__pycache__/tokenize.cpython-34.pyc

�
i f�c�@s�dZdZdZddlmZddlmZmZddl	Z	ddl
mZddlm
Z
ddlZddlZdd	lTejd
ej�Zejdej�ZddlZejdd
dddddgZ[eZdee<edZdee<edZdee<ed7Zi+ed6ed6ed6ed6ed6e d6e!d6e"d6e#d6e$d6e%d 6e&d!6e'd"6e(d#6e)d$6e*d%6e+d&6e,d'6e-d(6e.d)6e/d*6e0d+6e1d,6e2d-6e3d.6e4d/6e5d06e6d16e7d26e8d36e9d46e:d56e;d66e<d76e=d86e>d96e?d:6e@d;6eAd<6eBd=6eCd>6eDd?6eEd@6ZFGdAd�de	jGddB��ZHdCdD�ZIdEdF�ZJdGdH�ZKdIZLdJZMeLeJdKeL�eKeM�ZNdLZOdMZPdNZQdOZRdPZSeIePeQeReS�ZTdQZUeIdRdS�eKeU�ZVdTeUZWeIeVeW�ZXeIdUeXdV�ZYeIeYeXeT�ZZdWZ[dXZ\dYZ]dZZ^d[Z_eIe[d\e[d]�Z`eIe[d^e[d_�ZaeId`dadbd+dcddded.�ZbdfZceIdgdhdi�ZdeIebeced�ZeeIeZeeeaeO�ZfeNefZgeIe[djeIdkdK�e[dleIdmdK��ZheIdneMe`�ZieLeIeieZeeeheO�Zjdodp�Zki(e\dk6e]dm6e^d\6e_d]6e^dq6e_dr6e^ds6e_dt6e^du6e_dv6e^dw6e_dx6e^dy6e_dz6e^d{6e_d|6e^d}6e_d~6e^d6e_d�6e^d�6e_d�6e^d�6e_d�6e^d�6e_d�6e^d�6e_d�6e^d�6e_d�6e^du6e_dv6e^d�6e_d�6dd�6dd�6dd�6dd�6dd�6dd�6ZliZmxd�D]Znenemen<q�WiZoxd�D]Zneneoen<q�Wd�ZpGd�d��d�eq�ZrGd�d��d�eq�ZsGd�d��d��Ztd�d�Zud�d��Zvd�d�Zwd�d��Zd�d
�Zxd�d��Zyd�d��Zzd�d��Z{e|d�kr�e{�ndS)�aoTokenization 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]|$)�COMMENT�tokenize�detect_encoding�NL�
untokenize�ENCODING�	TokenInfo����(�)�[�]�:�,�;�+�-r�/�|�&�<�>�=�.�%�{�}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|jd|�S)Nz%d (%s)z8TokenInfo(type=%s, string=%r, start=%r, end=%r, line=%r)�type)r(�tok_name�_replace)�self�annotated_type�r-�-/opt/alt/python34/lib64/python3.4/tokenize.py�__repr__bszTokenInfo.__repr__cCs4|jtkr)|jtkr)t|jS|jSdS)N)r(�OP�string�EXACT_TOKEN_TYPES)r+r-r-r.�
exact_typegszTokenInfo.exact_typeN)�__name__�
__module__�__qualname__r/�propertyr3r-r-r-r.rasztype string start end linecGsddj|�dS)Nrrr)�join)�choicesr-r-r.�groupnsr:cGst|�dS)Nr)r:)r9r-r-r.�anyosr;cGst|�dS)N�?)r:)r9r-r-r.�maybepsr=z[ \f\t]*z	#[^\r\n]*z\\\r?\nz\w+z0[xX][0-9a-fA-F]+z
0[bB][01]+z0[oO][0-7]+z(?:0+|[1-9][0-9]*)z[eE][-+]?[0-9]+z[0-9]+\.[0-9]*z\.[0-9]+z[0-9]+z
[0-9]+[jJ]z[jJ]z(?:[bB][rR]?|[rR][bB]?|[uU])?z[^'\\]*(?:\\.[^'\\]*)*'z[^"\\]*(?:\\.[^"\\]*)*"z%[^'\\]*(?:(?:\\.|'(?!''))[^'\\]*)*'''z%[^"\\]*(?:(?:\\.|"(?!""))[^"\\]*)*"""�'''�"""z'[^\n'\\]*(?:\\.[^\n'\\]*)*'z"[^\n"\\]*(?:\\.[^\n"\\]*)*"z\*\*=?z>>=?z<<=?z//=?z->z[+\-*/%&|^=<>]=?z[][(){}]z\r?\nz\.\.\.z[:;.,@]z'[^\n'\\]*(?:\\.[^\n'\\]*)*�'z"[^\n"\\]*(?:\\.[^\n"\\]*)*�"z
\\\r?\n|\ZcCstj|tj�S)N)�re�compile�UNICODE)�exprr-r-r.�_compile�srF�r'''�r"""�b'''�b"""�R'''�R"""�B'''�B"""�br'''�br"""�bR'''�bR"""�Br'''�Br"""�BR'''�BR"""�rb'''�rb"""�Rb'''�Rb"""�rB'''�rB"""�RB'''�RB"""�u'''�u"""�U'''�U"""�r�R�b�B�u�U�r'�r"�R'�R"�b'�b"�B'�B"�br'�br"�Br'�Br"�bR'�bR"�BR'�BR"�rb'�rb"�rB'�rB"�Rb'�Rb"�RB'�RB"�u'�u"�U'�U"�c@seZdZdS)�
TokenErrorN)r4r5r6r-r-r-r.r��sr�c@seZdZdS)�StopTokenizingN)r4r5r6r-r-r-r.r��sr�c@s@eZdZdd�Zdd�Zdd�Zdd�Zd	S)
�UntokenizercCs(g|_d|_d|_d|_dS)Nrr)�tokens�prev_row�prev_col�encoding)r+r-r-r.�__init__�s			zUntokenizer.__init__cCs�|\}}||jks9||jkr`||jkr`tdj|||j|j���n||j}|r�|jjd|�d|_n||j}|r�|jjd|�ndS)Nz+start ({},{}) precedes previous end ({},{})z\
r� )r�r��
ValueError�formatr��append)r+�start�row�col�
row_offset�
col_offsetr-r-r.�add_whitespace�s-	

zUntokenizer.add_whitespacecCs�t|�}g}d}x�|D]�}t|�dkrK|j||�Pn|\}}}}	}
|tkr{||_qn|tkr�Pn|tkr�|j|�qn�|tkr�|j	�|	\|_
|_qnr|tt
fkr�d}nW|rJ|rJ|d}|dt|�krA|jj|�t|�|_nd}n|j|�|jj|�|	\|_
|_|tt
fkr|j
d7_
d|_qqWdj|j�S)NFrTrr����)�iter�len�compatr
r��	ENDMARKER�INDENTr��DEDENT�popr�r��NEWLINErr�r�r8)r+�iterable�it�indents�	startline�t�tok_type�tokenr��end�line�indentr-r-r.r�sF
	

	
	
zUntokenizer.untokenizec
CsPg}|jj}|dttfk}d}xt|g|�D]}|dd�\}}	|tkrx|	|_qAn|ttfkr�|	d7}	n|t	kr�|r�d|	}	nd}nd}|t
kr�|j|	�qAnZ|tkr|j�qAn>|ttfkrd}n#|r>|r>||d�d}n||	�qAWdS)NrFrr�Trr�)
r�r�r�rrr
r��NAME�NUMBER�STRINGr�r�r�)
r+r�r�r��toks_appendr��
prevstring�tok�toknum�tokvalr-r-r.r�s8	

	

		zUntokenizer.compatN)r4r5r6r�r�rr�r-r-r-r.r��s
%r�cCs@t�}|j|�}|jdk	r<|j|j�}n|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 intput:
        # Output bytes will tokenize the 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)r�rr��encode)r��ut�outr-r-r.r?s
	cCsd|dd�j�jdd�}|dks=|jd�rAdS|d
ks\|jd�r`dS|S)z(Imitates get_normal_name in tokenizer.c.N��_rzutf-8zutf-8-�latin-1�
iso-8859-1�iso-latin-1�latin-1-�iso-8859-1-�iso-latin-1-)r�r�r�)r�r�r�)�lower�replace�
startswith)�orig_enc�encr-r-r.�_get_normal_nameZs"r�cs4y�jj�Wntk
r*d�YnXd�d}d}�fdd�}��fdd�}|�}|jt�r�d�|d	d�}d
}n|s�|gfS||�}|r�||gfStj|�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��SWntk
r#dSYnXdS)N�)�
StopIterationr-)�readliner-r.�read_or_stop}s
z%detect_encoding.<locals>.read_or_stopcs;y|jd�}WnEtk
rZd}�dk	rJdj|��}nt|��YnXtj|�}|stdSt|jd��}yt|�}WnIt	k
r��dkr�d|}ndj�|�}t|��YnX�r7|dkr*�dkrd}ndj��}t|��n|d	7}n|S)
Nzutf-8z'invalid or missing encoding declarationz{} for {!r}rzunknown encoding: zunknown encoding for {!r}: {}zencoding problem: utf-8z encoding problem for {!r}: utf-8z-sig)
�decode�UnicodeDecodeErrorr��SyntaxError�	cookie_re�matchr�r:r�LookupError)r��line_string�msgr�r��codec)�	bom_found�filenamer-r.�find_cookie�s6


			
z$detect_encoding.<locals>.find_cookieTrz	utf-8-sig)�__self__�name�AttributeErrorr�r�blank_rer�)r�r��defaultr�r��first�secondr-)r�r�r�r.r
es8
&		


	
cCsst|d�}yHt|j�\}}|jd�t||dd�}d|_|SWn|j��YnXdS)zXOpen a file in read only mode using the encoding detected by
    detect_encoding().
    �rbr�line_bufferingTrcN)�
_builtin_openr
r��seekr�mode�close)r��bufferr��lines�textr-r-r.r�s
	
rcCs_ddlm}m}t|�\}}t|d�}|d�}t||||�j|�S)a�
    The tokenize() generator requires one argment, 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.  Alternately, 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�repeatr�)�	itertoolsrr�r
r��	_tokenize�__next__)r�rr�r��consumed�rl_gen�emptyr-r-r.r	�s
ccs6d}}}d}d\}}d}dg}	|dk	rj|dkrPd}ntt|ddd�Vnxdy
|�}
Wntk
r�d}
YnX|dk	r�|
j|�}
n|d7}dt|
�}}|r�|
s�td|
��n|j|
�}|rZ|jd�}}tt||
d|�|
||f||
�Vd\}}d}ql|r�|
d d�d
kr�|
d!d�dkr�tt	||
|
|t|
�f|�Vd}d}qmql||
}||
}qmn�|dkrH|rH|
s�Pnd}xv||krz|
|d
kr.|d7}n?|
|dkrS|t
dt
}n|
|dkrld}nP|d7}qW||kr�Pn|
|dkr�|
|dkr7|
|d�jd�}|t|�}tt|||f||t|�f|
�Vtt
|
|d�||f|t|
�f|
�Vqmtt
tf|
|dk|
|d�||f|t|
�f|
�Vqmn||	d"kr�|	j|�tt|
d|�|df||f|
�Vnx�||	d#krD||	krtdd|||
f��n|	dd$�}	ttd||f||f|
�Vq�Wn$|
sftd|df��nd}x^||kr�tt�j|
|�}|r�|jd�\}}||f||f|}}}||kr�qon|
||�|
|}}||ks+|dkrE|dkrE|dkrEtt||||
�Vq�|dkr}t|dkrft
nt||||
�Vq�|dkr�|jd�s�t�tt||||
�Vq�|tkrRtt|�}|j|
|�}|r,|jd�}|
||�}tt||||f|
�Vq�||f}
|
|d�}|
}Pq�|tks�|dd	�tks�|dd�tkr
|d%dkr�||f}
tt|p�t|dp�t|d	�}|
|d�d}}|
}Pq�tt||||
�Vq�|j�r3tt||||
�Vq�|dkrHd}q�|dkra|d7}n|dkrz|d8}ntt||||
�Vqott	|
|||f||df|
�V|d7}qoWqmWx;|	dd�D])}ttd|df|dfd�Vq�Wttd|df|dfd�VdS)&Nr�
0123456789r�z	utf-8-sigzutf-8r�rzEOF in multi-line stringrz\
rz\
r��	�z#
�#z
z3unindent does not match any outer indentation levelz
<tokenize>zEOF in multi-line statementr!z...�
�\z([{z)]})r�r)rr)rr)r�r������r�r�r�r�) rr
r�r�r�r�r�r�r��
ERRORTOKEN�tabsize�rstriprrr�r��IndentationErrorr�rF�PseudoToken�spanr�r��endswith�AssertionError�
triple_quoted�endpats�
single_quoted�isidentifierr�r0r�)r�r��lnum�parenlev�	continued�numchars�contstr�needcont�contliner�r��pos�max�strstart�endprog�endmatchr��column�
comment_token�nl_pos�pseudomatchr��spos�eposr��initialr�r-r-r.r��s		


	2



		$#' 
0* $ 
	


'r�cCs
t|d�S)N)r�)r�r-r-r.�generate_tokens�src
s�ddl}dd��dd�fdd�}|jdd�}|jdd	d
ddd
dd�|jdddddddd�|j�}y�|jr�|j}t|d��}tt|j��}WdQXnd}t	t
jjd�}x^|D]V}|j}|j
r|j}nd|j|j}	td|	t||jf�q�WWnbtk
r�}
z?|
jddd�\}}||
jd|||f�WYdd}
~
Xntk
r	}
z5|
jd\}}||
jd|||f�WYdd}
~
Xn�tk
r:}
z||
|�WYdd}
~
Xntk
rh}
z||
�WYdd}
~
XnQtk
r�td�Yn6tk
r�}
z�d|
��WYdd}
~
XnXdS)NrcSst|dtj�dS)N�file)�print�sys�stderr)�messager-r-r.�perror�szmain.<locals>.perrorcsg|r+|f||f}�d|�n+|rH�d||f�n�d|�tjd�dS)Nz%s:%d:%d: error: %sz
%s: error: %sz	error: %sr)r�exit)rr��location�args)rr-r.�error�szmain.<locals>.error�progzpython -m tokenize�destr��nargsr<�metavarzfilename.py�helpz'the file to tokenize; defaults to stdinz-ez--exact�exact�action�
store_truez(display token names using the exact typer�z<stdin>z%d,%d-%d,%d:z%-20s%-15s%-15rrrzinterrupted
zunexpected error: %s)�argparse�ArgumentParser�add_argument�
parse_argsr�r��listr	r�r�r�stdinr(r#r3r�r�rr)r1r�rr�r��OSError�KeyboardInterrupt�	Exception)
r&r�parserrr��fr�r��
token_type�token_range�errr�rr-)rr.�main�sN		
		 //
r4�__main__)r>r?rGrHrKrLrIrJrMrNrOrPrSrTrQrRrUrVrWrXr[r\rYrZr]r^r_r`rarb)r@rArirjrkrlrmrnrorprqrrrsrtrurvrwrxryrzr{r|r}r~rr�r�r�r�r�)}�__doc__�
__author__�__credits__�builtinsrr��codecsrr�collections�iorr�rrBrr�rC�ASCIIr�r��__all__�N_TOKENSrr)rr
�LPAR�RPAR�LSQB�RSQB�COLON�COMMA�SEMI�PLUS�MINUS�STAR�SLASH�VBAR�AMPER�LESS�GREATER�EQUAL�DOT�PERCENT�LBRACE�RBRACE�EQEQUAL�NOTEQUAL�	LESSEQUAL�GREATEREQUAL�TILDE�
CIRCUMFLEX�	LEFTSHIFT�
RIGHTSHIFT�
DOUBLESTAR�	PLUSEQUAL�MINEQUAL�	STAREQUAL�
SLASHEQUAL�PERCENTEQUAL�
AMPEREQUAL�	VBAREQUAL�CIRCUMFLEXEQUAL�LEFTSHIFTEQUAL�RIGHTSHIFTEQUAL�DOUBLESTAREQUAL�DOUBLESLASH�DOUBLESLASHEQUAL�ATr2�
namedtuplerr:r;r=�
Whitespace�Comment�Ignore�Name�	Hexnumber�	Binnumber�	Octnumber�	Decnumber�	Intnumber�Exponent�
Pointfloat�Expfloat�Floatnumber�
Imagnumber�Number�StringPrefix�Single�Double�Single3�Double3�Triple�String�Operator�Bracket�Special�Funny�
PlainToken�Token�ContStr�PseudoExtrasr�rFr�r�r�r�r�r.r�r�r�rr�r
r	r�rr4r4r-r-r-r.�<module>sF







"



	




_]�<

Zerion Mini Shell 1.0