%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /snap/core20/2379/lib/python3.8/__pycache__/
Upload File :
Create Path :
Current File : //snap/core20/2379/lib/python3.8/__pycache__/compileall.cpython-38.pyc

U

k�]en5�	@s�dZddlZddlZddlZddlZddlZddlmZdddgZ	ddd	�Z
dd
d�Zdd�Zddd�Z
ddd�Zdd�Zedkr�ee��Ze�e�dS)a�Module/script to byte-compile all .py files to .pyc files.

When called as a script with arguments, this compiles the directories
given as arguments recursively; the -l option prevents it from
recursing into directories.

Without arguments, if compiles all modules on sys.path, without
recursing into subdirectories.  (Even though it should do so for
packages -- for now, you'll have to deal with packages separately.)

See module py_compile for details of the actual byte-compilation.
�N)�partial�compile_dir�compile_file�compile_path�
ccs|dkrt|tj�rt�|�}|s0td�|��zt�|�}Wn.tk
rl|dkrdtd�|��g}YnX|��|D]�}|dkr�qztj	�
||�}|dk	r�tj	�
||�}nd}tj	�|�s�||fVqz|dkrz|tjkrz|tj
krztj	�|�rztj	�|�szt|||d|d�EdHqzdS)N�zListing {!r}...zCan't list {!r}�__pycache__r�)�ddir�	maxlevels�quiet)�
isinstance�os�PathLike�fspath�print�format�listdir�OSError�sort�path�join�isdir�curdir�pardir�islink�	_walk_dir)�dirr
rr�names�name�fullname�dfile�r"� /usr/lib/python3.8/compileall.pyrs:


�
��rF���r	c
Cs�d}
|dkrtd��|dkrFzddlm}
Wntk
rDd}YnXt||||d�}d}|dkr�|
dk	r�|ppd}|
|d��0}
|
�tt||||||	d	�|�}t|dd
�}W5QRXn(|D]"\}}t	||||||||	�s�d}q�|S)aByte-compile all modules in the given directory tree.

    Arguments (only dir is required):

    dir:       the directory to byte-compile
    maxlevels: maximum recursion level (default 10)
    ddir:      the directory that will be prepended to the path to the
               file as it is compiled into each byte-code file.
    force:     if True, force compilation, even if timestamps are up-to-date
    quiet:     full output with False or 0, errors only with 1,
               no output with 2
    legacy:    if True, produce legacy pyc paths instead of PEP 3147 paths
    optimize:  optimization level or -1 for level of the interpreter
    workers:   maximum number of parallel workers
    invalidation_mode: how the up-to-dateness of the pyc will be checked
    Nrz%workers must be greater or equal to 0r	)�ProcessPoolExecutor)rrr
