Edit File: hashes.cpython-36.pyc
3 )�]b2������������������@���sz���d�dl�mZ�d�dlZd�dlmZmZmZ�d�dlmZ�d�dl m Z mZmZ�dZ dddgZG�d d ��d e�ZG�dd��de�ZdS�) �����)�absolute_importN)�HashMismatch�HashMissing�InstallationError)�read_chunks)� iteritems�iterkeys� itervaluesZsha256Zsha384Zsha512c���������������@���sJ���e�Zd�ZdZddd�Zdd��Zdd��Zd d ��Zdd��Zd d��Z dd��Z dS�)�HasheszaA wrapper that builds multiple hashes at once and checks them against known-good values Nc�������������C���s���|dkri�n||�_�dS�)zo :param hashes: A dict of algorithm names pointing to lists of allowed hex digests N)�_allowed)�self�hashes��r����/usr/lib/python3.6/hashes.py�__init__���s����zHashes.__init__c���������� ���C���s����i�}xJt�|�j�D�]<}ytj|�||<�W�q�ttfk rJ���td|���Y�qX�qW�x(|D�] }xt|�D�]}|j|��qdW�qVW�x*t |�D�]\}}|j ��|�j|�kr�dS�q�W�|�j|��dS�)z�Check good hashes against ones built from iterable of chunks of data. Raise HashMismatch if none match. zUnknown hash name: %sN)r���r����hashlib�new� ValueError� TypeErrorr���r ����updater���� hexdigest�_raise)r���Zchunks�gotsZ hash_name�chunk�hashZgotr���r���r����check_against_chunks ���s���� zHashes.check_against_chunksc�������������C���s���t�|�j|��d�S�)N)r���r���)r���r���r���r���r���r���7���s����z Hashes._raisec�������������C���s���|�j�t|��S�)zaCheck good hashes against a file-like object Raise HashMismatch if none match. )r���r���)r����filer���r���r����check_against_file:���s����zHashes.check_against_filec���������� ���C���s ���t�|d��}|�j|�S�Q�R�X�d�S�)N�rb)�openr���)r����pathr���r���r���r����check_against_pathB���s����zHashes.check_against_pathc�������������C���s ���t�|�j�S�)z,Return whether I know any known-good hashes.)�boolr���)r���r���r���r����__nonzero__F���s����zHashes.__nonzero__c�������������C���s���|�j���S�)N)r#���)r���r���r���r����__bool__J���s����zHashes.__bool__)N)�__name__� __module__�__qualname__�__doc__r���r���r���r���r!���r#���r$���r���r���r���r���r ������s��� r ���c�������������������s(���e�Zd�ZdZ��fdd�Zdd��Z���ZS�)� MissingHashesz�A workalike for Hashes used when we're missing a hash for a requirement It computes the actual hash of the requirement and raises a HashMissing exception showing it to the user. c����������������s���t�t|��jtg�id��dS�)z!Don't offer the ``hashes`` kwarg.)r ���N)�superr)���r���� FAVORITE_HASH)r���)� __class__r���r���r���U���s����zMissingHashes.__init__c�������������C���s���t�|t�j����d�S�)N)r���r+���r���)r���r���r���r���r���r���[���s����zMissingHashes._raise)r%���r&���r'���r(���r���r���� __classcell__r���r���)r,���r���r)���N���s���r)���)Z __future__r���r���Zpip.exceptionsr���r���r���Z pip.utilsr���Zpip._vendor.sixr���r���r ���r+���Z STRONG_HASHES�objectr ���r)���r���r���r���r����<module>���s��� :