Sindbad~EG File Manager

Current Path : /usr/local/lib/python3.11/site-packages/pip/_internal/commands/__pycache__/
Upload File :
Current File : //usr/local/lib/python3.11/site-packages/pip/_internal/commands/__pycache__/cache.cpython-311.pyc

�

�@�e���ddlZddlZddlmZddlmZmZddlmZddl	m
Z
mZddlm
Z
mZddlmZddlmZee��ZGd	�d
e��ZdS)�N)�Values)�Any�List)�Command)�ERROR�SUCCESS)�CommandError�PipError)�
filesystem)�	getLoggerc�j�eZdZdZdZdZdd�Zdedee	de
fd	�Zdedeeddfd
�Z
dedeeddfd�Zdedeeddfd�Zd
ee	ddfd�Zd
ee	ddfd�Zdedeeddfd�Zdedeeddfd�Zdede	de	fd�Zdedee	fd�Zdede	dee	fd�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 �G/usr/local/lib/python3.11/site-packages/pip/_internal/commands/cache.py�add_optionszCacheCommand.add_options'sU���
� � �����(�M�
	!�	
�	
�	
�	
��'�'��4�=�9�9�9�9�9��options�argsc��|j|j|j|j|jd�}|js!t�d��tS|r
|d|vrBt�dd�	t|������tS|d}	||||dd���nC#t$r6}t�|jd��tcYd}~Sd}~wwxYwtS)N)�dir�info�list�remove�purgez<pip cache commands can not function since cache is disabled.rzNeed an action (%s) to perform.z, �)�
get_cache_dir�get_cache_info�list_cache_items�remove_cache_items�purge_cache�	cache_dir�logger�errorr�join�sortedr
r#r)rr"r#�handlersr�es      r�runzCacheCommand.run3s���%��'��)��-��%�
�
��� �	��L�L�W�X�X�X��L��	�t�A�w�h�.�.��L�L�1��	�	�&��*�*�+�+�
�
�
��L��a���	��H�V��W�d�1�2�2�h�/�/�/�/���	�	�	��L�L�����#�#�#��L�L�L�L�L�L�����	�����s�!B<�<
C<�+C7�1C<�7C<c�f�|rtd���t�|j��dS)N�Too many arguments)r	r1r&r0�rr"r#s   rr+zCacheCommand.get_cache_dirSs4���	5��3�4�4�4����G�%�&�&�&�&�&r!c	��|rtd���t|�|����}t|�|d����}|�|d��}|�|d��}|�|d��}tjtj|��tj|��z��}tj|��}	tj
d���|||||||	������}
t�|
��dS)Nr9�*�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�format_size�directory_size�format_directory_size�textwrap�dedent�format�stripr1r&)rr"r#rC�num_packagesr@rArDrBrF�messages           rr,zCacheCommand.get_cache_infoYsB���	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)Nr*r9rr<r)rGr	rIr�format_for_human�format_for_abspath)rr"r#�pattern�filess     rr-zCacheCommand.list_cache_items�s����t�9�9�q�=�=��3�4�4�4��	��1�g�G�G��G��!�!�'�7�3�3����'�)�)��!�!�%�(�(�(�(�(��#�#�E�*�*�*�*�*r!rXc��|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:
�
)
r1r&�os�path�basenamer�format_file_size�appendr3r4)rrX�results�filename�wheel�sizes      rrUzCacheCommand.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[)r1r&r3r4)rrXs  rrVzCacheCommand.format_for_abspath�s>���	2��K�K��	�	�&��-�-�0�0�1�1�1�1�1�	2�	2r!c��t|��dkrtd���|std���|�||d��}d}|ddkr||�|��z
}n|d|d�d�z
}|st�|��|D]1}t
j|��t�d	|���2t�	d
t|����dS)Nr*r9zPlease provide a patternrzNo matching packagesr<z for pattern "�"z
Removed %szFiles removed: %s)
rGr	rIrHr1�warningr\�unlink�verboser&)rr"r#rX�no_matching_msgrbs      rr.zCacheCommand.remove_cache_items�s	���t�9�9�q�=�=��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��I�h�����N�N�<��2�2�2�2����'��U���4�4�4�4�4r!c�R�|rtd���|�|dg��S)Nr9r<)r	r.r:s   rr/zCacheCommand.purge_cache�s1���	5��3�4�4�4��&�&�w���6�6�6r!�subdirc�L�tj�|j|��S)N)r\r]r3r0)rr"rms   rrJzCacheCommand._cache_dir�s���w�|�|�G�-�v�6�6�6r!c��|�|d��}|�|d��}tj|d��tj|d��zS)Nr>r=r<�rJr�
find_files)rr"�old_http_dir�new_http_dirs    rrHzCacheCommand._find_http_files�sV�����w��7�7�����w�	�:�:���$�\�3�7�7�*�:O��#�;
�;
�
�	
r!rWc�n�|�|d��}|d|vrdndz}tj||��S)Nr?�-z*.whlz-*.whlrp)rr"rW�	wheel_dirs    rrIzCacheCommand._find_wheels�s@���O�O�G�X�6�6�	�$��w���W�W�H�E���$�Y��8�8�8r!)rN)�__name__�
__module__�__qualname__�__doc__�ignore_require_venv�usager rr�str�intr7rr+r,r-rUrVr.r/rJrHrI�r!rrrs����������
�E�
:�
:�
:�
:��6���c���s�����@'�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�5�&�5��S�	�5�d�5�5�5�5�27�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\rN�optparser�typingrr�pip._internal.cli.base_commandr�pip._internal.cli.status_codesrr�pip._internal.exceptionsr	r
�pip._internal.utilsr�pip._internal.utils.loggingrrwr1rrr!r�<module>r�s���	�	�	�	�������������������2�2�2�2�2�2�9�9�9�9�9�9�9�9�;�;�;�;�;�;�;�;�*�*�*�*�*�*�1�1�1�1�1�1�	��8�	�	��R9�R9�R9�R9�R9�7�R9�R9�R9�R9�R9r!

Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists