From 30560bb94989a6510765d78bed3f636d6f0d0227 Mon Sep 17 00:00:00 2001 From: Karthik Nadig Date: Tue, 27 Aug 2024 09:08:11 -0700 Subject: [PATCH] Fix extracting wheel downloads (#444) --- noxfile.py | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/noxfile.py b/noxfile.py index 5f6f093d..13a13934 100644 --- a/noxfile.py +++ b/noxfile.py @@ -80,13 +80,9 @@ def download_url(values): for value in values: with url_lib.urlopen(value["url"]) as response: data = response.read() - hash_algorithm, hash_value = [ - (key, value) for key, value in value["hash"].items() - ][0] - if hashlib.new(hash_algorithm, data).hexdigest() != hash_value: - raise ValueError( - "Failed hash verification for {}.".format(value["url"]) - ) + name, digest = next(iter(value["hash"].items())) + if hashlib.new(name, data).hexdigest() != digest: + raise ValueError(f"Failed hash verification for {value['url']}.") print("Download: ", value["url"]) with zipfile.ZipFile(io.BytesIO(data), "r") as wheel: