diff options
author | Helmut Grohne <helmut@subdivi.de> | 2020-02-16 08:21:20 +0100 |
---|---|---|
committer | Helmut Grohne <helmut@subdivi.de> | 2020-02-16 08:21:20 +0100 |
commit | 27b95909f061ae3ecb3ba1b8d46adfef98ca5e6f (patch) | |
tree | 87695b998b1e97e406050584812d4db68bdb4610 /dedup/hashing.py | |
parent | e77a1ebf8bda10494088bb6c72873d8ef214e0f3 (diff) | |
download | debian-dedup-27b95909f061ae3ecb3ba1b8d46adfef98ca5e6f.tar.gz |
drop support for Python 2.x
Diffstat (limited to 'dedup/hashing.py')
-rw-r--r-- | dedup/hashing.py | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/dedup/hashing.py b/dedup/hashing.py index c91fb64..21f14ea 100644 --- a/dedup/hashing.py +++ b/dedup/hashing.py @@ -1,10 +1,6 @@ import itertools -try: - from itertools import imap as map -except ImportError: - pass # in python3 map is already imap -class HashBlacklist(object): +class HashBlacklist: """Turn a hashlib-like object into a hash that returns None for some blacklisted hashes instead of the real hash value. @@ -35,7 +31,7 @@ class HashBlacklist(object): def copy(self): return HashBlacklist(self.hashobj.copy(), self.blacklist) -class HashBlacklistContent(object): +class HashBlacklistContent: """Turn a hashlib-like object into a hash that returns None for some blacklisted content instead of the real hash value. Unlike HashBlacklist, not the output of the hash is considered, but its input.""" @@ -85,7 +81,7 @@ class HashBlacklistContent(object): new.stored = self.stored return new -class DecompressedHash(object): +class DecompressedHash: """Apply a decompression function before the hash. This class provides the hashlib interface (update, hexdigest, copy) excluding digest and name.""" def __init__(self, decompressor, hashobj): @@ -119,7 +115,7 @@ class DecompressedHash(object): def copy(self): return DecompressedHash(self.decompressor.copy(), self.hashobj.copy()) -class SuppressingHash(object): +class SuppressingHash: """A hash that silences exceptions from the update and hexdigest methods of a hashlib-like object. If an exception has occurred, hexdigest always returns None.""" @@ -167,7 +163,7 @@ def hash_file(hashobj, filelike, blocksize=65536): data = filelike.read(blocksize) return hashobj -class HashedStream(object): +class HashedStream: """A file-like object, that supports sequential reading and hashes the contents on the fly.""" def __init__(self, filelike, hashobj): |