HEX
Server: Apache
System: Linux zacp120.webway.host 4.18.0-553.50.1.lve.el8.x86_64 #1 SMP Thu Apr 17 19:10:24 UTC 2025 x86_64
User: govancoz (1003)
PHP: 8.3.26
Disabled: exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname
Upload Files
File: //usr/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/hashes.cpython-39.pyc
a

?�fF�@s�ddlmZddlZddlmZmZmZddlmZm	Z	m
Z
ddlmZddl
mZer�ddlmZmZmZmZmZddlmZer�dd	lmZndd
lmZdZgd�ZGd
d�de�ZGdd�de�ZdS)�)�absolute_importN)�	iteritems�iterkeys�
itervalues)�HashMismatch�HashMissing�InstallationError)�read_chunks)�MYPY_CHECK_RUNNING)�Dict�List�BinaryIO�NoReturn�Iterator)�PY3)�_Hash)�_hash�sha256)rZsha384Zsha512c@sfeZdZdZddd�Zdd�Zedd��Zd	d
�Zdd�Z	d
d�Z
dd�Zdd�Zdd�Z
dd�ZdS)�HasheszaA wrapper that builds multiple hashes at once and checks them against
    known-good values

    NcCs|durin||_dS)zo
        :param hashes: A dict of algorithm names pointing to lists of allowed
            hex digests
        N��_allowed)�self�hashes�r�>/usr/lib/python3.9/site-packages/pip/_internal/utils/hashes.py�__init__)szHashes.__init__csbt|t�stS|s�S�s|Si}t|j�D],\�}��jvr@q,��fdd�|D�|�<q,t|�S)Ncsg|]}|�j�vr|�qSrr)�.0�v�Zalgrrr�
<listcomp>B�z"Hashes.__and__.<locals>.<listcomp>)�
isinstancer�NotImplementedrr)r�other�new�valuesrrr�__and__1s

zHashes.__and__cCstdd�|j��D��S)Ncss|]}t|�VqdS�N)�len)rZdigestsrrr�	<genexpr>Hr z&Hashes.digest_count.<locals>.<genexpr>)�sumrr%�rrrr�digest_countEszHashes.digest_countcCs||j�|g�vS)z/Return whether the given hex digest is allowed.)r�get)r�	hash_nameZ
hex_digestrrr�is_hash_allowedJszHashes.is_hash_allowedc
Cs�i}t|j�D]<}zt�|�||<WqttfyHtd�|���Yq0q|D]}t|�D]}|�	|�q\qPt
|�D] \}}|��|j|vrvdSqv|�|�dS)z�Check good hashes against ones built from iterable of chunks of
        data.

        Raise HashMismatch if none match.

        zUnknown hash name: {}N)
rr�hashlibr$�
ValueError�	TypeErrorr�formatr�updater�	hexdigest�_raise)r�chunks�gotsr.�chunk�hashZgotrrr�check_against_chunksSs�zHashes.check_against_chunkscCst|j|��dSr')rr�rr8rrrr6msz
Hashes._raisecCs|�t|��S)zaCheck good hashes against a file-like object

        Raise HashMismatch if none match.

        )r;r	)r�filerrr�check_against_fileqszHashes.check_against_filecCs8t|d��}|�|�Wd�S1s*0YdS)N�rb)�openr>)r�pathr=rrr�check_against_pathzszHashes.check_against_pathcCs
t|j�S)z,Return whether I know any known-good hashes.)�boolrr+rrr�__nonzero__szHashes.__nonzero__cCs|��Sr')rDr+rrr�__bool__�szHashes.__bool__)N)�__name__�
__module__�__qualname__�__doc__rr&�propertyr,r/r;r6r>rBrDrErrrrr$s

		rcs(eZdZdZ�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.

    cstt|�jtgid�dS)z!Don't offer the ``hashes`` kwarg.)rN)�superrKr�
FAVORITE_HASHr+��	__class__rrr�szMissingHashes.__init__cCst|t����dSr')rrMr5r<rrrr6�szMissingHashes._raise)rFrGrHrIrr6�
__classcell__rrrNrrK�srK)Z
__future__rr0Zpip._vendor.sixrrrZpip._internal.exceptionsrrrZpip._internal.utils.miscr	Zpip._internal.utils.typingr
�typingrrr
rrrrrrMZ
STRONG_HASHES�objectrrKrrrr�<module>se