T)Zmax_workers)�force�rxr�legacy�optimize�invalidation_mode)�defaultF)
�
ValueErrorZconcurrent.futuresr%�ImportErrorr�mapr�_compile_file_tuple�minr)rrr
r&r'rr(r)�workersr*r%Zfiles_and_ddirs�successZexecutorZresults�filer!r"r"r#r2sF
����cKs|\}}t||f|�S)z-Needs to be toplevel for ProcessPoolExecutor.)r)Zfile_and_dfile�kwargsr3r!r"r"r#r/esr/c
Cs�d}|dkr"t|tj�r"t�|�}tj�|�}	|dk	rFtj�||	�}
nd}
|dk	rd|�|�}|rd|Stj�|��r�|r�|d}nB|dkr�|dkr�|nd}
t	j
j||
d�}nt	j
�|�}tj�|�}|	dd	�|	d	d�}}|d
k�r�|�s\zXt
t�|�j�}t�dt	j
jd|�}t|d��}|�d
�}W5QRX||k�rB|WSWntk
�rZYnX|�sptd�|��ztj|||
d||d�}W�ntjk
�r}zjd}|dk�r�|WY�RS|�r�td�|��ntddd�|jjtjjdd�}|� tjj�}t|�W5d}~XYn�t!t"tfk
�r�}zRd}|dk�rJ|WY�:S|�r`td�|��ntddd�t|j#j$d|�W5d}~XYnX|dk�r�d}|S)aTByte-compile one file.

    Arguments (only fullname is required):

    fullname:  the file to byte-compile
    ddir:      if given, the directory name compiled in to the
               byte-code file.
    force:     if True, force compilation, even if timestamps are up-to-date
    quiet:     full output with False or 0, errors only with 1,
               no output with 2
    legacy:    if True, produce legacy pyc paths instead of PEP 3147 paths
    optimize:  optimization level or -1 for level of the interpreter
    invalidation_mode: how the up-to-dateness of the pyc will be checked
    TrN�crr	�)�optimization���z.pyz<4sll�rb�zCompiling {!r}...)r)r*Fz*** Error compiling {!r}...z*** )�end�backslashreplace)�errors�:)%r
rrrr�basenamer�search�isfile�	importlib�util�cache_from_source�dirname�int�stat�st_mtime�structZpack�MAGIC_NUMBER�open�readrrr�
py_compile�compile�PyCompileError�msg�encode�sys�stdout�encoding�decode�SyntaxError�UnicodeError�	__class__�__name__)r r
r&r'rr(r)r*r2rr!Zmo�cfileZoptZ	cache_dir�head�tail�mtimeZexpectZchandleZactual�ok�errrP�er"r"r#rjs�


�
�

�
�
$
c	CsTd}tjD]D}|r|tjkr2|r2|dkrNtd�q
|oLt||d|||||d�}q
|S)a�Byte-compile all module on sys.path.

    Arguments (all optional):

    skip_curdir: if true, skip current directory (default True)
    maxlevels:   max recursion level (default 0)
    force: as for compile_dir() (default False)
    quiet: as for compile_dir() (default 0)
    legacy: as for compile_dir() (default False)
    optimize: as for compile_dir() (default -1)
    invalidation_mode: as for compiler_dir()
    TrzSkipping current directoryN)rr(r)r*)rRrrrrr)	Zskip_curdirrr&rr(r)r*r2rr"r"r#r�s 

�
c
Cs�ddl}|jdd�}|jdddddd	d
�|jdtdd
d�|jddddd�|jdddddd�|jddddd�|jdddddd �|jd!d"d#dd$d �|jd%d&d'd(d)�|jd*d+d,d-d.�|jd/d0d1td2d3�d4d5�tjD�}|jd6t|�d7d8�|��}|j}|j	�r$ddl
}|�|j	�|_	|jdk	�r8|j}n|j
}|j�r�zF|jd9k�rZtjnt|j�� }|D]}|�|����qjW5QRXWn4tk
�r�|jd:k�r�td;�|j��Yd<SX|j�r�|j�d9d=���}	tj|	}
nd}
d>}z�|�rl|D]h}tj�|��r6t||j|j |j	|j|j!|
d?��sbd<}n,t"|||j|j |j	|j|j!|j#|
d@�	�s�d<}�q�|WSt$|j!|j |j|
dA�WSWn,t%k
�r�|jd:k�r�tdB�Yd<SXd>S)CzScript main program.rNz1Utilities to support installing Python libraries.)Zdescriptionz-lZstore_constrrz!don't recurse into subdirectories)�actionZconstr+�dest�helpz-r�	recursionzhcontrol the maximum recursion level. if `-l` and `-r` options are specified, then `-r` takes precedence.)�typerbrcz-f�
store_truer&z/force rebuild even if timestamps are up to date)rarbrcz-q�countrzIoutput only error messages; -qq will suppress the error messages as well.)rarbr+rcz-br(z0use legacy (pre-PEP3147) compiled file locationsz-dZDESTDIRr
z�directory to prepend to file paths for use in compile-time tracebacks and in runtime tracebacks in cases where the source file is unavailable)�metavarrbr+rcz-xZREGEXPr'zskip files matching the regular expression; the regexp is searched for in the full path of each file considered for compilationz-iZFILE�flistzzadd all the files and directories listed in FILE to the list considered for compilation; if "-", names are read from stdin)rhrbrc�compile_destzFILE|DIR�*zrzero or more file and directory names to compile; if no arguments given, defaults to the equivalent of -l sys.path)rh�nargsrcz-jz	--workersr	zRun compileall concurrently)r+rerccSsg|]}|j���dd��qS)�_�-)r�lower�replace)�.0�moder"r"r#�
<listcomp>	s�zmain.<locals>.<listcomp>z--invalidation-modez�set .pyc invalidation mode; defaults to "checked-hash" if the SOURCE_DATE_EPOCH environment variable is set, and "timestamp" otherwise.)�choicesrcrnrzError reading file list {}FrmT)r*)r1r*)r(r&rr*z
[interrupted])&�argparse�ArgumentParser�add_argumentrFrM�PycInvalidationMode�sorted�
parse_argsrjr'�rerNrdrrirR�stdinrK�append�striprrrrr*rp�upperrrrArr
r&r(rr1r�KeyboardInterrupt)
ru�parserZinvalidation_modes�argsZ
compile_destsr{r�f�lineZivl_moder*r2rbr"r"r#�main�s��
�
�
��
���
�
�
��� �
�
�r��__main__)Nrr)	rNFNrFr$r	N)NFNrFr$N)r	rFrFr$N)�__doc__rrR�importlib.utilrBrMrI�	functoolsr�__all__rrr/rrr�rYrFZexit_status�exitr"r"r"r#�<module>s<

�
3�
V�
"i

Zerion Mini Shell 1.0