From 70bb66b48f58637a3b6eb527284c2c7406a6c479 Mon Sep 17 00:00:00 2001 From: udqps Date: Wed, 6 Dec 2023 17:42:23 +0100 Subject: [PATCH] Fixed linting --- src/helper/secureJSON.py | 3 +-- src/polyas_checker.py | 9 ++++----- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/helper/secureJSON.py b/src/helper/secureJSON.py index 76e4aa9..ac19357 100644 --- a/src/helper/secureJSON.py +++ b/src/helper/secureJSON.py @@ -7,7 +7,7 @@ import os -def loadSecureJSON(path, filename, sequence = True, plain = False): +def loadSecureJSON(path, filename, sequence=True, plain=False): with open(os.path.join(path, filename), 'rb') as filestr: if plain: return json.loads(filestr.read()) @@ -16,4 +16,3 @@ def loadSecureJSON(path, filename, sequence = True, plain = False): jsonObjects = [entry for entry in file[0:len(file) - 1]] contentList = [json.loads(jsonObject["c"]) for jsonObject in jsonObjects] return [content["payload"] for content in contentList] if sequence else contentList[0]["payload"] - diff --git a/src/polyas_checker.py b/src/polyas_checker.py index 78b5090..140ee9e 100644 --- a/src/polyas_checker.py +++ b/src/polyas_checker.py @@ -601,7 +601,7 @@ def verify_second_device_public_parameters(path, phase1=None): parametersJSON = {} fingerprint = "" try: - parametersWithFingerprintJSON = loadSecureJSON(path, "secondDeviceParametersFingerprint.json", sequence=False, plain = True) + parametersWithFingerprintJSON = loadSecureJSON(path, "secondDeviceParametersFingerprint.json", sequence=False, plain=True) parametersJSON = json.loads(parametersWithFingerprintJSON["publicParametersJson"]) fingerprint = parametersWithFingerprintJSON["fingerprint"] except Exception: @@ -752,14 +752,13 @@ def verify_receipts(path, phase1=None, log=False, logTo=None): if phase1: phase1.setStyleSheet(redStyle) elif fingerprint: - totalConfirmationsFound += 1 - ballotsByFingerprint[fingerprint] = None - - if log and fingerprint in ballotsByFingerprint: status = ballots[ballotsByFingerprint[fingerprint]].status logger.info("The ballot %s is included in the ballot box with status %s." % (fingerprint, status)) if logTo is not None: logTo.append({"status": ReceiptStatus.PRESENT, "fingerprint": fingerprint, "ballotStatus": status}) + totalConfirmationsFound += 1 + ballotsByFingerprint[fingerprint] = None + if phase1: phase1.setValue(50 + math.ceil(50 / len(files) * (t + 1))) close_gpg()