PK APOCALYPSE V1

APOCALYPSE V1

Current Path : /opt/alt/python311/lib/python3.11/site-packages/pip/_internal/__pycache__/
Upload File :
Current File : //opt/alt/python311/lib/python3.11/site-packages/pip/_internal/__pycache__/cache.cpython-311.pyc

�

�Re�$��z�dZddlZddlZddlZddlZddlmZmZmZm	Z	m
Z
ddlmZm
Z
mZddlmZddlmZddlmZddlmZdd	lmZdd
lmZmZddlmZeje��Z dee!e!fd
e!fd�Z"Gd�d��Z#Gd�de#��Z$Gd�de$��Z%Gd�d��Z&Gd�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�returnc��tj|ddd���}tj|�d�������S)z'Return a stable sha224 of a dictionary.T)�,�:)�	sort_keys�
separators�ensure_ascii�ascii)�json�dumps�hashlib�sha224�encode�	hexdigest)r�ss  ��/builddir/build/BUILDROOT/alt-python311-pip-21.3.1-3.el8.x86_64/opt/alt/python311/lib/python3.11/site-packages/pip/_internal/cache.py�
_hash_dictr$sB���
�1���$�O�O�O�A��>�!�(�(�7�+�+�,�,�6�6�8�8�8�c���eZdZdZdededeeddf�fd�Zdede	efd	�Z
ded
ede	efd�Zdedefd�Z
ded
eede	edefd�Z�xZS)�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)
    �	cache_dir�format_control�allowed_formatsrNc���t�����|r!tj�|��sJ�|pd|_||_||_ddh}|j�|��|ksJ�dS)N�source�binary)	�super�__init__�os�path�isabsr(r)r*�union)�selfr(r)r*�_valid_formats�	__class__s     �r#r/zCache.__init__(s����	���������8���
�
�i� 8� 8�8�8�8�"�*�d���,���.���"�H�-���#�)�)�.�9�9�^�K�K�K�K�K�Kr%�linkc�"�d|ji}|j�|j�|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�subdirectoryr	r
���)�url_without_fragment�	hash_name�hash�subdirectory_fragmentr	r
r$)r4r7�	key_parts�hashed�partss     r#�_get_cache_path_partszCache._get_cache_path_parts4s����D�5�6�	��>�%�$�)�*?�(,�	�I�d�n�%��%�	C�(,�(B�I�n�%�)9�(:�(:�	�$�%�+>�+@�+@�	�'�(��I�&�&��
�����V�A�a�C�[�&��1��+�v�a�b�b�z�B���r%�canonical_package_namec�^�|jp|p|}|rgS|j�|��}|j�|��sgSg}|�|��}tj�|��r.t
j	|��D]}|�
||f���|S�N)r(r)�get_allowed_formatsr*�intersection�get_path_for_linkr0r1�isdir�listdir�append)r4r7rF�
can_not_cache�formats�
candidatesr1�	candidates        r#�_get_candidateszCache._get_candidatesUs��� �N�*�T�2H�.H�T�PT�H�
��	��I��%�9�9�:P�Q�Q���#�0�0��9�9�	��I��
��%�%�d�+�+��
�7�=�=����	5��Z��-�-�
5�
5�	��!�!�9�d�"3�4�4�4�4��r%c��t���)z5Return a directory to store cached items in for link.��NotImplementedError�r4r7s  r#rKzCache.get_path_for_linkes��!�#�#�#r%�package_name�supported_tagsc��t���)zaReturns a link to a cached item if it exists, otherwise returns the
        passed link.
        rU)r4r7rXrYs    r#�getz	Cache.getis��"�#�#�#r%)�__name__�
__module__�__qualname__�__doc__�strr
rr/rrrErrSrKrrr[�
__classcell__�r6s@r#r'r's.���������
L��
L�.;�
L�NQ�RU�h�
L�	
�
L�
L�
L�
L�
L�
L��$��4��9�����B�D��#��$�s�)����� $�d�$�s�$�$�$�$�	$��	$��s�m�	$��S�	�		$�

�	$�	$�	$�	$�	$�	$�	$�	$r%r'c�p��eZdZdZdededdf�fd�Zdedefd�Zded	e	ed
e
edefd�Z�xZ
S)�SimpleWheelCachez&A cache of wheels for future installs.r(r)rNc�P��t���||dh��dS�Nr-)r.r/�r4r(r)r6s   �r#r/zSimpleWheelCache.__init__xs'���
������N�X�J�?�?�?�?�?r%r7c�x�|�|��}|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)rEr(r0r1�join)r4r7rDs   r#rKz"SimpleWheelCache.get_path_for_link{sC���*�*�4�0�0���~�����w�|�D�N�H�=�u�=�=�=�=r%rXrYc�6�g}|s|St|��}|�||��D]�\}}	t|��}n#t$rY�"wxYwt|j��|krt
�d|||���\|�|��s�r|�|�	|��||f����|s|St|��\}	}}tttj�||������S)NzWIgnoring cached wheel %s for %s as it does not match the expected distribution name %s.)rrSrr�name�logger�debug�	supportedrN�support_index_min�minrrr0r1rj)
r4r7rXrYrQrF�
wheel_name�	wheel_dir�wheel�_s
          r#r[zSimpleWheelCache.get�sT���
