관리-도구
편집 파일: hashes.cpython-38.pyc
U ��.e� � @ s� d dl mZ d dlZd dlmZmZmZ d dlmZm Z m Z d dlmZ d dl mZ er�d dlmZmZmZmZmZ d dlmZ er�d d lmZ nd d lmZ dZddd gZG dd� de�ZG dd� de�ZdS )� )�absolute_importN)� iteritems�iterkeys� itervalues)�HashMismatch�HashMissing�InstallationError)�read_chunks)�MYPY_CHECK_RUNNING)�Dict�List�BinaryIO�NoReturn�Iterator)�PY3)�_Hash)�_hashZsha256Zsha384Zsha512c @ s^ e Zd ZdZddd�Zedd� �Zdd� Zd d � Zdd� Z d d� Z dd� Zdd� Zdd� 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.8/site-packages/pip/_internal/utils/hashes.py�__init__, s zHashes.__init__c C s t dd� | j�� D ��S )Nc s s | ]}t |�V qd S �N)�len)�.0Zdigestsr r r � <genexpr>7 s z&Hashes.digest_count.<locals>.<genexpr>)�sumr �values�r r r r �digest_count4 s zHashes.digest_countc C s || j �|g �kS )z/Return whether the given hex digest is allowed.)r �get)r � hash_nameZ hex_digestr r r �is_hash_allowed9 s zHashes.is_hash_allowedc C s� i }t | j�D ]<}zt�|�||<