HEX
Server: Apache
System: Linux zacp120.webway.host 4.18.0-553.50.1.lve.el8.x86_64 #1 SMP Thu Apr 17 19:10:24 UTC 2025 x86_64
User: govancoz (1003)
PHP: 8.3.26
Disabled: exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname
Upload Files
File: //usr/lib/python3.9/site-packages/pip/_internal/commands/__pycache__/cache.cpython-39.pyc
a

?�f,�@s�ddlmZddlZddlZddlZddlmmmZddl	m
Z
ddlmZm
Z
ddlmZmZddlmZer�ddlmZddlmZmZe�e�ZGd	d
�d
e
�ZdS)�)�absolute_importN)�Command)�ERROR�SUCCESS)�CommandError�PipError)�MYPY_CHECK_RUNNING)�Values)�Any�Listc@sXeZdZdZdZdZdd�Zdd�Zdd	�Zd
d�Z	dd
�Z
dd�Zdd�Zdd�Z
dS)�CacheCommandaw
    Inspect and manage pip's wheel cache.

    Subcommands:

    - dir: Show the cache directory.
    - info: Show information about the cache.
    - list: List filenames of packages stored in the cache.
    - remove: Remove one or more package from the cache.
    - purge: Remove all items from the cache.

    ``<pattern>`` can be a glob expression or a package name.
    Tz|
        %prog dir
        %prog info
        %prog list [<pattern>]
        %prog remove <pattern>
        %prog purge
    c
Cs�|j|j|j|j|jd�}|js.t�d�tS|r>|d|vrXt�dd�	t
|���tS|d}z||||dd��Wn8ty�}z t�|jd�tWYd}~Sd}~00t
S)N)�dir�info�list�remove�purgez<pip cache commands can not function since cache is disabled.rzNeed an action (%s) to perform.z, �)�
get_cache_dir�get_cache_info�list_cache_items�remove_cache_items�purge_cache�	cache_dir�logger�errorr�join�sortedr�argsr)�self�optionsr�handlers�action�e�r#�@/usr/lib/python3.9/site-packages/pip/_internal/commands/cache.py�run-s,�
�zCacheCommand.runcCs|rtd��t�|j�dS)N�Too many arguments)rrrr�rrrr#r#r$rOszCacheCommand.get_cache_dircCsX|rtd��t|�|d��}|�|�}t�|�}t�d�j|||d��	�}t
�|�dS)Nr&�*zq
            Location: {location}
            Size: {size}
            Number of wheels: {package_count}
        )�locationZ
package_count�size)r�len�_find_wheels�_wheels_cache_dir�
filesystemZformat_directory_size�textwrap�dedent�format�striprr)rrrZnum_packagesZcache_locationZ
cache_size�messager#r#r$rVs


�

zCacheCommand.get_cache_infoc	Cs�t|�dkrtd��|r"|d}nd}|�||�}|sDt�d�dSg}|D],}tj�|�}t�	|�}|�
d�||��qLt�d�t�d�t
|���dS)	Nrr&rr(zNothing cached.z
 - {} ({})zCache contents:
�
)r+rr,rr�os�path�basenamer.Zformat_file_size�appendr1rr)	rrr�pattern�files�results�filenameZwheelr*r#r#r$rls 



zCacheCommand.list_cache_itemscCspt|�dkrtd��|s td��|�||d�}|s<td��|D]}t�|�t�d|�q@t�dt|��dS)Nrr&zPlease provide a patternrzNo matching packagesz
Removed %szFiles removed: %s)r+rr,r5�unlinkr�debugr)rrrr:r<r#r#r$r�s
zCacheCommand.remove_cache_itemscCs|rtd��|�|dg�S)Nr&r()rrr'r#r#r$r�szCacheCommand.purge_cachecCstj�|jd�S)NZwheels)r5r6rr)rrr#r#r$r-�szCacheCommand._wheels_cache_dircCs*|�|�}|d|vrdnd}t�||�S)N�-z*.whlz-*.whl)r-r.Z
find_files)rrr9Z	wheel_dirr#r#r$r,�s
zCacheCommand._find_wheelsN)�__name__�
__module__�__qualname__�__doc__Zignore_require_venvZusager%rrrrrr-r,r#r#r#r$rs"r)Z
__future__rZloggingr5r/Zpip._internal.utils.filesystemZ	_internalZutilsr.Zpip._internal.cli.base_commandrZpip._internal.cli.status_codesrrZpip._internal.exceptionsrrZpip._internal.utils.typingrZoptparser	�typingr
rZ	getLoggerr@rrr#r#r#r$�<module>s