add-determinism 0.7.3

RPM buildroot helper to strip nondeterministic bits in files
Documentation
U

�AT^�,c@s�dZdZddlZddlZddlZeed�s2ed��dddgZdada	d	d
�Z
dd�ZGd
d�de�Z
dd�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.
Z6�N�NLz4tokenize.NL doesn't exist -- tokenize module too old�check�NannyNag�process_tokenscGs6d}|D]}tj�|t|��d}qtj�d�dS)N�� Z
)�sysZstderrZwrite�str)�argsZsep�arg�r� /usr/lib64/python3.8/tabnanny.py�errprint"s
r
c
Cs�ddl}z|�tjdd�d�\}}Wn2|jk
rX}zt|�WY�dSd}~XYnX|D](\}}|dkrvtda|dkr^tdaq^|s�tdtjdd�dS|D]}t|�q�dS)Nr�Zqvz-qz-vzUsage:z[-v] file_or_directory ...)�getoptrZargvZerrorr
�
filename_only�verboser)rZoptsr	�msgZo�ar
rrr�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)�selfrrrrrr�__init__B�zNannyNag.__init__cC�|jSr)r�rrrr�
get_linenoDrzNannyNag.get_linenocCrr)rrrrr�get_msgFrzNannyNag.get_msgcCrr)rrrrr�get_lineHrzNannyNag.get_lineN)�__name__�
__module__�__qualname__�__doc__rrrrrrrrr=s
c	
CsHtj�|�r�tj�|�s�tr*td|f�t�|�}|D]J}tj�||�}tj�|�rbtj�|�rztj�|dd��dkr8t	|�q8dSzt
�|�}Wn8tk
r�}zt
d||f�WY�dSd}~XYnXtdkr�td|��z>ztt
�|j��W�n"t
jk
�r@}z t
d||f�WY�
W���dSd}~XYn�tk
�r|}zt
d	||f�WY�W��dSd}~XYn�tk
�r }z�|��}|��}t�r�td
||f�td|f�t|���n6d|k�r�d
|d
}t�r�t|�nt||t|��WY�W�dSd}~XYnXW5|��Xt�rDtd|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 directoryi����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: %rrz"z%r: Clean bill of health.)�osZpathZisdirZislinkrZprintZlistdir�joinZnormcaser�tokenizeZopenZOSErrorr
ZcloserZgenerate_tokensZreadlineZ
TokenErrorZIndentationErrorrrrrrZrepr)	ZfileZnamesZnameZfullnameZfrZnagZbadlinerrrrrKsX


��


 
c@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)
Zrawr'�S�T�len�n�ntZtuple�norm�	is_simple)	rZwsr(r)�countZbr+r,Zchrrrr�s(

zWhitespace.__init__cCs|j\}}tt|�d|�S�Nr)r-�maxr*)rr/�trailingrrr�longest_run_of_spaces�s
z Whitespace.longest_run_of_spacescCsH|j\}}d}t|t|��D]}|||||}q||||jS)Nr)r-�ranger*r,)rZtabsizer/r2ZilZirrr�indent_level�s

zWhitespace.indent_levelcCs|j|jkSr)r-)r�otherrrr�equal�rzWhitespace.equalcCsbt|��|���d}g}td|d�D]4}|�|�|�|�kr(|�||�|�|�|�f�q(|Sr0�r1r3r4r5�append�rr6r+r�tsrrr�not_equal_witness�����zWhitespace.not_equal_witnesscCsp|j|jkrdS|jr(|jr(|j|jkSt|��|���d}td|d�D]}|�|�|�|�krLdSqLdS)NFriT)r+r.r,r1r3r4r5)rr6r+r;rrr�less�s��zWhitespace.lesscCsbt|��|���d}g}td|d�D]4}|�|�|�|�kr(|�||�|�|�|�f�q(|Sr0r8r:rrr�not_less_witnessr=zWhitespace.not_less_witnessN)r r!r"r(r)rr3r5r7r<r>r?rrrrr'�sr'cCs8dd�|D�}d}t|�dkr&|d}|dd�|�S)Ncss|]}t|d�VqdS)rN)r)Z.0ZtuprrrZ	<genexpr>sz#format_witnesses.<locals>.<genexpr>zat tab sizerZsrz, )r*r%)ZwZfirstsZprefixrrr�format_witnessess
r@cCstj}tj}tj}tjtjf}td�g}d}|D]�\}}}	}
}||krLd}q0||kr�d}t|�}|d�|�s�|d�|�}
dt	|
�}t
|	d||��|�|�q0||kr�d}|d=q0|r0||kr0d}t|�}|d�|�s0|d�
|�}
dt	|
�}t
|	d||��q0dS)Nrrri����zindent not greater e.g. zindent not equal e.g. )r&�INDENT�DEDENT�NEWLINEZCOMMENTrr'r>r?r@rr9r7r<)ZtokensrArBrCZJUNKZindentsZcheck_equalZtypeZtokenZstartZendrZthisguyZwitnessrrrrrs6

Z__main__)r#Z__version__r$rr&ZhasattrZ
ValueErrorZ__all__rrr
rZ	Exceptionrrr'r@rr rrrrZ<module>s&

=7