Skip to content

Commit 74ec2f4

Browse files
authored
Avoid initializing a scheduler as a default argument (#175)
1 parent 585bd7a commit 74ec2f4

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

src/electionguard/decryption.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -218,11 +218,14 @@ def compute_decryption_share_for_ballot(
218218
guardian: Guardian,
219219
ballot: CiphertextAcceptedBallot,
220220
context: CiphertextElectionContext,
221-
scheduler: Scheduler = Scheduler(),
221+
scheduler: Optional[Scheduler] = None,
222222
) -> Optional[BallotDecryptionShare]:
223223
"""
224224
Compute the decryption for a single ballot
225225
"""
226+
if not scheduler:
227+
scheduler = Scheduler()
228+
226229
contests: Dict[CONTEST_ID, CiphertextDecryptionContest] = {}
227230
for contest in ballot.contests:
228231
selections: Dict[SELECTION_ID, CiphertextDecryptionSelection] = {}
@@ -285,11 +288,14 @@ def compute_compensated_decryption_share_for_ballot(
285288
ballot: CiphertextAcceptedBallot,
286289
context: CiphertextElectionContext,
287290
decrypt: AuxiliaryDecrypt = rsa_decrypt,
288-
scheduler: Scheduler = Scheduler(),
291+
scheduler: Optional[Scheduler] = None,
289292
) -> Optional[CompensatedBallotDecryptionShare]:
290293
"""
291294
Compute the decryption for a single ballot
292295
"""
296+
if not scheduler:
297+
scheduler = Scheduler()
298+
293299
contests: Dict[CONTEST_ID, CiphertextCompensatedDecryptionContest] = {}
294300
for contest in ballot.contests:
295301
selections: Dict[SELECTION_ID, CiphertextCompensatedDecryptionSelection] = {}

0 commit comments

Comments
 (0)