Your IP : 216.73.216.213


Current Path : /opt/alt/python36/lib64/python3.6/Tools/scripts/__pycache__/
Upload File :
Current File : //opt/alt/python36/lib64/python3.6/Tools/scripts/__pycache__/finddiv.cpython-36.opt-1.pyc

3

� f�	�@s\dZddlZddlZddlZddlZdd�Zdd�Zdd�Zd	d
�Ze	dkrXej
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�ytjtjdd�d�\}}Wn*tjk
rH}zt|�dSd}~XnX|sZtd�dSd}x0|D](\}}|dkr�tt�dS|dkrdd}qdWd}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/python36/lib64/python3.6/Tools/scripts/finddiv.py�mains(

rcCsJtjjdtjd|f�tjjdtjd�tjjdtjd�dS)Nz%s: %s
rzUsage: %s [-l] file ...
z"Try `%s -h' for more information.
)r�stderr�writer)r
rrrr-srcCs�tjj|�rt||�Syt|�}Wn0tk
rR}ztjjd|�dSd}~XnXt	j
|j�}d}xR|D]J\}}\}}	}
}|dkrj|r�t|�P||krj|}td|||fdd�qjW|j
�dS)	NzCan't open: %s
r�/�/=z%s:%d:%s� )�end)rr)�os�path�isdir�
processdir�open�IOErrorrrr�tokenize�generate_tokens�readliner	�close)rr�fpr
�gZlastrow�type�token�row�colr�linerrrr2s$
rc	Cs�ytj|�}Wn0tk
r>}ztjjd|�dSd}~XnXg}xB|D]:}tjj||�}tjj|�j	d�sztjj
|�rJ|j|�qJW|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�fnrrrrrr Fs 


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