관리-도구
편집 파일: cache.cpython-38.opt-1.pyc
U ��.e� � @ s� d Z ddlZddlZddlZddlZddlmZ ddlmZ ddl m Z ddlmZ ddl mZ ddlmZ dd lmZmZ er�dd lmZmZmZmZ ddlmZ ddlmZ e�e�ZG d d� de �Z!G dd� de!�Z"G dd� de"�Z#G dd� de!�Z$dS )zCache Management � N)�canonicalize_name)�Link)� expanduser)� TempDirectory)�MYPY_CHECK_RUNNING)�path_to_url)�InvalidWheelFilename�Wheel)�Optional�Set�List�Any)� FormatControl)� Pep425Tagc sP e Zd ZdZ� fdd�Zdd� Zdd� Zdd � Zd d� Zdd � Z dd� Z � ZS )�Cachea� An abstract class - provides cache directories for data from links :param cache_dir: The root of the cache. :param format_control: An object of FormatControl class to limit binaries being read from the cache. :param allowed_formats: which formats of files the cache should store. ('binary' and 'source' are the only allowed values) c s8 t t| ��� |rt|�nd | _|| _|| _ddh}d S )N�source�binary)�superr �__init__r � cache_dir�format_control�allowed_formats)�selfr r r Z_valid_formats�� __class__� �7/usr/lib/python3.8/site-packages/pip/_internal/cache.pyr ( s zCache.__init__c C s� |j g}|jdk r4|jdk r4|�d�|j|jg�� d�|�}t�|�� ��� }|dd� |dd� |dd� |dd� g}|S )zEGet parts of part that must be os.path.joined with cache_dir N�=�#� � � ) Zurl_without_fragmentZ hash_name�hash�append�join�hashlibZsha224�encodeZ hexdigest)r �linkZ key_partsZkey_urlZhashed�partsr r r �_get_cache_path_parts2 s ,zCache._get_cache_path_partsc C s� | j p| p| }|rg S t|�}| j�|�}| j�|�s@g S | �|�}zt�|�W S t k r� } z$|j t jt jhkr�g W Y �S � W 5 d }~X Y nX d S �N) r r r Zget_allowed_formatsr �intersection�get_path_for_link�os�listdir�OSError�errnoZENOENTZENOTDIR)r r'