Your IP : 18.227.134.165


Current Path : /lib64/python2.7/Tools/scripts/
Upload File :
Current File : //lib64/python2.7/Tools/scripts/pysource.pyo

�
�fc@s�dZdZddddgZddlZddlZejd�ZeZd	�Z	d
�Z
d�Zd�Zd
�Z
edd�Zedkr�xedg�D]ZeGHq�WdGHx%edgde
�D]ZeGHq�WndS(sCList python source files.

There are three functions to check whether a file is a Python source, listed
here with increasing complexity:

- has_python_ext() checks whether a file name ends in '.py[w]'.
- look_like_python() checks whether the file is not binary and either has
  the '.py[w]' extension or the first line contains the word 'python'.
- can_be_compiled() checks whether the file can be compiled by compile().

The file also must be of appropriate size - not bigger than a megabyte.

walk_python_files() recursively lists all Python files under the given directories.
sOleg Broytmann, Georg Brandlthas_python_exttlooks_like_pythontcan_be_compiledtwalk_python_filesi����Ns	[--]cCstr|GHndS(N(tdebug(tmsg((s./usr/lib64/python2.7/Tools/scripts/pysource.pytprint_debugscCs�ytj|�j}Wn(tk
r@}td||f�dSX|dkretd||f�dSyt|d�SWn(tk
r�}td||f�dSXdS(Ns%s: permission denied: %sis!%s: the file is too big: %d bytestrUs%s: access denied: %si(toststattst_sizetOSErrorRtNonetopentIOError(tfullpathtsizeterr((s./usr/lib64/python2.7/Tools/scripts/pysource.pyt_open!scCs|jd�p|jd�S(Ns.pys.pyw(tendswith(R((s./usr/lib64/python2.7/Tools/scripts/pysource.pyR2scCs�t|�}|dkrtS|j�}|j�tj|�rStd|�tS|jd�sq|jd�rut	Sd|kr�t	StS(Ns%s: appears to be binarys.pys.pywtpython(
RRtFalsetreadlinetcloset	binary_retsearchRRtTrue(Rtinfiletline((s./usr/lib64/python2.7/Tools/scripts/pysource.pyR5s
cCsut|�}|dkrtS|j�}|j�yt||d�Wn(tk
rp}td||f�tSXtS(Ntexecs%s: cannot compile: %s(	RRRtreadRtcompilet	ExceptionRR(RRtcodeR((s./usr/lib64/python2.7/Tools/scripts/pysource.pyRJs
c
cs"|dkrg}nx|D]�}td|�tjj|�rY||�r|Vqqtjj|�rtd�x�tj|�D]�\}}}x*|D]"}||kr�|j|�q�q�WxE|D]=}tjj||�}	td|	�||	�r�|	Vq�q�Wq�Wqtd�qWdS(s^    Recursively yield all Python source files below the given paths.

    paths: a list of files and/or directories to be checked.
    is_python: a function that takes a file name and checks whether it is a
               Python source file
    exclude_dirs: a list of directory base names that should be excluded in
                  the search
    stesting: %ss    it is a directorys    unknown typeN(	RRRtpathtisfiletisdirtwalktremovetjoin(
tpathst	is_pythontexclude_dirsR"tdirpathtdirnamest	filenamestexcludetfilenameR((s./usr/lib64/python2.7/Tools/scripts/pysource.pyR[s&
	



t__main__t.s
----------R)(t__doc__t
__author__t__all__RtreRRRRRRRRRRRt__name__R(((s./usr/lib64/python2.7/Tools/scripts/pysource.pyt<module>s"					!	

?>