HEX
Server: Microsoft-IIS/10.0
System: Windows NT ITPWINWEBSVR22 10.0 build 20348 (Windows Server 2022) AMD64
User: www.conferencesearch.co.uk (0)
PHP: 8.3.30
Disabled: NONE
Upload Files
File: D:/Python311/Lib/site-packages/pip/_internal/commands/__pycache__/cache.cpython-311.pyc
�

�mi& ���ddlZddlZddlmZddlmZddlmZddlm	Z	m
Z
ddlmZm
Z
ddlmZddlmZdd	lmZee��ZGd
�de��ZdS)�N)�Values)�Callable)�Command)�ERROR�SUCCESS)�CommandError�PipError)�
filesystem)�	getLogger)�format_sizec��eZdZdZdZdZdd�Zdeee	e
eegdfffd�Zde
d	eede
fd
�Zde
d	eeddfd�Zde
d	eeddfd�Zde
d	eeddfd
�Zdeeddfd�Zdeeddfd�Zde
d	eeddfd�Zde
d	eeddfd�Zde
dedefd�Zde
deefd�Zde
dedeefd�ZdS)�CacheCommandaw
    Inspect and manage pip's wheel cache.

    Subcommands:

    - dir: Show the cache directory.
    - info: Show information about the cache.
    - list: List filenames of packages stored in the cache.
    - remove: Remove one or more package from the cache.
    - purge: Remove all items from the cache.

    ``<pattern>`` can be a glob expression or a package name.
    Tz�
        %prog dir
        %prog info
        %prog list [<pattern>] [--format=[human, abspath]]
        %prog remove <pattern>
        %prog purge
    �returnNc��|j�dddddd���|j�d|j��dS)	Nz--format�store�list_format�human)r�abspathz:Select the output format among: human (default) or abspath)�action�dest�default�choices�helpr)�cmd_opts�
add_option�parser�insert_option_group��selfs �>D:\Python311\Lib\site-packages\pip/_internal/commands/cache.py�add_optionszCacheCommand.add_options(sU���
� � �����(�M�
	!�	
�	
�	
�	
��'�'��4�=�9�9�9�9�9�c�D�|j|j|j|j|jd�S)N)�dir�info�list�remove�purge)�
get_cache_dir�get_cache_info�list_cache_items�remove_cache_items�purge_cachers r �handler_mapzCacheCommand.handler_map4s/���%��'��)��-��%�
�
�	
r"�options�argsc���|���}|js!t�d��tS|r
|d|vrBt�dd�t
|������tS|d}	||||dd���nC#t$r6}t�|jd��tcYd}~Sd}~wwxYwtS)Nz<pip cache commands can not function since cache is disabled.rzNeed an action (%s) to perform.z, �)
r.�	cache_dir�logger�errorr�join�sortedr	r0r)rr/r0r.r�es      r �runzCacheCommand.run=s���&�&�(�(��� �	��L�L�W�X�X�X��L��	�t�A�w�k�1�	��L�L�1��	�	�&��-�-�.�.�
�
�
��L��a���	��K�����a�b�b��2�2�2�2���	�	�	��L�L�����#�#�#��L�L�L�L�L�L�����	�����s�B/�/
C/�9+C*�$C/�*C/c�f�|rtd���t�|j��dS)N�Too many arguments)rr4r%r3�rr/r0s   r r)zCacheCommand.get_cache_dirWs4���	5��3�4�4�4����G�%�&�&�&�&�&r"c	��|rtd���t|�|����}t|�|d����}|�|d��}|�|d��}|�|d��}tjtj|��tj|��z��}tj|��}	tj
d���|||||||	������}
t�|
��dS)Nr;�*�http-v2�http�wheelsa
                    Package index page cache location (pip v23.3+): {http_cache_location}
                    Package index page cache location (older pips): {old_http_cache_location}
                    Package index page cache size: {http_cache_size}
                    Number of HTTP files: {num_http_files}
                    Locally built wheels location: {wheels_cache_location}
                    Locally built wheels size: {wheels_cache_size}
                    Number of locally built wheels: {package_count}
                )�http_cache_location�old_http_cache_location�http_cache_size�num_http_files�wheels_cache_location�
