Package elections :: Module election :: Class Election
[frames] | no frames]

Class Election

source code

object --+
         |
        Election

This class holds all of the information about an election.

When unpickling an Election object e, check that e.version is the same as Election.VERSION.

Instance Methods
 
__init__(self, names, profile, ranks, seats, description)
Create a new Election
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Class Variables
number VERSION = 1
The version of this class.
Instance Variables
string description
Description of the election.
dict names
Mapping between candidate indices and candidate names.
Node profile
The root of the tree representation of the profile.
number ranks
The maximum number of candidates that can be ranked on a ballot.
number seats
The number of candidates to be elected.
number version
The version of this instance.
Properties

Inherited from object: __class__

Method Details

__init__(self, names, profile, ranks, seats, description)
(Constructor)

source code 

Create a new Election

Parameters:
  • names (dict) - Mapping between candidate indices and candidate names.
  • profile (Node) - The root of the tree representation of the profile.
  • ranks (number) - The maximum number of candidates that can be ranked on a ballot.
  • seats (number) - The number of candidates to be elected.
  • description (string) - Description of the election.
Overrides: object.__init__