Python pip.utils.read_chunks() Examples

The following are 30 code examples of pip.utils.read_chunks(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module pip.utils , or try the search function .
Example #1
Source File: hashes.py    From PhonePi_SampleServer with MIT License 5 votes vote down vote up
def check_against_file(self, file):
        """Check good hashes against a file-like object

        Raise HashMismatch if none match.

        """
        return self.check_against_chunks(read_chunks(file)) 
Example #2
Source File: hash.py    From python with Apache License 2.0 5 votes vote down vote up
def _hash_of_file(path, algorithm):
    """Return the hash digest of a file."""
    with open(path, 'rb') as archive:
        hash = hashlib.new(algorithm)
        for chunk in read_chunks(archive):
            hash.update(chunk)
    return hash.hexdigest() 
Example #3
Source File: hashes.py    From python with Apache License 2.0 5 votes vote down vote up
def check_against_file(self, file):
        """Check good hashes against a file-like object

        Raise HashMismatch if none match.

        """
        return self.check_against_chunks(read_chunks(file)) 
Example #4
Source File: hash.py    From planespotter with MIT License 5 votes vote down vote up
def _hash_of_file(path, algorithm):
    """Return the hash digest of a file."""
    with open(path, 'rb') as archive:
        hash = hashlib.new(algorithm)
        for chunk in read_chunks(archive):
            hash.update(chunk)
    return hash.hexdigest() 
Example #5
Source File: hashes.py    From planespotter with MIT License 5 votes vote down vote up
def check_against_file(self, file):
        """Check good hashes against a file-like object

        Raise HashMismatch if none match.

        """
        return self.check_against_chunks(read_chunks(file)) 
Example #6
Source File: hash.py    From python2017 with MIT License 5 votes vote down vote up
def _hash_of_file(path, algorithm):
    """Return the hash digest of a file."""
    with open(path, 'rb') as archive:
        hash = hashlib.new(algorithm)
        for chunk in read_chunks(archive):
            hash.update(chunk)
    return hash.hexdigest() 
Example #7
Source File: hashes.py    From python2017 with MIT License 5 votes vote down vote up
def check_against_file(self, file):
        """Check good hashes against a file-like object

        Raise HashMismatch if none match.

        """
        return self.check_against_chunks(read_chunks(file)) 
Example #8
Source File: hash.py    From Ansible with MIT License 5 votes vote down vote up
def _hash_of_file(path, algorithm):
    """Return the hash digest of a file."""
    with open(path, 'rb') as archive:
        hash = hashlib.new(algorithm)
        for chunk in read_chunks(archive):
            hash.update(chunk)
    return hash.hexdigest() 
Example #9
Source File: hashes.py    From Ansible with MIT License 5 votes vote down vote up
def check_against_file(self, file):
        """Check good hashes against a file-like object

        Raise HashMismatch if none match.

        """
        return self.check_against_chunks(read_chunks(file)) 
Example #10
Source File: hash.py    From PhonePi_SampleServer with MIT License 5 votes vote down vote up
def _hash_of_file(path, algorithm):
    """Return the hash digest of a file."""
    with open(path, 'rb') as archive:
        hash = hashlib.new(algorithm)
        for chunk in read_chunks(archive):
            hash.update(chunk)
    return hash.hexdigest() 
Example #11
Source File: hashes.py    From Financial-Portfolio-Flask with MIT License 5 votes vote down vote up
def check_against_file(self, file):
        """Check good hashes against a file-like object

        Raise HashMismatch if none match.

        """
        return self.check_against_chunks(read_chunks(file)) 
Example #12
Source File: hash.py    From syntheticmass with Apache License 2.0 5 votes vote down vote up
def _hash_of_file(path, algorithm):
    """Return the hash digest of a file."""
    with open(path, 'rb') as archive:
        hash = hashlib.new(algorithm)
        for chunk in read_chunks(archive):
            hash.update(chunk)
    return hash.hexdigest() 
Example #13
Source File: hashes.py    From syntheticmass with Apache License 2.0 5 votes vote down vote up
def check_against_file(self, file):
        """Check good hashes against a file-like object

        Raise HashMismatch if none match.

        """
        return self.check_against_chunks(read_chunks(file)) 
Example #14
Source File: hash.py    From CTFCrackTools-V2 with GNU General Public License v3.0 5 votes vote down vote up
def _hash_of_file(path, algorithm):
    """Return the hash digest of a file."""
    with open(path, 'rb') as archive:
        hash = hashlib.new(algorithm)
        for chunk in read_chunks(archive):
            hash.update(chunk)
    return hash.hexdigest() 
Example #15
Source File: hashes.py    From CTFCrackTools-V2 with GNU General Public License v3.0 5 votes vote down vote up
def check_against_file(self, file):
        """Check good hashes against a file-like object

        Raise HashMismatch if none match.

        """
        return self.check_against_chunks(read_chunks(file)) 
Example #16
Source File: hash.py    From Hands-On-Deep-Learning-for-Games with MIT License 5 votes vote down vote up
def _hash_of_file(path, algorithm):
    """Return the hash digest of a file."""
    with open(path, 'rb') as archive:
        hash = hashlib.new(algorithm)
        for chunk in read_chunks(archive):
            hash.update(chunk)
    return hash.hexdigest() 
Example #17
Source File: hashes.py    From Hands-On-Deep-Learning-for-Games with MIT License 5 votes vote down vote up
def check_against_file(self, file):
        """Check good hashes against a file-like object

        Raise HashMismatch if none match.

        """
        return self.check_against_chunks(read_chunks(file)) 
Example #18
Source File: hash.py    From CTFCrackTools with GNU General Public License v3.0 5 votes vote down vote up
def _hash_of_file(path, algorithm):
    """Return the hash digest of a file."""
    with open(path, 'rb') as archive:
        hash = hashlib.new(algorithm)
        for chunk in read_chunks(archive):
            hash.update(chunk)
    return hash.hexdigest() 
Example #19
Source File: hashes.py    From CTFCrackTools with GNU General Public License v3.0 5 votes vote down vote up
def check_against_file(self, file):
        """Check good hashes against a file-like object

        Raise HashMismatch if none match.

        """
        return self.check_against_chunks(read_chunks(file)) 
Example #20
Source File: hash.py    From vnpy_crypto with MIT License 5 votes vote down vote up
def _hash_of_file(path, algorithm):
    """Return the hash digest of a file."""
    with open(path, 'rb') as archive:
        hash = hashlib.new(algorithm)
        for chunk in read_chunks(archive):
            hash.update(chunk)
    return hash.hexdigest() 
Example #21
Source File: hashes.py    From recruit with Apache License 2.0 5 votes vote down vote up
def check_against_file(self, file):
        """Check good hashes against a file-like object

        Raise HashMismatch if none match.

        """
        return self.check_against_chunks(read_chunks(file)) 
Example #22
Source File: hash.py    From jbox with MIT License 5 votes vote down vote up
def _hash_of_file(path, algorithm):
    """Return the hash digest of a file."""
    with open(path, 'rb') as archive:
        hash = hashlib.new(algorithm)
        for chunk in read_chunks(archive):
            hash.update(chunk)
    return hash.hexdigest() 
Example #23
Source File: hashes.py    From jbox with MIT License 5 votes vote down vote up
def check_against_file(self, file):
        """Check good hashes against a file-like object

        Raise HashMismatch if none match.

        """
        return self.check_against_chunks(read_chunks(file)) 
Example #24
Source File: hash.py    From python-netsurv with MIT License 5 votes vote down vote up
def _hash_of_file(path, algorithm):
    """Return the hash digest of a file."""
    with open(path, 'rb') as archive:
        hash = hashlib.new(algorithm)
        for chunk in read_chunks(archive):
            hash.update(chunk)
    return hash.hexdigest() 
Example #25
Source File: hashes.py    From python-netsurv with MIT License 5 votes vote down vote up
def check_against_file(self, file):
        """Check good hashes against a file-like object

        Raise HashMismatch if none match.

        """
        return self.check_against_chunks(read_chunks(file)) 
Example #26
Source File: hash.py    From python-netsurv with MIT License 5 votes vote down vote up
def _hash_of_file(path, algorithm):
    """Return the hash digest of a file."""
    with open(path, 'rb') as archive:
        hash = hashlib.new(algorithm)
        for chunk in read_chunks(archive):
            hash.update(chunk)
    return hash.hexdigest() 
Example #27
Source File: hashes.py    From python-netsurv with MIT License 5 votes vote down vote up
def check_against_file(self, file):
        """Check good hashes against a file-like object

        Raise HashMismatch if none match.

        """
        return self.check_against_chunks(read_chunks(file)) 
Example #28
Source File: hash.py    From kobo-predict with BSD 2-Clause "Simplified" License 5 votes vote down vote up
def _hash_of_file(path, algorithm):
    """Return the hash digest of a file."""
    with open(path, 'rb') as archive:
        hash = hashlib.new(algorithm)
        for chunk in read_chunks(archive):
            hash.update(chunk)
    return hash.hexdigest() 
Example #29
Source File: hashes.py    From kobo-predict with BSD 2-Clause "Simplified" License 5 votes vote down vote up
def check_against_file(self, file):
        """Check good hashes against a file-like object

        Raise HashMismatch if none match.

        """
        return self.check_against_chunks(read_chunks(file)) 
Example #30
Source File: hash.py    From recruit with Apache License 2.0 5 votes vote down vote up
def _hash_of_file(path, algorithm):
    """Return the hash digest of a file."""
    with open(path, 'rb') as archive:
        hash = hashlib.new(algorithm)
        for chunk in read_chunks(archive):
            hash.update(chunk)
    return hash.hexdigest()