U ��.e��@s�ddlmZddlZddlZddlZddlmZddlmZddl m Z m Z ddl m Z mZe�e�ZGdd�de�Zd d �ZdS) �)�absolute_importN)�Command)�ERROR)� FAVORITE_HASH� STRONG_HASHES)� read_chunks� write_outputcs0eZdZdZdZdZ�fdd�Zdd�Z�ZS)� 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] ...Tc sJtt|�j||�|jjdddtdtdd�t�d�|j� d|j�dS) Nz-az --algorithm� algorithmZstorez$The hash algorithm to use: one of %sz, )�dest�choices�action�default�helpr) �superr �__init__Zcmd_optsZ add_optionrr�join�parserZinsert_option_group)�self�args�kw�� __class__��?/usr/lib/python3.8/site-packages/pip/_internal/commands/hash.pyrs��zHashCommand.__init__cCs>|s|j�tj�tS|j}|D]}td||t||��q dS)Nz%s: --hash=%s:%s)rZ print_usage�sys�stderrrr r� _hash_of_file)rZoptionsrr �pathrrr�run)s�zHashCommand.run) �__name__� __module__� __qualname__�__doc__ZusageZignore_require_venvrr� __classcell__rrrrr s  r c Cs@t|d��(}t�|�}t|�D]}|�|�qW5QRX|��S)z!Return the hash digest of a file.�rb)�open�hashlib�newr�updateZ hexdigest)rr �archive�hash�chunkrrrr4s    r)Z __future__rr'ZloggingrZpip._internal.cli.base_commandrZpip._internal.cli.status_codesrZpip._internal.utils.hashesrrZpip._internal.utils.miscrrZ getLoggerr Zloggerr rrrrr�s    "