File: //usr/local/lib/python3.10/dist-packages/pip/_internal/commands/__pycache__/cache.cpython-310.pyc
o
��h& � @ s� d dl Z d dlZd dlmZ d dlmZ d dlmZ d dlm Z m
Z
d dlmZm
Z
d dlmZ d dlmZ d d lmZ ee�ZG d
d� de�ZdS )� N)�Values)�Callable)�Command)�ERROR�SUCCESS)�CommandError�PipError)�
filesystem)� getLogger)�format_sizec @ sV e Zd ZdZdZdZd%dd�Zdeee e
ee gdf f fdd �Zd
e
dee de
fdd
�Zd
e
dee ddfdd�Zd
e
dee ddfdd�Zd
e
dee ddfdd�Zdee ddfdd�Zdee ddfdd�Zd
e
dee ddfdd�Zd
e
dee ddfdd�Zd
e
dedefdd�Zd
e
dee fd d!�Zd
e
d"edee fd#d$�ZdS )&�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>] [--format=[human, abspath]]
%prog remove <pattern>
%prog purge
�returnNc C s, | j jddddddd� | j�d| j � d S ) Nz--format�store�list_format�human)r �abspathz:Select the output format among: human (default) or abspath)�action�dest�default�choices�helpr )�cmd_opts�
add_option�parser�insert_option_group��self� r �G/usr/local/lib/python3.10/dist-packages/pip/_internal/commands/cache.py�add_options( s � zCacheCommand.add_optionsc C s | j | j| j| j| jd�S )N)�dir�info�list�remove�purge)�
get_cache_dir�get_cache_info�list_cache_items�remove_cache_items�purge_cacher r r r �handler_map4 s �zCacheCommand.handler_map�options�argsc
C s� | � � }|jst�d� tS |r|d |vr#t�dd�t|��� tS |d }z|| ||dd � � W t S tyQ } zt�|jd � tW Y d }~S d }~ww )Nz<pip cache commands can not function since cache is disabled.r zNeed an action (%s) to perform.z, � )
r* � cache_dir�logger�errorr �join�sortedr r, r )r r+ r, r* r �er r r �run= s&