Your IP : 3.139.72.210


Current Path : /usr/lib/python3.6/site-packages/pip/commands/__pycache__/
Upload File :
Current File : //usr/lib/python3.6/site-packages/pip/commands/__pycache__/hash.cpython-36.opt-1.pyc

3

�Pf=�@s~ddlmZddlZddlZddlZddlmZddlmZddl	m
Z
ddlmZm
Z
eje�ZGdd�de�Zd	d
�ZdS)�)�absolute_importN)�Command)�ERROR)�read_chunks)�
FAVORITE_HASH�
STRONG_HASHEScs4eZdZdZdZdZdZ�fdd�Zdd�Z�Z	S)	�HashCommandz�
    Compute a hash of a local package archive.

    These can be used with --hash in a requirements file to do repeatable
    installs.

    �hashz%prog [options] <file> ...z#Compute hashes of package archives.c
sJtt|�j||�|jjdddtdtddjt�d�|jj	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.6/hash.pyrszHashCommand.__init__cCsD|s|jjtj�tS|j}x"|D]}tjd||t||��q"WdS)Nz%s:
--hash=%s:%s)	rZprint_usage�sys�stderrrr
�logger�info�
_hash_of_file)rZoptionsrr
�pathrrr�run(s
zHashCommand.run)
�__name__�
__module__�__qualname__�__doc__�nameZusageZsummaryrr �
__classcell__rr)rrrsrc
CsDt|d��,}tj|�}xt|�D]}|j|�q WWdQRX|j�S)z!Return the hash digest of a file.�rbN)�open�hashlib�newr�updateZ	hexdigest)rr
�archiver	�chunkrrrr3s

r)Z
__future__rr)ZloggingrZpip.basecommandrZpip.status_codesrZ	pip.utilsrZpip.utils.hashesrrZ	getLoggerr!rrrrrrr�<module>s
#

?>