AlkantarClanX12
Current Path : /proc/self/root/usr/lib/python3.6/site-packages/pip/commands/__pycache__/ |
Current File : //proc/self/root/usr/lib/python3.6/site-packages/pip/commands/__pycache__/hash.cpython-36.pyc |
3 �Pf= � @ s~ d dl mZ d dlZd dlZd dlZd dlmZ d dlmZ d dl m Z d dlmZm Z eje�ZG dd� de�Zd d � ZdS )� )�absolute_importN)�Command)�ERROR)�read_chunks)� FAVORITE_HASH� STRONG_HASHESc s4 e Zd ZdZdZdZdZ� 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 sJ t t| �j||� | jjdddtdtddjt� d� | jj d| j� d S ) Nz-az--algorithm� algorithmZstorez$The hash algorithm to use: one of %sz, )�dest�choices�action�default�helpr ) �superr �__init__Zcmd_optsZ add_optionr r �join�parserZinsert_option_group)�self�args�kw)� __class__� �/usr/lib/python3.6/hash.pyr s zHashCommand.__init__c C sD |s| j jtj� tS |j}x"|D ]}tjd||t||�� q"W d S )Nz%s: --hash=%s:%s) r Zprint_usage�sys�stderrr r �logger�info� _hash_of_file)r Zoptionsr r �pathr r r �run( s zHashCommand.run) �__name__� __module__�__qualname__�__doc__�nameZusageZsummaryr r � __classcell__r r )r r r s r c C sD t | d��,}tj|�}xt|�D ]}|j|� q W W dQ R X |j� S )z!Return the hash digest of a file.�rbN)�open�hashlib�newr �updateZ hexdigest)r r �archiver �chunkr r r r 3 s r )Z __future__r r) Zloggingr Zpip.basecommandr Zpip.status_codesr Z pip.utilsr Zpip.utils.hashesr r Z getLoggerr! r r r r r r r �<module> s #