diff options
author | Helmut Grohne <helmut@subdivi.de> | 2016-04-21 23:15:22 +0200 |
---|---|---|
committer | Helmut Grohne <helmut@subdivi.de> | 2016-04-21 23:15:22 +0200 |
commit | cf5e9f8c9714361042147889ab4b24225c4d07a0 (patch) | |
tree | c3d9585dabcd12ef67bcf6847ae76824a1745279 | |
parent | 29bdbe1c62acfd2bacac11b17f9b73aa7dbcc381 (diff) | |
download | debian-dedup-cf5e9f8c9714361042147889ab4b24225c4d07a0.tar.gz |
importpkg: move the hash function list to the extractor class
They really are an aspect of the particular extractor and can easily be
changed by subclassing.
-rwxr-xr-x | importpkg.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/importpkg.py b/importpkg.py index 0798f13..01ec87a 100755 --- a/importpkg.py +++ b/importpkg.py @@ -57,9 +57,10 @@ class ProcessingFinished(Exception): pass class ImportpkgExtractor(DebExtractor): - def __init__(self, hash_functions, callback): + hash_functions = [sha512_nontrivial, gziphash, pnghash, gifhash] + + def __init__(self, callback): self.state = "start" - self.hash_functions = hash_functions self.callback = callback def handle_ar_member(self, name, filelike): @@ -99,7 +100,6 @@ def main(): parser.add_option("-H", "--hash", action="store", help="verify that stdin hash given sha256 hash") options, args = parser.parse_args() - hash_functions = [sha512_nontrivial, gziphash, pnghash, gifhash] try: stdin = sys.stdin.buffer except AttributeError: # python2 @@ -109,7 +109,7 @@ def main(): if options.hash: stdin = HashedStream(stdin, hashlib.sha256()) try: - ImportpkgExtractor(hash_functions, dumper.represent).process(stdin) + ImportpkgExtractor(dumper.represent).process(stdin) except ProcessingFinished: pass else: |