Current File : //lib/python3.9/site-packages/pip/_internal/commands/__pycache__/hash.cpython-39.pyc
a

[��f��@s�ddlZddlZddlZddlmZddlmZddlmZddl	m
Z
mZddlm
Z
mZddlmZmZe�e�ZGdd	�d	e�Zeeed
�dd�ZdS)
�N)�Values)�List)�Command)�ERROR�SUCCESS)�
FAVORITE_HASH�
STRONG_HASHES)�read_chunks�write_outputc@s<eZdZdZdZdZdd�dd�Zeee	e
d�d	d
�ZdS)�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> ...TN)�returncCs:|jjdddtdtd�d�t��d�|j�d|j�dS)	Nz-az--algorithm�	algorithm�storez$The hash algorithm to use: one of {}z, )�dest�choices�action�default�helpr)Zcmd_optsZ
add_optionrr�format�join�parserZinsert_option_group)�self�r�?/usr/lib/python3.9/site-packages/pip/_internal/commands/hash.py�add_optionss��zHashCommand.add_options)�options�argsrcCs>|s|j�tj�tS|j}|D]}td||t||��q tS)Nz%s:
--hash=%s:%s)	r�print_usage�sys�stderrrr
r
�
_hash_of_filer)rrrr
�pathrrr�run(s�zHashCommand.run)�__name__�
__module__�__qualname__�__doc__�usageZignore_require_venvrrr�str�intr"rrrrrs
r)r!r
rcCsTt|d��2}t�|�}t|�D]}|�|�qWd�n1sB0Y|��S)z!Return the hash digest of a file.�rbN)�open�hashlib�newr	�updateZ	hexdigest)r!r
�archive�hash�chunkrrrr 5s

*r )r,ZloggingrZoptparser�typingrZpip._internal.cli.base_commandrZpip._internal.cli.status_codesrrZpip._internal.utils.hashesrrZpip._internal.utils.miscr	r
Z	getLoggerr#�loggerrr(r rrrr�<module>s
&