Update CLI commentary to match JS client
This commit is contained in:
parent
80f6555e53
commit
a97b832b14
@ -20,6 +20,7 @@ import pyRCV2.numbers
|
|||||||
|
|
||||||
from pyRCV2.method.gregory import UIGSTVCounter, WIGSTVCounter, EGSTVCounter
|
from pyRCV2.method.gregory import UIGSTVCounter, WIGSTVCounter, EGSTVCounter
|
||||||
from pyRCV2.method.meek import MeekSTVCounter
|
from pyRCV2.method.meek import MeekSTVCounter
|
||||||
|
from pyRCV2.model import CandidateState
|
||||||
from pyRCV2.ties import TiesBackwards, TiesForwards, TiesPrompt, TiesRandom
|
from pyRCV2.ties import TiesBackwards, TiesForwards, TiesPrompt, TiesRandom
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
@ -142,6 +143,10 @@ def main(args):
|
|||||||
counter.options['bulk_elect'] = not args.no_bulk_elect
|
counter.options['bulk_elect'] = not args.no_bulk_elect
|
||||||
counter.options['papers'] = 'transferable' if args.transferable_only else 'both'
|
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
|
# Reset
|
||||||
stage = 1
|
stage = 1
|
||||||
result = counter.reset()
|
result = counter.reset()
|
||||||
@ -157,3 +162,7 @@ def main(args):
|
|||||||
break
|
break
|
||||||
|
|
||||||
print_step(args, stage, result)
|
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))
|
||||||
|
Reference in New Issue
Block a user