Skip to content

Commit

Permalink
Convert SNTV winners to Python ints in all cases
Browse files Browse the repository at this point in the history
  • Loading branch information
endolith committed Jul 5, 2024
1 parent 1b58417 commit 873bfb3
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions elsim/methods/fptp.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,10 @@ def sntv(election, n=1, tiebreaker=None):
tie_winners = tiebreak(list(tied_candidates), n_needed)
if tie_winners == [None]:
return None
return set(untied_winners) | set(tie_winners)
winners = set(untied_winners) | set(tie_winners)
else:
# TODO: Maybe should use arrays for deterministic randomness?
return set(int(candidate) for candidate in top_candidates)
winners = set(top_candidates)

# Convert to set of Python ints
# TODO: Maybe should use arrays for deterministic randomness?
return set(int(winners) for winner in winners)

0 comments on commit 873bfb3

Please sign in to comment.