????

Your IP : 216.73.216.152


Current Path : /usr/lib/python2.7/site-packages/pip/_internal/utils/
Upload File :
Current File : //usr/lib/python2.7/site-packages/pip/_internal/utils/hashes.pyc

�
}�\]c@@s#ddlmZddlZddlmZmZmZddlmZm	Z	m
Z
ddlmZddl
mZer�ddlmZmZmZmZmZddlmZer�dd	lmZq�dd
lmZndZddd
gZdefd��YZdefd��YZdS(i(tabsolute_importN(t	iteritemstiterkeyst
itervalues(tHashMismatchtHashMissingtInstallationError(tread_chunks(tMYPY_CHECK_RUNNING(tDicttListtBinaryIOtNoReturntIterator(tPY3(t_Hash(t_hashtsha256tsha384tsha512tHashescB@sheZdZd
d�Zed��Zd�Zd�Zd�Z	d�Z
d�Zd�Zd	�Z
RS(saA wrapper that builds multiple hashes at once and checks them against
    known-good values

    cC@s|dkrin||_dS(so
        :param hashes: A dict of algorithm names pointing to lists of allowed
            hex digests
        N(tNonet_allowed(tselfthashes((s9/tmp/pip-install-ewDPok/pip/pip/_internal/utils/hashes.pyt__init__'scC@std�|jj�D��S(Ncs@s|]}t|�VqdS(N(tlen(t.0tdigests((s9/tmp/pip-install-ewDPok/pip/pip/_internal/utils/hashes.pys	<genexpr>2s(tsumRtvalues(R((s9/tmp/pip-install-ewDPok/pip/pip/_internal/utils/hashes.pytdigest_count/scC@s||jj|g�kS(s/Return whether the given hex digest is allowed.(Rtget(Rt	hash_namet
hex_digest((s9/tmp/pip-install-ewDPok/pip/pip/_internal/utils/hashes.pytis_hash_allowed4scC@s�i}xXt|j�D]G}ytj|�||<Wqttfk
r\td|��qXqWx2|D]*}x!t|�D]}|j|�q{WqhWx7t	|�D])\}}|j
�|j|kr�dSq�W|j|�dS(s�Check good hashes against ones built from iterable of chunks of
        data.

        Raise HashMismatch if none match.

        sUnknown hash name: %sN(RRthashlibtnewt
ValueErrort	TypeErrorRRtupdateRt	hexdigestt_raise(RtchunkstgotsR!tchunkthashtgot((s9/tmp/pip-install-ewDPok/pip/pip/_internal/utils/hashes.pytcheck_against_chunks<s
cC@st|j|��dS(N(RR(RR,((s9/tmp/pip-install-ewDPok/pip/pip/_internal/utils/hashes.pyR*TscC@s|jt|��S(saCheck good hashes against a file-like object

        Raise HashMismatch if none match.

        (R0R(Rtfile((s9/tmp/pip-install-ewDPok/pip/pip/_internal/utils/hashes.pytcheck_against_fileXscC@s)t|d��}|j|�SWdQXdS(Ntrb(topenR2(RtpathR1((s9/tmp/pip-install-ewDPok/pip/pip/_internal/utils/hashes.pytcheck_against_pathascC@s
t|j�S(s,Return whether I know any known-good hashes.(tboolR(R((s9/tmp/pip-install-ewDPok/pip/pip/_internal/utils/hashes.pyt__nonzero__fscC@s
|j�S(N(R8(R((s9/tmp/pip-install-ewDPok/pip/pip/_internal/utils/hashes.pyt__bool__ksN(t__name__t
__module__t__doc__RRtpropertyRR#R0R*R2R6R8R9(((s9/tmp/pip-install-ewDPok/pip/pip/_internal/utils/hashes.pyR"s							t
MissingHashescB@s eZdZd�Zd�ZRS(s�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.

    cC@s$tt|�jdigt6�dS(s!Don't offer the ``hashes`` kwarg.RN(tsuperR>Rt
FAVORITE_HASH(R((s9/tmp/pip-install-ewDPok/pip/pip/_internal/utils/hashes.pyRwscC@st|tj���dS(N(RR@R)(RR,((s9/tmp/pip-install-ewDPok/pip/pip/_internal/utils/hashes.pyR*~s(R:R;R<RR*(((s9/tmp/pip-install-ewDPok/pip/pip/_internal/utils/hashes.pyR>ps	(t
__future__RR$tpip._vendor.sixRRRtpip._internal.exceptionsRRRtpip._internal.utils.miscRtpip._internal.utils.typingRttypingR	R
RRR
RRRR@t
STRONG_HASHEStobjectRR>(((s9/tmp/pip-install-ewDPok/pip/pip/_internal/utils/hashes.pyt<module>s(N