PK APOCALYPSE V1

APOCALYPSE V1

Current Path : /opt/alt/python39/lib/python3.9/site-packages/pip/_internal/__pycache__/
Upload File :
Current File : //opt/alt/python39/lib/python3.9/site-packages/pip/_internal/__pycache__/cache.cpython-39.pyc

a

��Re�$�@sdZddlZddlZddlZddlZddlmZmZmZm	Z	m
Z
ddlmZm
Z
mZddlmZddlmZddlmZddlmZdd	lmZdd
lmZmZddlmZe�e�Z ee!e!fe!d�d
d�Z"Gdd�d�Z#Gdd�de#�Z$Gdd�de$�Z%Gdd�d�Z&Gdd�de#�Z'dS)zCache Management
�N)�Any�Dict�List�Optional�Set)�Tag�interpreter_name�interpreter_version)�canonicalize_name)�InvalidWheelFilename)�
FormatControl)�Link)�Wheel)�
TempDirectory�
tempdir_kinds)�path_to_url)�d�returncCs&tj|dddd�}t�|�d����S)z'Return a stable sha224 of a dictionary.T)�,�:)�	sort_keys�
separators�ensure_ascii�ascii)�json�dumps�hashlib�sha224�encode�	hexdigest)r�s�r!��/builddir/build/BUILDROOT/alt-python39-pip-21.3.1-2.el8.x86_64/opt/alt/python39/lib/python3.9/site-packages/pip/_internal/cache.py�
_hash_dictsr#cs�eZdZdZeeeedd��fdd�Zee	ed�dd�Z
eee	ed	�d
d�Zeed�dd
�Z
eeee	eed�dd�Z�ZS)�CacheanAn 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)
    N)�	cache_dir�format_control�allowed_formatsrcsTt���|rtj�|�sJ�|p$d|_||_||_ddh}|j�|�|ksPJ�dS)N�source�binary)	�super�__init__�os�path�isabsr%r&r'�union)�selfr%r&r'�_valid_formats��	__class__r!r"r+(s

zCache.__init__��linkrcCs�d|ji}|jdur*|jdur*|j||j<|jr:|j|d<t�|d<t�|d<t|�}|dd�|dd�|dd�|dd�g}|S)	z<Get parts of part that must be os.path.joined with cache_dir�urlN�subdirectoryrr	���)�url_without_fragment�	hash_name�hash�subdirectory_fragmentrr	r#)r0r5�	key_parts�hashed�partsr!r!r"�_get_cache_path_parts4s



,zCache._get_cache_path_parts)r5�canonical_package_namercCst|jp|p|}|rgS|j�|�}|j�|�s8gSg}|�|�}tj�|�rpt�	|�D]}|�
||f�q\|S�N)r%r&�get_allowed_formatsr'�intersection�get_path_for_linkr,r-�isdir�listdir�append)r0r5rC�
can_not_cache�formats�
candidatesr-�	candidater!r!r"�_get_candidatesUs
zCache._get_candidatescCs
t��dS)z5Return a directory to store cached items in for link.N��NotImplementedError�r0r5r!r!r"rGeszCache.get_path_for_link�r5�package_name�supported_tagsrcCs
t��dS)zaReturns a link to a cached item if it exists, otherwise returns the
        passed link.
        NrP)r0r5rTrUr!r!r"�getis	z	Cache.get)�__name__�
__module__�__qualname__�__doc__�strrrr+r
rrBrrOrGrrrV�
__classcell__r!r!r2r"r$s
�!�r$csVeZdZdZeedd��fdd�Zeed�dd�Zee	ee
eed	�d
d�Z�Z
S)�SimpleWheelCachez&A cache of wheels for future installs.N�r%r&rcst��||dh�dS�Nr))r*r+�r0r%r&r2r!r"r+xszSimpleWheelCache.__init__r4cCs,|�|�}|jsJ�tjj|jdg|�R�S)a�Return a directory to store cached wheels for link

        Because there are M wheels for any one sdist, we provide a directory
        to cache them in, and then consult that directory when looking up
        cache hits.

        We only insert things into the cache if they have plausible version
        numbers, so that we don't contaminate the cache with things that were
        not unique. E.g. ./package might have dozens of installs done for it
        and build a version of 0.0...and if we built and cached a wheel, we'd
        end up using the same wheel even if the source has been edited.

        :param link: The link of the sdist for which this will cache wheels.
        �wheels)rBr%r,r-�join)r0r5rAr!r!r"rG{s

z"SimpleWheelCache.get_path_for_linkrSc
	Cs�g}|s|St|�}|�||�D]n\}}zt|�}WntyJYq Yn0t|j�|krlt�d|||�q |�|�sxq |�|�	|�||f�q |s�|St
|�\}	}}ttt
j�||���S)NzWIgnoring cached wheel %s for %s as it does not match the expected distribution name %s.)r
rOrr�name�logger�debug�	supportedrJ�support_index_min�minr
rr,r-rb)
r0r5rTrUrMrC�
wheel_name�	wheel_dir�wheel�_r!r!r"rV�s:
�
��zSimpleWheelCache.get)rWrXrYrZr[rr+r
rGrrrrVr\r!r!r2r"r]us�r]cs(eZdZdZedd��fdd�Z�ZS)�EphemWheelCachezBA SimpleWheelCache that creates it's own temporary cache directoryN)r&rcs&ttjdd�|_t��|jj|�dS)NT)�kind�globally_managed)rr�EPHEM_WHEEL_CACHE�	_temp_dirr*r+r-)r0r&r2r!r"r+�s
�zEphemWheelCache.__init__)rWrXrYrZrr+r\r!r!r2r"rm�srmc@seZdZeed�dd�ZdS)�
CacheEntry�r5�
persistentcCs||_||_dSrDrs)r0r5rtr!r!r"r+�szCacheEntry.__init__N)rWrXrYr
�boolr+r!r!r!r"rr�s�rrcs�eZdZdZeedd��fdd�Zeed�dd�Zeed�d	d
�Z	ee
eeeed�dd
�Z
ee
eeee
ed�dd�Z�ZS)�
WheelCachez�Wraps EphemWheelCache and SimpleWheelCache into a single Cache

    This Cache allows for gracefully degradation, using the ephem wheel cache
    when a certain link is not found in the simple wheel cache first.
    Nr^cs,t��||dh�t||�|_t|�|_dSr_)r*r+r]�_wheel_cacherm�_ephem_cacher`r2r!r"r+�szWheelCache.__init__r4cCs|j�|�SrD)rwrGrRr!r!r"rG�szWheelCache.get_path_for_linkcCs|j�|�SrD)rxrGrRr!r!r"�get_ephem_path_for_link�sz"WheelCache.get_ephem_path_for_linkrScCs |�|||�}|dur|S|jSrD)�get_cache_entryr5)r0r5rTrU�cache_entryr!r!r"rV�szWheelCache.getcCsP|jj|||d�}||ur&t|dd�S|jj|||d�}||urLt|dd�SdS)z�Returns a CacheEntry with a link to a cached item if it exists or
        None. The cache entry indicates if the item was found in the persistent
        or ephemeral cache.
        )r5rTrUT)rtFN)rwrVrrrx)r0r5rTrU�retvalr!r!r"rz�s
��zWheelCache.get_cache_entry)rWrXrYrZr[rr+r
rGryrrrrVrrrzr\r!r!r2r"rv�s�
�rv)(rZrr�loggingr,�typingrrrrrZpip._vendor.packaging.tagsrrr	�pip._vendor.packaging.utilsr
�pip._internal.exceptionsr�#pip._internal.models.format_controlr�pip._internal.models.linkr
�pip._internal.models.wheelr�pip._internal.utils.temp_dirrr�pip._internal.utils.urlsr�	getLoggerrWrdr[r#r$r]rmrrrvr!r!r!r"�<module>s(
XF

if you don't want to be vaporized in a nuclear explosion, i simply have to become nuclear myself… i am atomic