Update CLI commentary to match JS client

This commit is contained in:
RunasSudo 2021-01-15 18:22:26 +11:00
parent 80f6555e53
commit a97b832b14
Signed by: RunasSudo
GPG Key ID: 7234E476BF21C61A

View File

@ -20,6 +20,7 @@ import pyRCV2.numbers
from pyRCV2.method.gregory import UIGSTVCounter, WIGSTVCounter, EGSTVCounter
from pyRCV2.method.meek import MeekSTVCounter
from pyRCV2.model import CandidateState
from pyRCV2.ties import TiesBackwards, TiesForwards, TiesPrompt, TiesRandom
import sys
@ -142,6 +143,10 @@ def main(args):
counter.options['bulk_elect'] = not args.no_bulk_elect
counter.options['papers'] = 'transferable' if args.transferable_only else 'both'
# Print report
print('Count computed by pyRCV2 (development version). Read {} ballots from "{}" for election "{}". There are {} candidates for {} vacancies. Counting using options "{}".'.format(sum((b.value for b in election.ballots), pyRCV2.numbers.Num(0)).pp(0), args.file, election.name, len(election.candidates), election.seats, counter.describe_options()))
print()
# Reset
stage = 1
result = counter.reset()
@ -157,3 +162,7 @@ def main(args):
break
print_step(args, stage, result)
print('Count complete. The winning candidates are, in order of election:')
for x in sorted(((c, cc) for c, cc in result.candidates.items() if cc.state == CandidateState.ELECTED), key=lambda x: x[1].order_elected):
print('{}. {}'.format(x[1].order_elected , x[0].name))