Mini Shell

Direktori : /proc/self/root/lib64/python3.9/__pycache__/
Upload File :
Current File : //proc/self/root/lib64/python3.9/__pycache__/tabnanny.cpython-39.pyc

a

�DOg�,�@s�dZdZddlZddlZddlZeed�s2ed��gd�Zdada	dd�Z
d	d
�ZGdd�de�Z
d
d�ZGdd�d�Zdd�Zdd�Zedkr�e�dS)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_tokenscGs6d}|D]}tj�|t|��d}qtj�d�dS)N�� �
)�sys�stderr�write�str)�args�sep�arg�r� /usr/lib64/python3.9/tabnanny.py�errprint"s
rc
Cs�ddl}z|�tjdd�d�\}}Wn0|jyV}zt|�WYd}~dSd}~00|D](\}}|dkrttda|dkr\tdaq\|s�tdtjdd�dS|D]}t|�q�dS)Nr�Zqvz-qz-vzUsage:z[-v] file_or_directory ...)�getoptr
�argv�errorr�
filename_only�verboser)rZoptsr�msg�o�arrrr�main)s 
rc@s0eZdZdZdd�Zdd�Zdd�Zdd	�Zd
S)rzk
    Raised by process_tokens() if detecting an ambiguous indent.
    Captured and handled in check().
    cCs||||_|_|_dS�N)�linenor�line)�selfrrr rrr�__init__BszNannyNag.__init__cCs|jSr)r�r!rrr�
get_linenoDszNannyNag.get_linenocCs|jSr)rr#rrr�get_msgFszNannyNag.get_msgcCs|jSr)r r#rrr�get_lineHszNannyNag.get_lineN)�__name__�
__module__�__qualname__�__doc__r"r$r%r&rrrrr=s
rc	
CsXtj�|�r�tj�|�s�tr*td|f�t�|�}|D]J}tj�||�}tj�|�rbtj�|�rztj�|dd��dkr8t	|�q8dSzt
�|�}Wn6ty�}zt
d||f�WYd}~dSd}~00tdkr�td|��zPztt
�|j��W�n,t
j�y@}z(t
d||f�WYd}~W|��dSd}~0t�y�}z(t
d	||f�WYd}~W|��dSd}~0t�y(}z�|��}|��}t�r�td
||f�td|f�t|���n6d|v�r�d
|d
}t�r�t|�nt||t|��WYd}~W|��dSd}~00W|��n
|��0t�rTtd|f�dS)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�close�IndentationErrorrr$r&r%r�repr)	�file�names�name�fullname�frZnagZbadliner rrrrKs`


��
���rc@sLeZdZd\ZZdd�Zdd�Zdd�Zdd	�Zd
d�Z	dd
�Z
dd�ZdS)�
Whitespacez 	c	Cs�||_tjtj}}g}d}}}|jD]v}||krH|d}|d}q*||kr�|d}|d}|t|�kr�|dg|t|�d}||d||<d}q*q�q*||_||_t|�|f|_t|�dk|_	dS)Nrr)
�rawrC�S�T�len�n�nt�tuple�norm�	is_simple)	r!�wsrErF�count�brHrIZchrrrr"�s(

zWhitespace.__init__cCs|j\}}tt|�d|�S�Nr)rK�maxrG)r!rN�trailingrrr�longest_run_of_spaces�s
z Whitespace.longest_run_of_spacescCsH|j\}}d}t|t|��D]}|||||}q||||jS)Nr)rK�rangerGrI)r!�tabsizerNrRZil�irrr�indent_level�s

zWhitespace.indent_levelcCs|j|jkSr)rK)r!�otherrrr�equal�szWhitespace.equalcCsbt|��|���d}g}td|d�D]4}|�|�|�|�kr(|�||�|�|�|�f�q(|SrP�rQrSrTrW�append�r!rXrHr�tsrrr�not_equal_witness�s���zWhitespace.not_equal_witnesscCsp|j|jkrdS|jr(|jr(|j|jkSt|��|���d}td|d�D]}|�|�|�|�krLdSqLdS)NFr�T)rHrLrIrQrSrTrW)r!rXrHr]rrr�less�s��zWhitespace.lesscCsbt|��|���d}g}td|d�D]4}|�|�|�|�kr(|�||�|�|�|�f�q(|SrPrZr\rrr�not_less_witnesss���zWhitespace.not_less_witnessN)r'r(r)rErFr"rSrWrYr^r`rarrrrrC�srCcCs8dd�|D�}d}t|�dkr&|d}|dd�|�S)Ncss|]}t|d�VqdS)rN)r
)�.0�tuprrr�	<genexpr>�z#format_witnesses.<locals>.<genexpr>zat tab sizer�srz, )rGr3)�wZfirsts�prefixrrr�format_witnessess
ricCstj}tj}tj}tjtjf}td�g}d}|D]�\}}}	}
}||krLd}q0||kr�d}t|�}|d�|�s�|d�|�}
dt	|
�}t
|	d||��|�|�q0||kr�d}|d=q0|r0||vr0d}t|�}|d�|�s0|d�
|�}
dt	|
�}t
|	d||��q0dS)Nrrr���zindent not greater e.g. zindent not equal e.g. )r5�INDENT�DEDENT�NEWLINE�COMMENTrrCr`rarirr[rYr^)�tokensrkrlrmZJUNK�indentsZcheck_equal�type�token�start�endr ZthisguyZwitnessrrrrrs6

r�__main__)r*�__version__r-r
r5�hasattr�
ValueError�__all__rrrr�	ExceptionrrrCrirr'rrrr�<module>s&
=7

Zerion Mini Shell 1.0