Your IP : 216.73.217.129


Current Path : /opt/alt/python37/lib64/python3.7/Tools/scripts/__pycache__/
Upload File :
Current File : //opt/alt/python37/lib64/python3.7/Tools/scripts/__pycache__/finddiv.cpython-37.opt-1.pyc

B

� f�	�@s\dZddlZddlZddlZddlZdd�Zdd�Zdd�Zd	d
�Ze	dkrXe�
e��dS)a	finddiv - a grep-like tool that looks for division operators.

Usage: finddiv [-l] file_or_directory ...

For directory arguments, all files in the directory whose name ends in
.py are processed, and subdirectories are processed recursively.

This actually tokenizes the files to avoid false hits in comments or
strings literals.

By default, this prints all lines containing a / or /= operator, in
grep -n style.  With the -l option specified, it prints the filename
of files that contain at least one / or /= operator.
�Nc	
Cs�yt�tjdd�d�\}}Wn,tjk
rJ}zt|�dSd}~XYnX|s\td�dSd}x0|D](\}}|dkr�tt�dS|dkrfd}qfWd}x|D]}t||�}|p�|}q�W|S)N�Zlh�z&at least one file argument is requiredrz-hz-l)�getopt�sys�argv�error�usage�print�__doc__�process)	Zopts�args�msg�	listnames�o�a�exit�filename�x�r�:/opt/alt/python37/lib64/python3.7/Tools/scripts/finddiv.py�mains(

rcCsJtj�dtjd|f�tj�dtjd�tj�dtjd�dS)Nz%s: %s
rzUsage: %s [-l] file ...
z"Try `%s -h' for more information.
)r�stderr�writer)r
rrrr-src
Cs�tj�|�rt||�Syt|�}Wn2tk
rT}ztj�d|�dSd}~XYnXt	�
|j�}d}xR|D]J\}}\}}	}
}|dkrl|r�t|�P||krl|}td|||fdd�qlW|�
�dS)NzCan't open: %s
r)�/z/=z%s:%d:%s� )�end)�os�path�isdir�
processdir�open�IOErrorrrr�tokenize�generate_tokens�readliner	�close)rr�fpr
�gZlastrow�type�token�row�colr�linerrrr2s$
rc	
Cs�yt�|�}Wn2tk
r@}ztj�d|�dSd}~XYnXg}xB|D]:}tj�||�}tj�|��	d�s|tj�
|�rL|�|�qLW|jtjjd�d}x|D]}t
||�}|p�|}q�W|S)NzCan't list directory: %s
rz.py)�key)r�listdir�OSErrorrrrr�join�normcase�endswithr�append�sortr)	�dirr�namesr
�files�name�fnrrrrrrFs 


r�__main__)r
rrrr"rrrr�__name__rrrrr�<module>s