flexmeasures.data.models.parsing_utils

Functions

flexmeasures.data.models.parsing_utils.parse_source_arg(source: DataSource | int | str | Sequence[DataSource] | Sequence[int] | Sequence[str] | None) list[DataSource] | None

Parse the “source” argument by looking up DataSources corresponding to any given ids or names.

Passes None as is (i.e. no source argument is given). Accepts ids and names as list or tuples, always converting them to a list.

flexmeasures.data.models.parsing_utils.parse_source_arg_per_entry(source: DataSource | int | str | Sequence[DataSource] | Sequence[int] | Sequence[str] | None) list[list[DataSource]] | None

Parse the “source” argument, keeping the sources of each entry together.

One entry can name more than one source, because a name is not unique, and the sources it names arrive in no particular order. Callers that care which source is preferred should treat one entry as one preference, rather than reading an order into what a single name happened to match.

Passes None as is (i.e. no source argument is given).