election_day.formats.imports.party_result.internal

Attributes

ELECTION_PARTY_HEADERS

Functions

parse_domain(→ tuple[bool, str | None, str | None])

Parse domain and domain segment. Also indicate, if line should be

parse_party_result(→ None)

parse_panachage_headers(→ dict[str, str])

parse_panachage_results(→ None)

import_party_results_internal(...)

Tries to import the given file.

Module Contents

election_day.formats.imports.party_result.internal.ELECTION_PARTY_HEADERS = ('year', 'name', 'id', 'color')[source]
election_day.formats.imports.party_result.internal.parse_domain(line: onegov.core.csv.DefaultRow, errors: list[str], election: ProporzElection | ElectionCompound, principal: Canton | Municipality, election_year: int) tuple[bool, str | None, str | None][source]

Parse domain and domain segment. Also indicate, if line should be skipped.

election_day.formats.imports.party_result.internal.parse_party_result(line: onegov.core.csv.DefaultRow, errors: list[str], party_results: dict[str, onegov.election_day.models.PartyResult], totals: dict[int, dict[tuple[str | None, str | None], int | None]], parties: set[str], election_year: int, locales: Collection[str], default_locale: str, colors: dict[str, str], domain: str | None, domain_segment: str | None) None[source]
election_day.formats.imports.party_result.internal.parse_panachage_headers(csv: onegov.core.csv.DefaultCSVFile) dict[str, str][source]
election_day.formats.imports.party_result.internal.parse_panachage_results(line: onegov.core.csv.DefaultRow, errors: list[str], results: dict[str, dict[str, int]], headers: dict[str, str], election_year: int) None[source]
election_day.formats.imports.party_result.internal.import_party_results_internal(election: ProporzElection | ElectionCompound, principal: Canton | Municipality, file: IO[bytes], mimetype: str, locales: Collection[str], default_locale: str) list[onegov.election_day.formats.imports.common.FileImportError][source]

Tries to import the given file.

This is our own format used for party results. Supports per party panachage data. Stores the panachage results from the blank list with a blank name.

Returns:

A list containing errors.