Skip to main content

scorebook.utils.transform_helpers

Utility functions for transforming and manipulating data structures.

expand_dict

def expand_dict(data: dict) -> list[dict]

Expand a dictionary with list values into multiple dictionaries.

Takes a dictionary that may contain list values and expands it into a list of dictionaries, where each dictionary represents one possible combination of values from the lists. Non-list values remain constant across all generated dictionaries.

Arguments:

  • data - A dictionary potentially containing list values to be expanded

Returns:

A list of dictionaries representing all possible combinations of the input values