| Server IP : 118.27.122.248 / Your IP : 216.73.216.124 Web Server : Apache System : Linux web0264.sh.tyo1 4.18.0-553.79.1.lve.el7h.x86_64 #1 SMP Wed Oct 15 16:34:46 UTC 2025 x86_64 User : c9415830 ( 11735) PHP Version : 8.4.17 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /opt/alt/python36/lib64/python3.6/Tools/scripts/__pycache__/ |
Upload File : |
3
x2_$ � @ s� d Z dZddddgZddlZddlZejd�Zd Zd
d� Zdd
� Z dd� Z
dd� Zdd� Zedfdd�Z
edkr�xe
dg�D ]Zee� q|W ed� xe
dged�D ]Zee� q�W dS )aC List 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.
zOleg Broytmann, Georg Brandl�has_python_ext�looks_like_python�can_be_compiled�walk_python_files� Ns [\x00-\x08\x0E-\x1F\x7F]Fc C s t rt| � d S )N)�debug�print)�msg� r �;/opt/alt/python36/lib64/python3.6/Tools/scripts/pysource.py�print_debug s r c C s� yt j| �j}W n0 tk
r@ } ztd| |f � d S d }~X nX |dkr^td| |f � d S y
t| d�S tk
r� } ztd| |f � d S d }~X nX d S )Nz%s: permission denied: %si z!%s: the file is too big: %d bytes�rbz%s: access denied: %si )�os�stat�st_size�OSErrorr �open�IOError)�fullpath�size�errr r r
�_open! s
r c C s | j d�p| j d�S )Nz.pyz.pyw)�endswith)r r r r
r 2 s c
C sn t | �}|d krdS |� |j� }W d Q R X tj|�rFtd| � dS | jd�sZ| jd�r^dS d|krjdS dS )NFz%s: appears to be binaryz.pyz.pywTs python)r �readline� binary_re�searchr r )r �infile�liner r r
r 5 s
c C sr t | �}|d krdS |� |j� }W d Q R X yt|| d� W n0 tk
rl } ztd| |f � dS d }~X nX dS )NF�execz%s: cannot compile: %sT)r �read�compile� Exceptionr )r r �coder r r r
r J s c
c s� |dkrg }x�| D ]�}t d| � tjj|�r>||�r�|V qtjj|�r�t d� xxtj|�D ]`\}}}x|D ]}||krn|j|� qnW x4|D ],}tjj||�} t d| � || �r�| V q�W q^W qt d� qW dS )a^ 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
Nztesting: %sz it is a directoryz unknown type)r r
�path�isfile�isdir�walk�remove�join)
�paths� is_pythonZexclude_dirsr"