From cf5e9f8c9714361042147889ab4b24225c4d07a0 Mon Sep 17 00:00:00 2001 From: Helmut Grohne Date: Thu, 21 Apr 2016 23:15:22 +0200 Subject: 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. --- importpkg.py | 8 ++++---- 1 file 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: -- cgit v1.2.3