package_count�wheels_cache_size)r�len�_find_http_files�_find_wheels�
_cache_dirr
r�directory_size�format_directory_size�textwrap�dedent�format�stripr4r%)rr/r0rE�num_packagesrBrCrFrDrH�messages           r r*zCacheCommand.get_cache_info]sB���	5��3�4�4�4��T�2�2�7�;�;�<�<���4�,�,�W�c�:�:�;�;��"�o�o�g�y�A�A��"&�/�/�'�6�"B�"B�� $����� B� B��$�0��%�&9�:�:��'�(?�@�@�
A�
�
��'�<�=R�S�S��
�O��

�

��V�$7�(?� /�-�&;�*�"3�����U�W�W�+	�0	���G�����r"c��t|��dkrtd���|r	|d}nd}|�||��}|jdkr|�|��dS|�|��dS)Nr2r;rr>r)rIrrKr�format_for_human�format_for_abspath)rr/r0�pattern�filess     r r+zCacheCommand.list_cache_items�s����t�9�9�q�=�	5��3�4�4�4��	��1�g�G�G��G��!�!�'�7�3�3����'�)�	+��!�!�%�(�(�(�(�(��#�#�E�*�*�*�*�*r"rYc��|st�d��dSg}|D]Q}tj�|��}tj|��}|�d|�d|�d����Rt�d��t�d�t|������dS)NzNo locally built wheels cached.z - z (�)zCache contents:
�
)
r4r%�os�path�basenamer
�format_file_size�appendr6r7)rrY�results�filename�wheel�sizes      r rVzCacheCommand.format_for_human�s����	��K�K�9�:�:�:��F����	3�	3�H��G�$�$�X�.�.�E��.�x�8�8�D��N�N�1��1�1�$�1�1�1�2�2�2�2����'�(�(�(����D�I�I�f�W�o�o�.�.�/�/�/�/�/r"c��|r<t�d�t|������dSdS)Nr\)r4r%r6r7)rrYs  r rWzCacheCommand.format_for_abspath�s>���	2��K�K��	�	�&��-�-�0�0�1�1�1�1�1�	2�	2r"c�X�t|��dkrtd���|std���|�||d��}d}|ddkr||�|��z
}n|d|d�d�z
}|st�|��d}|D]M}|t
j|��jz
}t
j	|��t�
d	|���Nt�d
t|��t|����dS)Nr2r;zPlease provide a patternrzNo matching packagesr>z for pattern "�"z
Removed %szFiles removed: %s (%s))
rIrrKrJr4�warningr]�stat�st_size�unlink�verboser%r)rr/r0rY�no_matching_msg�
bytes_removedrcs       r r,zCacheCommand.remove_cache_items�s5���t�9�9�q�=�	5��3�4�4�4��	;��9�:�:�:��!�!�'�4��7�3�3��0����7�c�>�	;��T�*�*�7�3�3�3�E�E�
�:��Q��:�:�:�:�O��	,��N�N�?�+�+�+��
��	3�	3�H��R�W�X�.�.�6�6�M��I�h�����N�N�<��2�2�2�2����,�c�%�j�j�+�m�:T�:T�U�U�U�U�Ur"c�R�|rtd���|�|dg��S)Nr;r>)rr,r<s   r r-zCacheCommand.purge_cache�s1���	5��3�4�4�4��&�&�w���6�6�6r"�subdirc�L�tj�|j|��S)N)r]r^r6r3)rr/rqs   r rLzCacheCommand._cache_dir�s���w�|�|�G�-�v�6�6�6r"c��|�|d��}|�|d��}tj|d��tj|d��zS)Nr@r?r>�rLr
�
find_files)rr/�old_http_dir�new_http_dirs    r rJzCacheCommand._find_http_files�sV�����w��7�7�����w�	�:�:���$�\�3�7�7�*�:O��#�;
�;
�
�	
r"rXc�n�|�|d��}|d|vrdndz}tj||��S)NrA�-z*.whlz-*.whlrt)rr/rX�	wheel_dirs    r rKzCacheCommand._find_wheels�sA���O�O�G�X�6�6�	�$��w��D�W�W�H�E���$�Y��8�8�8r")rN)�__name__�
__module__�__qualname__�__doc__�ignore_require_venv�usager!�dict�strrrr&r.�intr9r)r*r+rVrWr,r-rLrJrK�r"r rrsW����������
�E�
:�
:�
:�
:�
�T�#�x���c��0C�T�0I�'J�"J�K�
�
�
�
��6���c���s�����4'�V�'�4��9�'��'�'�'�'�(�f�(�D��I�(�$�(�(�(�(�T
+��
+�d�3�i�
+�D�
+�
+�
+�
+�0�d�3�i�0�D�0�0�0�0�2��S�	�2�d�2�2�2�2�V�&�V��S�	�V�d�V�V�V�V�67�6�7��c��7�t�7�7�7�7�7�&�7�#�7�#�7�7�7�7�
��
�4��9�
�
�
�
�9�F�9�S�9�T�#�Y�9�9�9�9�9�9r"r)r]rO�optparser�typingr�pip._internal.cli.base_commandr�pip._internal.cli.status_codesrr�pip._internal.exceptionsrr	�pip._internal.utilsr
�pip._internal.utils.loggingr�pip._internal.utils.miscrr{r4rr�r"r �<module>r�s��	�	�	�	�����������������2�2�2�2�2�2�9�9�9�9�9�9�9�9�;�;�;�;�;�;�;�;�*�*�*�*�*�*�1�1�1�1�1�1�0�0�0�0�0�0�	��8�	�	��W9�W9�W9�W9�W9�7�W9�W9�W9�W9�W9r"