INNER CODE UNIT · Python
_expect_str_lists
trinodb/trino · .github/bin/build-matrix-schedule-aware.py:332
def _expect_str_lists(d: dict[str, Any], key: str) -> list[list[str]]:
"""
Parses a schedule config's "modules" field into a list of module sets (one matrix job each).
A single string, e.g. a, or a flat list of strings, e.g. [a, b], is shorthand for a single
module set (respectively [[a]] or [[a, b]]) that runs all its modules in one job. Nest lists
explicitly, e.g. [[a], [b, c]], to define multiple module sets that share the rest of the
schedule item's config (profiles, when, etc).
"""
raw = d.get(key, [])
if isinstance(raw, str):
return [[raw]]
values = _require_type(raw, list, key)
if all(isinstance(value, str) for value in values):
return [values] if values else []
sublists = []
for value in values:
if isinstance(value, str):