Viewing File: /opt/hc_python/lib/python3.12/site-packages/pip/_internal/commands/__pycache__/hash.cpython-312.pyc

�

T�*j����ddlZddlZddlZddlmZddlmZddlmZm	Z	ddl
mZmZddl
mZmZej e�ZGd�de�Zd	ed
edefd�Zy)
�N)�Values)�Command)�ERROR�SUCCESS)�
FAVORITE_HASH�
STRONG_HASHES)�read_chunks�write_outputc�:�eZdZdZdZdZd
d�Zdedee	de
fd	�Zy)�HashCommandz�
    Compute a hash of a local package archive.

    These can be used with --hash in a requirements file to do repeatable
    installs.
    z%prog [options] <file> ...T�returnNc
���|jjdddtdtdj	djt����|jjd|j�y)	Nz-az--algorithm�	algorithm�storez$The hash algorithm to use: one of {}z, )�dest�choices�action�default�helpr)�cmd_opts�
add_optionrr�format�join�parser�insert_option_group)�selfs �J/opt/hc_python/lib/python3.12/site-packages/pip/_internal/commands/hash.py�add_optionszHashCommand.add_optionss_���
�
� � ����!��!�7�>�>��	�	�-�(��	!�
	
�	
���'�'��4�=�=�9��options�argsc
���|s/|jjtj�tS|j
}|D]}t
d||t||���tS)Nz%s:
--hash=%s:%s)	r�print_usage�sys�stderrrrr
�
_hash_of_filer)rr r!r�paths     r�runzHashCommand.run'sT����K�K�#�#�C�J�J�/��L��%�%�	��D��#�T�9�m�D�)�6T�
���r)r
N)�__name__�
__module__�__qualname__�__doc__�usage�ignore_require_venvrr�list�str�intr(�rrrrs7���
)�E���:�
�6�
��c��
�s�
rrr'rr
c���t|d�5}tj|�}t|�D]}|j	|��	ddd�|j�S#1swYj�SxYw)z!Return the hash digest of a file.�rbN)�open�hashlib�newr	�update�	hexdigest)r'r�archive�hash�chunks     rr&r&4s`��	
�d�D�	�W��{�{�9�%�� ��)�E��K�K���*�
��>�>���	
��>�>���s�7A�A5)r6�loggingr$�optparser�pip._internal.cli.base_commandr�pip._internal.cli.status_codesrr�pip._internal.utils.hashesrr�pip._internal.utils.miscr	r
�	getLoggerr)�loggerrr0r&r2rr�<module>rEsV����
��2�9�C�>�	��	�	�8�	$��#�'�#�L������r
Back to Directory File Manager