????

Your IP : 3.141.45.217


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

�

��Qg�(���dZddlZddlZddlZddlZddlmZddlmZm	Z	m
Z
mZddlm
Z
mZmZddlmZddlmZddlmZdd	lmZdd
lmZddlmZmZddlmZeje ��Z!d
Z"de	e#e#fde#fd�Z$Gd�d��Z%Gd�de%��Z&Gd�de&��Z'Gd�d��Z(Gd�de%��Z)dS)zCache Management
�N)�Path)�Any�Dict�List�Optional)�Tag�interpreter_name�interpreter_version)�canonicalize_name)�InvalidWheelFilename)�	DirectUrl)�Link)�Wheel)�
TempDirectory�
tempdir_kinds)�path_to_urlzorigin.json�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  �s/builddir/build/BUILD/imunify360-venv-2.5.0/opt/imunify360/venv/lib/python3.11/site-packages/pip/_internal/cache.py�
_hash_dictr$sB���
�1���$�O�O�O�A��>�!�(�(�7�+�+�,�,�6�6�8�8�8�c���eZdZdZdeddf�fd�Zdedeefd�Zdededee	fd	�Z
dedefd
�Zdedeedee
defd
�Z�xZS)�CachezuAn abstract class - provides cache directories for data from links

    :param cache_dir: The root of the cache.
    �	cache_dirrNc���t�����|r!tj�|��sJ�|pd|_dS�N)�super�__init__�os�path�isabsr(��selfr(�	__class__s  �r#r,zCache.__init__&sH���
���������8���
�
�i� 8� 8�8�8�8�"�*�d����r%�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$)r1r3�	key_parts�hashed�partss     r#�_get_cache_path_partszCache._get_cache_path_parts+s����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|�|���tj����r �fd�tj���D��SgS)Nc���g|]}|�f��S�rE)�.0�	candidater.s  �r#�
<listcomp>z)Cache._get_candidates.<locals>.<listcomp>Ss���H�H�H�)�Y��%�H�H�Hr%)r(�get_path_for_linkr-r.�isdir�listdir)r1r3rB�
can_not_cacher.s    @r#�_get_candidateszCache._get_candidatesLs~��� �N�*�T�2H�.H�T�PT�H�
��	��I��%�%�d�+�+��
�7�=�=����	I�H�H�H�H�r�z�$�7G�7G�H�H�H�H��	r%c��t���)z5Return a directory to store cached items in for link.��NotImplementedError�r1r3s  r#rIzCache.get_path_for_linkVs��!�#�#�#r%�package_name�supported_tagsc��t���)zaReturns a link to a cached item if it exists, otherwise returns the
        passed link.
        rO)r1r3rRrSs    r#�getz	Cache.getZs��"�#�#�#r%)�__name__�
__module__�__qualname__�__doc__�strr,rrrArrMrIrrrU�
__classcell__�r2s@r#r'r' s
���������
+�#�+�$�+�+�+�+�+�+�
�$��4��9�����B�D��#��$�s�)�����$�d�$�s�$�$�$�$�	$��	$��s�m�	$��S�	�		$�

�	$�	$�	$�	$�	$�	$�	$�	$r%r'c�l��eZdZdZdeddf�fd�Zdedefd�Zdedeed	e	e
defd
�Z�xZS)�SimpleWheelCachez&A cache of wheels for future installs.r(rNc�J��t���|��dSr*)r+r,r0s  �r#r,zSimpleWheelCache.__init__is!���
������#�#�#�#�#r%r3c�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)rAr(r-r.�join)r1r3r@s   r#rIz"SimpleWheelCache.get_path_for_linklsB���*�*�4�0�0���~���~��w�|�D�N�H�=�u�=�=�=�=r%rRrSc�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.)rrMrr�name�logger�debug�	supported�append�support_index_min�minrrr-r.rb)
r1r3rRrS�
candidatesrB�
wheel_name�	wheel_dir�wheel�_s
          r#rUzSimpleWheelCache.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)
rVrWrXrYrZr,rrIrrrrUr[r\s@r#r^r^fs��������0�0�$�#�$�$�$�$�$�$�$�$�>�d�>�s�>�>�>�>�()F��)F��s�m�)F��S�	�	)F�

�)F�)F�)F�)F�)F�)F�)F�)Fr%r^c�$��eZdZdZd�fd�Z�xZS)�EphemWheelCachezBA SimpleWheelCache that creates it's own temporary cache directoryrNc���ttjd���|_t	���|jj��dS)NT)�kind�globally_managed)rr�EPHEM_WHEEL_CACHE�	_temp_dirr+r,r.)r1r2s �r#r,zEphemWheelCache.__init__�sG���&��0�!�
�
�
���
	�������,�-�-�-�-�-r%)rN)rVrWrXrYr,r[r\s@r#rqrq�sC�������L�L�.�.�.�.�.�.�.�.�.�.r%rqc��eZdZdedefd�ZdS)�
CacheEntryr3�
persistentc�x�||_||_d|_t|jj��jtz}|���rj	tj	|�
d�����|_dS#t$r-}t�
d||j|��Yd}~dSd}~wwxYwdS)N�utf-8��encodingz7Ignoring invalid cache entry origin file %s for %s (%s))r3ry�originr�	file_path�parent�ORIGIN_JSON_NAME�existsr
�	from_json�	read_text�	Exceptionre�warning�filename)r1r3ry�origin_direct_url_path�es     r#r,zCacheEntry.__init__�s���
��	�$���+/���!%�d�i�&9�!:�!:�!A�DT�!T��!�(�(�*�*�	�

�'�1�*�4�4�g�4�F�F���������
�
�
����M�*��M��	�������������
����	�	s�-B�
B7�
"B2�2B7N)rVrWrXr�boolr,rEr%r#rxrx�s:���������������r%rxc	����eZdZdZdeddf�fd�Zdedefd�Zdedefd�Zded	e	ed
e
edefd�Zded	e	ed
e
ede	e
fd�Zeded
eddfd���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(rNc���t���|��t|��|_t	��|_dSr*)r+r,r^�_wheel_cacherq�_ephem_cacher0s  �r#r,zWheelCache.__init__�s?���
������#�#�#�,�Y�7�7���+�-�-����r%r3c�6�|j�|��Sr*)r�rIrQs  r#rIzWheelCache.get_path_for_link����� �2�2�4�8�8�8r%c�6�|j�|��Sr*)r�rIrQs  r#�get_ephem_path_for_linkz"WheelCache.get_ephem_path_for_link�r�r%rRrSc�F�|�|||��}|�|S|jSr*)�get_cache_entryr3)r1r3rRrS�cache_entrys     r#rUzWheelCache.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.
        )r3rRrST)ryFN)r�rUrxr�)r1r3rRrS�retvals     r#r�zWheelCache.get_cache_entry�s����"�&�&��%�)�'�
�
��
�����f��6�6�6�6��"�&�&��%�)�'�
�
��
�����f��7�7�7�7��tr%�
download_infoc���t|��tz}|���r�	tj|�d�����}|j|jkr't�d|j||j��n3#t$r&}t�d||��Yd}~nd}~wwxYw|�
|���d���dS)Nr{r|z�Origin URL %s in cache entry %s does not match download URL %s. This is likely a pip bug or a cache corruption issue. Will overwrite it with the new value.zPCould not read origin file %s in cache entry (%s). Will attempt to overwrite it.)rr�r�r
r�r�r5rer�r��
write_text�to_json)r(r��origin_pathr~r�s     r#�record_download_originz!WheelCache.record_download_origin	s���9�o�o�(8�8�������	�
�"�,�[�-B�-B�G�-B�-T�-T�U�U���:��!2�2�2��N�N�@��
�!�%�)�
������
�
�
����4���	������������
����&	���}�4�4�6�6���I�I�I�I�Is�(B
�
B=�B8�8B=)rVrWrXrYrZr,rrIr�rrrrUrxr��staticmethodr
r�r[r\s@r#r�r��sb���������.�#�.�$�.�.�.�.�.�.�
9�d�9�s�9�9�9�9�9�D�9�S�9�9�9�9�	 ��	 ��s�m�	 ��S�	�		 �

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

�*�	�����8�J�#�J�i�J�D�J�J�J��\�J�J�J�J�Jr%r�)*rYrr�loggingr-�pathlibr�typingrrrr�pip._vendor.packaging.tagsrr	r
�pip._vendor.packaging.utilsr�pip._internal.exceptionsr�pip._internal.models.direct_urlr
�pip._internal.models.linkr�pip._internal.models.wheelr�pip._internal.utils.temp_dirrr�pip._internal.utils.urlsr�	getLoggerrVrer�rZr$r'r^rqrxr�rEr%r#�<module>r�sV����������������	�	�	�	�������,�,�,�,�,�,�,�,�,�,�,�,�Q�Q�Q�Q�Q�Q�Q�Q�Q�Q�9�9�9�9�9�9�9�9�9�9�9�9�5�5�5�5�5�5�*�*�*�*�*�*�,�,�,�,�,�,�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�C$�C$�C$�C$�C$�C$�C$�C$�LCF�CF�CF�CF�CF�u�CF�CF�CF�L	.�	.�	.�	.�	.�&�	.�	.�	.���������0RJ�RJ�RJ�RJ�RJ��RJ�RJ�RJ�RJ�RJr%