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__/tabnanny.cpython-34.pyc

�
i f�,�@s�dZdZddlZddlZddlZddlZeed�sZed��ndddgZda	da
d	d
�Zdd�ZGd
d�de
�Zdd�ZGdd�d�Zdd�Zdd�Zedkr�e�ndS)a�The Tab Nanny despises ambiguous indentation.  She knows no mercy.

tabnanny -- Detection of ambiguous indentation

For the time being this module is intended to be called as a script.
However it is possible to import it into an IDE and use the function
check() described below.

Warning: The API provided by this module is likely to change in future
releases; such changes may not be backward compatible.
�6�N�NLz4tokenize.NL doesn't exist -- tokenize module too old�check�NannyNag�process_tokenscGsKd}x.|D]&}tjj|t|��d}q
Wtjjd�dS)N�� �
)�sys�stderr�write�str)�args�sep�arg�r�-/opt/alt/python34/lib64/python3.4/tabnanny.py�errprint#s


rcCs�y)tjtjdd�d�\}}Wn6tjk
ra}zt|�dSWYdd}~XnXxF|D]>\}}|dkr�tdan|dkritdaqiqiW|s�tdtjdd�dSx|D]}t|�q�WdS)N�Zqvz-qz-vzUsage:rz[-v] file_or_directory ...)�getoptr
�argv�errorr�
filename_only�verboser)Zoptsr�msg�o�arrrr�main*s)


rc@sFeZdZdZdd�Zdd�Zdd�Zdd	�Zd
S)rzg
    Raised by tokeneater() if detecting an ambiguous indent.
    Captured and handled in check().
    cCs!||||_|_|_dS)N)�linenor�line)�selfrrrrrr�__init__AszNannyNag.__init__cCs|jS)N)r)r rrr�
get_linenoCszNannyNag.get_linenocCs|jS)N)r)r rrr�get_msgEszNannyNag.get_msgcCs|jS)N)r)r rrr�get_lineGszNannyNag.get_lineN)�__name__�
__module__�__qualname__�__doc__r!r"r#r$rrrrr<s
c	%Cs�tjj|�r�tjj|�r�tr?td|f�ntj|�}xw|D]o}tjj||�}tjj|�r�tjj|�s�tjj|dd��dkrUt	|�qUqUWdSyt
j|�}Wn=tk
r}zt
d||f�dSWYdd}~XnXtdkr<td|�nzaytt
j|j��Wn@t
jk
r�}zt
d||f�dSWYdd}~Xntk
r�}zt
d	||f�dSWYdd}~Xn�tk
r�}z�|j�}|j�}tr?td
||f�td|f�t|j��nFd|kr\d
|d
}ntrot|�nt||t|��dSWYdd}~XnXWd|j�Xtr�td|f�ndS)a~check(file_or_dir)

    If file_or_dir is a directory and not a symbolic link, then recursively
    descend the directory tree named by file_or_dir, checking all .py files
    along the way. If file_or_dir is an ordinary Python source file, it is
    checked for whitespace related problems. The diagnostic messages are
    written to standard output using the print statement.
    z%r: listing directory�Nz.pyz%r: I/O Error: %srzchecking %r ...z%r: Token Error: %sz%r: Indentation Error: %sz)%r: *** Line %d: trouble in tab city! ***zoffending line: %rr�"z%r: Clean bill of health.���)�os�path�isdir�islinkr�print�listdir�join�normcaser�tokenize�open�OSErrorrr�generate_tokens�readline�
TokenError�IndentationErrorrr"r$r#r�repr�close)	�file�names�name�fullname�frZnag�badlinerrrrrJsT
%
"
c@speZdZd\ZZdd�Zdd�Zdd�Zdd	�Zd
d�Z	dd
�Z
dd�ZdS)�
Whitespacez 	c	Cs||_tjtj}}g}d}}}x�|jD]�}||krc|d}|d}q:||kr�|d}|d}|t|�kr�|dg|t|�d}n||d||<d}q:Pq:W||_||_t|�|f|_t|�dk|_	dS)Nrr)
�rawrC�S�T�len�n�nt�tuple�norm�	is_simple)	r ZwsrErF�count�brHrIZchrrrr!�s(	



"			zWhitespace.__init__cCs&|j\}}tt|�d|�S)Nr)rK�maxrG)r rM�trailingrrr�longest_run_of_spaces�sz Whitespace.longest_run_of_spacescCs^|j\}}d}x3t|t|��D]}|||||}q+W||||jS)Nr)rK�rangerGrI)r �tabsizerMrPZil�irrr�indent_level�s
zWhitespace.indent_levelcCs|j|jkS)N)rK)r �otherrrr�equal�szWhitespace.equalcCs�t|j�|j��d}g}xdtd|d�D]O}|j|�|j|�kr9|j||j|�|j|�f�q9q9W|S)Nr)rOrQrRrU�append)r rVrHr�tsrrr�not_equal_witness�s	zWhitespace.not_equal_witnesscCs�|j|jkrdS|jr8|jr8|j|jkSt|j�|j��d}x=td|d�D](}|j|�|j|�krkdSqkWdS)NFr�T)rHrLrIrOrQrRrU)r rVrHrYrrr�less�szWhitespace.lesscCs�t|j�|j��d}g}xdtd|d�D]O}|j|�|j|�kr9|j||j|�|j|�f�q9q9W|S)Nr)rOrQrRrUrX)r rVrHrrYrrr�not_less_witnesss	zWhitespace.not_less_witnessN)r%r&r'rErFr!rQrUrWrZr\r]rrrrrC�srCcCsMdd�|D�}d}t|�dkr8|d}n|ddj|�S)Ncss|]}t|d�VqdS)rN)r
)�.0�tuprrr�	<genexpr>sz#format_witnesses.<locals>.<genexpr>zat tab sizer�srz, )rGr2)�wZfirsts�prefixrrr�format_witnesses
s

rdcCs�tj}tj}tj}tjtjf}td�g}d}xA|D]9\}}}	}
}||krsd}qI||kr�d}t|�}|dj|�s�|dj|�}
dt	|
�}t
|	d||��n|j|�qI||krd}|d=qI|rI||krId}t|�}|d	j|�s�|d
j
|�}
dt	|
�}t
|	d||��q�qIqIWdS)Nrrrzindent not greater e.g. zindent not equal e.g. ���rererere)r4�INDENT�DEDENT�NEWLINE�COMMENTrrCr\r]rdrrXrWrZ)�tokensrfrgrhZJUNK�indentsZcheck_equal�type�token�start�endrZthisguyZwitnessrrrrrs6				

�__main__)r(�__version__r,r
rr4�hasattr�
ValueError�__all__rrrr�	ExceptionrrrCrdrr%rrrr�<module>
s&=�7

Zerion Mini Shell 1.0