summaryrefslogtreecommitdiff
path: root/importpkg.py
diff options
context:
space:
mode:
authorHelmut Grohne <helmut@subdivi.de>2021-12-29 15:24:34 +0100
committerHelmut Grohne <helmut@subdivi.de>2021-12-29 15:24:34 +0100
commitc2b5909eff090ebb3f19ab88308f0cc7b913157e (patch)
tree4188260ea9f0f0783bf730a071a38d0784385ce1 /importpkg.py
parent2cb95eb8c68a692b0abb535925e8b55175285ea4 (diff)
downloaddebian-dedup-c2b5909eff090ebb3f19ab88308f0cc7b913157e.tar.gz
ImageHash: gain a name property
Instead of retroactively attaching a name to an ImageHash, autogenerate it via a property. Doing so also simplifies static type checking.
Diffstat (limited to 'importpkg.py')
-rwxr-xr-ximportpkg.py10
1 files changed, 2 insertions, 8 deletions
diff --git a/importpkg.py b/importpkg.py
index 4693401..6988c1d 100755
--- a/importpkg.py
+++ b/importpkg.py
@@ -31,16 +31,10 @@ def gziphash():
return HashBlacklistContent(hashobj, boring_content)
def pnghash():
- hashobj = PNGHash(hashlib.sha512())
- hashobj = SuppressingHash(hashobj, (ValueError,))
- hashobj.name = "png_sha512"
- return hashobj
+ return SuppressingHash(PNGHash(hashlib.sha512()), (ValueError,))
def gifhash():
- hashobj = GIFHash(hashlib.sha512())
- hashobj = SuppressingHash(hashobj, (ValueError,))
- hashobj.name = "gif_sha512"
- return hashobj
+ return SuppressingHash(GIFHash(hashlib.sha512()), (ValueError,))
class ProcessingFinished(Exception):
pass