Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When running an STV election, I noticed that you cannot use the
run_election
method more than once. Moreover, I noticed that afterrun_election
, the original preference profile was edited, not just the one stored inself.state.profile
.reset
method in theElection
class that resetsself.state
to round 0 and the original preference profile.get_ballots
method was returning thePreferenceProfile
list of ballots, which was why running elections altered the original profile. I useddeepcopy
to return a copy of the ballots, which fixed the issue.step
parameter in the STVrun_step
method that allows users to choose which step they want to run. It defaults toNone
, in which case it just runs the next step.ValueError
torun_step
so that if you try to run a step after all seats are filled, it raise the error.@jamesturk @drdeford @jgibson517 @jennjwang @ziglaser