ds_provider_unimicro_py_lib.utils.ranges

File: ranges.py Region: ds_provider_unimicro_py_lib/utils/ranges

Helpers for expanding integer query-parameter specifications into concrete lists.

Functions

expand_int_values(→ list[int])

Normalize an int, start-end range string, or list of ints into a list of ints.

expand_combinations(→ list[dict[str, int]])

Build the cartesian product of the expand values.

Module Contents

ds_provider_unimicro_py_lib.utils.ranges.expand_int_values(value: int | str | list[int], *, field_name: str) → list[int][source]

Normalize an int, start-end range string, or list of ints into a list of ints.

ds_provider_unimicro_py_lib.utils.ranges.expand_combinations(expand: dict[str, list[int] | int | str] | None) → list[dict[str, int]][source]

Build the cartesian product of the expand values.

Parameters:

expand – Mapping of parameter name to an int, list of ints, or start-end range string.

Returns:

One parameter mapping per request. [{}] when expand is empty or None, so callers always make at least one request.

Return type:

list[dict[str, int]]