swissvotes.models.column_mapper
¶
Module Contents¶
Classes¶
Defines the columns used in the dataset and provides helper functions. |
|
Defines the columns used for the metadata and provides helper |
Attributes¶
- class swissvotes.models.column_mapper.ColumnMapperDataset[source]¶
Defines the columns used in the dataset and provides helper functions.
Typically, you want to iterate over all attributes of a vote (
columns
,items
,get_values
,get_items
) and set/get them (set_value
,get_value
).- columns() dict[str, str] [source]¶
The SwissVote attribute name and its column in the dataset.
Attribute names starting with an
!
are used to indicate JSON attributes.
- set_value(vote: onegov.swissvotes.models.vote.SwissVote, attribute: str, value: Any) None [source]¶
Set the given value of a vote.
- get_value(vote: onegov.swissvotes.models.vote.SwissVote, attribute: str) Any [source]¶
Get the given value of a vote.
- get_values(vote: onegov.swissvotes.models.vote.SwissVote) Iterator[Any] [source]¶
Get all values of a vote in order.
- class swissvotes.models.column_mapper.ColumnMapperMetadata[source]¶
Defines the columns used for the metadata and provides helper functions.
Typically, you want to iterate over all attributes of a vote (
columns
,items
,get_values
,get_items
) and set/get them (set_value
,get_value
).- columns() dict[str, str] [source]¶
The SwissVote attribute name and its column in the metadata file.
Each line contains a type hint, a nullable hint, an attribute and optionally a key for list items.