election_day.formats.exports.party_result.internal

Module Contents

Functions

export_parties_internal(→ list[dict[str, Any]])

Returns all party results with the panachage as list with dicts.

_export_parties(→ list[dict[str, Any]])

Returns all party results with the panachage as list with dicts.

election_day.formats.exports.party_result.internal.export_parties_internal(item: ElectionCompound | ProporzElection, locales: Collection[str], default_locale: str, json_serializable: bool = False) list[dict[str, Any]][source]

Returns all party results with the panachage as list with dicts.

This is meant as a base for json/csv/excel exports. The result is therefore a flat list of dictionaries with repeating values to avoid the nesting of values. Each record in the resulting list is a single candidate result for each political entity. Party results are not included in the export (since they are not really connected with the lists).

If json_serializable is True, decimals are converted to floats. This might be a lossy conversation!

election_day.formats.exports.party_result.internal._export_parties(item: ElectionCompound | ProporzElection, locales: Collection[str], default_locale: str, json_serializable: bool = False, domain: str | None = None, domain_segment: str | None = None) list[dict[str, Any]][source]

Returns all party results with the panachage as list with dicts.

This is meant as a base for json/csv/excel exports. The result is therefore a flat list of dictionaries with repeating values to avoid the nesting of values. Each record in the resulting list is a single candidate result for each political entity. Party results are not included in the export (since they are not really connected with the lists).

If json_serializable is True, decimals are converted to floats. This might be a lossy conversation!