ConverterBallotToVeto

class whalrus.ConverterBallotToVeto(priority: whalrus.priorities.priority.Priority = Priority.UNAMBIGUOUS, order_priority: whalrus.priorities.priority.Priority = None, plurality_priority: whalrus.priorities.priority.Priority = None, veto_priority: whalrus.priorities.priority.Priority = None, one_name_priority: whalrus.priorities.priority.Priority = None)[source]

Default converter to a BallotVeto.

Parameters

Examples

Typical usages:

>>> converter = ConverterBallotToVeto()
>>> converter(BallotOneName('a', candidates={'a', 'b'}))
BallotVeto('a', candidates={'a', 'b'})
>>> converter(BallotPlurality('a', candidates={'a', 'b'}))
BallotVeto('b', candidates={'a', 'b'})
>>> converter({'a': 10, 'b': 7, 'c':0})
BallotVeto('c', candidates={'a', 'b', 'c'})
>>> converter('a ~ b > c')
BallotVeto('c', candidates={'a', 'b', 'c'})
>>> converter([{'a', 'b'}, 'c'])
BallotVeto('c', candidates={'a', 'b', 'c'})

Use options for the restrictions:

>>> converter = ConverterBallotToVeto(priority=Priority.ASCENDING)
>>> converter('a > b ~ c')
BallotVeto('c', candidates={'a', 'b', 'c'})