��	��K�!2�<�!@�!@��%)�%9�%9�$�@V�%W�%W�	�	�!�J�	�
��j�)�)����'�
�
�
���
���� ���,�,�0F�F�F����H��� ������?�?�>�2�2�
������+�+�N�;�;����
�
�
�
��	��K�#&�z�?�?� ��:�y��K�����Y�
� C� C�D�D�E�E�Es�A�
A�A)r\r]r^r_r`r
r/rrKrrrr[rarbs@r#rdrdus��������0�0�@�#�@�}�@��@�@�@�@�@�@�>�d�>�s�>�>�>�>�()F��)F��s�m�)F��S�	�	)F�

�)F�)F�)F�)F�)F�)F�)F�)Fr%rdc�,��eZdZdZdeddf�fd�Z�xZS)�EphemWheelCachezBA SimpleWheelCache that creates it's own temporary cache directoryr)rNc���ttjd���|_t	���|jj|��dS)NT)�kind�globally_managed)rr�EPHEM_WHEEL_CACHE�	_temp_dirr.r/r1)r4r)r6s  �r#r/zEphemWheelCache.__init__�sI���&��0�!�
�
�
���
	�������,�n�=�=�=�=�=r%)r\r]r^r_r
r/rarbs@r#rwrw�sQ�������L�L�>�}�>��>�>�>�>�>�>�>�>�>�>r%rwc��eZdZdedefd�ZdS)�
CacheEntryr7�
persistentc�"�||_||_dSrH)r7r)r4r7rs   r#r/zCacheEntry.__init__�s��
��	�$����r%N)r\r]r^r�boolr/�r%r#r~r~�s:������%��%��%�%�%�%�%�%r%r~c	���eZdZdZdededdf�fd�Zdedefd�Zdedefd	�Z	ded
e
edeedefd�Z
ded
e
edeede
efd
�Z�xZS)�
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.
    r(r)rNc���t���||dh��t||��|_t	|��|_dSrf)r.r/rd�_wheel_cacherw�_ephem_cachergs   �r#r/zWheelCache.__init__�sI���
������N�X�J�?�?�?�,�Y��G�G���+�N�;�;����r%r7c�6�|j�|��SrH)r�rKrWs  r#rKzWheelCache.get_path_for_link����� �2�2�4�8�8�8r%c�6�|j�|��SrH)r�rKrWs  r#�get_ephem_path_for_linkz"WheelCache.get_ephem_path_for_link�r�r%rXrYc�F�|�|||��}|�|S|jSrH)�get_cache_entryr7)r4r7rXrY�cache_entrys     r#r[zWheelCache.get�s/���*�*�4��~�N�N�����K���r%c���|j�|||���}||urt|d���S|j�|||���}||urt|d���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.
        )r7rXrYT)rFN)r�r[r~r�)r4r7rXrY�retvals     r#r�zWheelCache.get_cache_entry�s����"�&�&��%�)�'�
�
��
�����f��6�6�6�6��"�&�&��%�)�'�
�
��
�����f��7�7�7�7��tr%)r\r]r^r_r`r
r/rrKr�rrrr[r~r�rarbs@r#r�r��s)���������<�#�<�}�<��<�<�<�<�<�<�
9�d�9�s�9�9�9�9�9�D�9�S�9�9�9�9�	 ��	 ��s�m�	 ��S�	�		 �

�	 �	 �	 �	 �����s�m���S�	�	�

�*�	��������r%r�)(r_rr�loggingr0�typingrrrrr�pip._vendor.packaging.tagsrr	r
�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�	getLoggerr\rmr`r$r'rdrwr~r�r�r%r#�<module>r�s0����������������	�	�	�	�1�1�1�1�1�1�1�1�1�1�1�1�1�1�Q�Q�Q�Q�Q�Q�Q�Q�Q�Q�9�9�9�9�9�9�9�9�9�9�9�9�=�=�=�=�=�=�*�*�*�*�*�*�,�,�,�,�,�,�E�E�E�E�E�E�E�E�0�0�0�0�0�0�	��	�8�	$�	$��9�$�s�C�x�.�9�S�9�9�9�9�U$�U$�U$�U$�U$�U$�U$�U$�pCF�CF�CF�CF�CF�u�CF�CF�CF�L	>�	>�	>�	>�	>�&�	>�	>�	>�%�%�%�%�%�%�%�%�7�7�7�7�7��7�7�7�7�7r%

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