interregnum.methods.compensatory package¶
Compensatory systems.
A compensatory system adjust another allocation following certain rules.
First vote is provided by the input
initial_seats.
- class interregnum.methods.compensatory.AdditionalMemberAdapter(allocator_f, skip_initial_seats=False)¶
Bases:
Generic[AnyName,AnyResult],Allocator[AnyName,AnyResult]Additional member system.
Used to allocated levelling seats resuming a previous allocation with different votes.
See [Denmark:2011], [Iceland:2013], [Scotland:2024].
allocatorscollection keys:additional_member
levelling_seats
Create an additional member adapter.
- Parameters:
- calc(initial_seats, seats, inner_initial_seats=None, skip_initial_seats=None, **method_args)¶
Allocate seats to candidates.
- Parameters:
- Return type:
- class interregnum.methods.compensatory.MixedMemberAdapter(overhang_mode, allocator_f, subtract_excluded_candidates=False, skip_initial_seats=False)¶
Bases:
Generic[AnyName,AnyResult],Allocator[AnyName,MMResultData[AnyName,AnyResult]]Mixed-member system adapter.
See [Germany:2025], [Norway:2023].
allocatorscollection keys:mixed_member
Create a mixed-member system adapter.
- Parameters:
overhang_mode (OverhangMode | str) – calculation variant
subtract_excluded_candidates (bool) – remove seats from excluded candidates
skip_initial_seats (bool) – return allocation seats instead of just the levelling seats
- calc(initial_seats, seats=None, max_seats=None, inner_initial_seats=None, skip_initial_seats=None, **method_args)¶
Allocate seats to candidates.
- Parameters:
initial_seats (Iterable[tuple[AnyName, int]]) – seats from the first vote
seats (int | None) – number of levelling seats (starting point)
max_seats (int | None) – if defined, stop absorbing overhang when max_seats has been reached.
inner_initial_seats (Iterable[tuple[AnyName, int]] | None) – initial seats for the inner allocator
skip_initial_seats (bool | None)
method_args (Any)
- Return type:
Submodules¶
interregnum.methods.compensatory.additional_member module¶
Adapter for additional member systems.
References¶
- class interregnum.methods.compensatory.additional_member.AdditionalMemberAdapter(allocator_f, skip_initial_seats=False)¶
Bases:
Generic[AnyName,AnyResult],Allocator[AnyName,AnyResult]Additional member system.
Used to allocated levelling seats resuming a previous allocation with different votes.
See [Denmark:2011], [Iceland:2013], [Scotland:2024].
allocatorscollection keys:additional_member
levelling_seats
Create an additional member adapter.
- Parameters:
- calc(initial_seats, seats, inner_initial_seats=None, skip_initial_seats=None, **method_args)¶
Allocate seats to candidates.
- Parameters:
- Return type:
interregnum.methods.compensatory.mixed_member module¶
Mixed-member systems.
Variants:
increment seats to absorb overhang seats
reduce seats to exclude overhang seats
return overhang seats as negative seats
References¶
- class interregnum.methods.compensatory.mixed_member.MMResultData(log=<factory>, result=None, levelling_seats=0, overhang=<factory>, steps=<factory>)¶
Bases:
EventLog,Generic[AnyName,AnyResult]Mixed member result data.
- Parameters:
- levelling_seats: int = 0¶
- class interregnum.methods.compensatory.mixed_member.MixedMemberAdapter(overhang_mode, allocator_f, subtract_excluded_candidates=False, skip_initial_seats=False)¶
Bases:
Generic[AnyName,AnyResult],Allocator[AnyName,MMResultData[AnyName,AnyResult]]Mixed-member system adapter.
See [Germany:2025], [Norway:2023].
allocatorscollection keys:mixed_member
Create a mixed-member system adapter.
- Parameters:
overhang_mode (OverhangMode | str) – calculation variant
subtract_excluded_candidates (bool) – remove seats from excluded candidates
skip_initial_seats (bool) – return allocation seats instead of just the levelling seats
- calc(initial_seats, seats=None, max_seats=None, inner_initial_seats=None, skip_initial_seats=None, **method_args)¶
Allocate seats to candidates.
- Parameters:
initial_seats (Iterable[tuple[AnyName, int]]) – seats from the first vote
seats (int | None) – number of levelling seats (starting point)
max_seats (int | None) – if defined, stop absorbing overhang when max_seats has been reached.
inner_initial_seats (Iterable[tuple[AnyName, int]] | None) – initial seats for the inner allocator
skip_initial_seats (bool | None)
method_args (Any)
- Return type:
- class interregnum.methods.compensatory.mixed_member.OverhangMode(*values)¶
Bases:
EnumHow to solve overhang seats.
- classmethod parse(value)¶
Return a value from a string.
- Parameters:
value (str | OverhangMode)
- Return type:
- __str__()¶
Return attribute as a key.
- Return type:
str
- ABSORB = 2¶
add seats until the overhang seats are absorbed
- EXCLUDE_PARTIES = 3¶
exclude parties with overhang seats from the compensatory allocation
- IGNORE = 1¶
do not adjust overhang seats
- SUBTRACT_SEATS = 4¶
return overhang seats as negative seats to be subtracted