Skip to content

Commit

Permalink
Fixed linting
Browse files Browse the repository at this point in the history
  • Loading branch information
frog711 committed Dec 6, 2023
1 parent a2af008 commit 70bb66b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
3 changes: 1 addition & 2 deletions src/helper/secureJSON.py
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand All @@ -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"]

9 changes: 4 additions & 5 deletions src/polyas_checker.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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()
Expand Down

0 comments on commit 70bb66b

Please sign in to comment.