Sh3ll
OdayForums


Server : LiteSpeed
System : Linux premium84.web-hosting.com 4.18.0-553.44.1.lve.el8.x86_64 #1 SMP Thu Mar 13 14:29:12 UTC 2025 x86_64
User : claqxcrl ( 523)
PHP Version : 8.1.32
Disable Function : NONE
Directory :  /lib/python3.8/site-packages/pip/_internal/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //lib/python3.8/site-packages/pip/_internal/__pycache__/cache.cpython-38.pyc
U

��.e� �@s�dZddlZddlZddlZddlZddlmZddlmZddl	m
Z
ddlmZddl
mZddlmZdd	lmZmZer�dd
lmZmZmZmZddlmZddlmZe�e�ZGd
d�de �Z!Gdd�de!�Z"Gdd�de"�Z#Gdd�de!�Z$dS)zCache Management
�N)�canonicalize_name)�Link)�
expanduser)�
TempDirectory)�MYPY_CHECK_RUNNING)�path_to_url)�InvalidWheelFilename�Wheel)�Optional�Set�List�Any)�
FormatControl)�	Pep425TagcsPeZdZdZ�fdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�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)
    csLtt|���|rt|�nd|_||_||_ddh}|j�|�|ksHt�dS)N�source�binary)	�superr�__init__r�	cache_dir�format_control�allowed_formats�union�AssertionError)�selfrrrZ_valid_formats��	__class__��7/usr/lib/python3.8/site-packages/pip/_internal/cache.pyr(szCache.__init__cCs�|jg}|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�partsrrr�_get_cache_path_parts2s
,zCache._get_cache_path_partsc
Cs�|jp|p|}|rgSt|�}|j�|�}|j�|�s@gS|�|�}zt�|�WSt	k
r�}z$|j
t
jt
jhkr�gWY�S�W5d}~XYnXdS�N)
rrrZget_allowed_formatsr�intersection�get_path_for_link�os�listdir�OSError�errnoZENOENTZENOTDIR)rr)�package_nameZ
can_not_cacheZcanonical_nameZformats�root�errrrr�_get_candidatesLs(���
zCache._get_candidatescCs
t��dS)z>Return a directory to store cached items in for link.
        N��NotImplementedError�rr)rrrr.eszCache.get_path_for_linkcCs
t��dS)zaReturns a link to a cached item if it exists, otherwise returns the
        passed link.
        Nr7)rr)r3�supported_tagsrrr�getks
z	Cache.getcCs$|�|�}tj�||�}tt|��Sr,)r.r/�pathr&rr)rr)�	candidater4r<rrr�_link_for_candidatews
zCache._link_for_candidatecCsdSr,r�rrrr�cleanup~sz
Cache.cleanup)�__name__�
__module__�__qualname__�__doc__rr+r6r.r;r>r@�
__classcell__rrrrrs

rcs0eZdZdZ�fdd�Zdd�Zdd�Z�ZS)�SimpleWheelCachez+A cache of wheels for future installs.
    cstt|��||dh�dS�Nr)rrFr�rrrrrrr�s

�zSimpleWheelCache.__init__cCs |�|�}tjj|jdf|��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.
        Zwheels)r+r/r<r&r)rr)r*rrrr.�s
z"SimpleWheelCache.get_path_for_linkc	Csxg}|�||�D]J}zt|�}Wntk
r8YqYnX|�|�sFq|�|�|�|f�q|sd|S|�|t|�d�S)N�)r6r	rZ	supportedr%Zsupport_index_minr>�min)rr)r3r:Z
candidatesZ
wheel_nameZwheelrrrr;�s

�zSimpleWheelCache.get)rArBrCrDrr.r;rErrrrrF�srFcs(eZdZdZ�fdd�Zdd�Z�ZS)�EphemWheelCachezGA SimpleWheelCache that creates it's own temporary cache directory
    cs&tdd�|_tt|��|jj|�dS)Nzephem-wheel-cache)Zkind)r�	_temp_dirrrKrr<)rrrrrr�s

�zEphemWheelCache.__init__cCs|j��dSr,)rLr@r?rrrr@�szEphemWheelCache.cleanup)rArBrCrDrr@rErrrrrK�srKcs@eZdZdZ�fdd�Zdd�Zdd�Zdd	�Zd
d�Z�Z	S)�
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.
    cs0tt|��||dh�t||�|_t|�|_dSrG)rrMrrF�_wheel_cacherK�_ephem_cacherHrrrr�s
�zWheelCache.__init__cCs|j�|�Sr,)rNr.r9rrrr.�szWheelCache.get_path_for_linkcCs|j�|�Sr,)rOr.r9rrr�get_ephem_path_for_link�sz"WheelCache.get_ephem_path_for_linkcCs0|jj|||d�}||k	r|S|jj|||d�S)N)r)r3r:)rNr;rO)rr)r3r:Zretvalrrrr;�s��zWheelCache.getcCs|j��|j��dSr,)rNr@rOr?rrrr@�s
zWheelCache.cleanup)
rArBrCrDrr.rPr;r@rErrrrrM�srM)%rDr2r'Zloggingr/Zpip._vendor.packaging.utilsrZpip._internal.models.linkrZpip._internal.utils.compatrZpip._internal.utils.temp_dirrZpip._internal.utils.typingrZpip._internal.utils.urlsrZpip._internal.wheelrr	�typingr
rrr
Zpip._internal.indexrZpip._internal.pep425tagsrZ	getLoggerrAZlogger�objectrrFrKrMrrrr�<module>s(
f:

ZeroDay Forums Mini