ReF@s ddlmZddlZddlmZmZmZddlmZm Z m Z ddl m Z ddl mZerddlmZmZmZmZmZddlmZerdd lmZndd lmZd Zd d d gZGdddeZGdddeZdS))absolute_importN) iteritemsiterkeys itervalues) HashMismatch HashMissingInstallationError) read_chunks)MYPY_CHECK_RUNNING)DictListBinaryIONoReturnIterator)PY3)_Hash)_hashsha256sha384sha512c@seZdZdZdddZddZeddZd d Zd d Z d dZ ddZ ddZ ddZ ddZdS)HasheszaA wrapper that builds multiple hashes at once and checks them against known-good values NcCs|dkrin||_dS)zo :param hashes: A dict of algorithm names pointing to lists of allowed hex digests N)_allowed)selfhashesr/builddir/build/BUILDROOT/alt-python35-pip-20.2.4-5.el8.x86_64/opt/alt/python35/lib/python3.5/site-packages/pip/_internal/utils/hashes.py__init__)szHashes.__init__cst|tstS|sSs'|Si}xOt|jD]>\}jkr[q=fdd|D|Bs z"Hashes.__and__..) isinstancerNotImplementedrr)rothernewvaluesr)rrr__and__1s$zHashes.__and__cCs tdd|jjDS)Ncss|]}t|VqdS)N)len)rdigestsrrr Hsz&Hashes.digest_count..)sumrr%)rrrr digest_countEszHashes.digest_countcCs||jj|gkS)z/Return whether the given hex digest is allowed.)rget)r hash_name hex_digestrrris_hash_allowedJszHashes.is_hash_allowedc Csi}x^t|jD]M}ytj|||)rpathr=rrrcheck_against_pathzszHashes.check_against_pathcCs t|jS)z,Return whether I know any known-good hashes.)boolr)rrrr __nonzero__szHashes.__nonzero__cCs |jS)N)rD)rrrr__bool__szHashes.__bool__)__name__ __module__ __qualname____doc__rr&propertyr+r/r<r6r>rBrDrErrrrr$s      rcs4eZdZdZfddZddZS) MissingHasheszA 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. cs#tt|jdtgidS)z!Don't offer the ``hashes`` kwarg.rN)superrKr FAVORITE_HASH)r) __class__rrrszMissingHashes.__init__cCst|tjdS)N)rrMr5)rr8rrrr6szMissingHashes._raise)rFrGrHrIrr6rr)rNrrKs rK) __future__rr0Zpip._vendor.sixrrrpip._internal.exceptionsrrrpip._internal.utils.miscr pip._internal.utils.typingr typingr r r rrrrrrM STRONG_HASHESobjectrrKrrrrs (e