Transform utilities#
- rizemind.configuration.transform.concat(conf_a: dict[str, bool | bytes | float | int | str] | ConfigRecord, conf_b: dict[str, bool | bytes | float | int | str] | ConfigRecord) dict[str, bool | bytes | float | int | str][source]#
Merge two configuration objects into a flat dictionary.
Both inputs may be Flower configs, plain dicts, or ConfigRecord`s. On key conflicts, values from `conf_b take precedence.
- Parameters:
conf_a – First configuration source.
conf_b – Second configuration source; overrides on conflicts.
- Returns:
A new flat dictionary with the merged contents.
- rizemind.configuration.transform.flatten(d: dict[str, Any], prefix: str = '') dict[str, bool | bytes | float | int | str][source]#
Flatten a nested mapping using dot-delimited keys.
Each nested dictionary path is joined with . to form a single key. When a prefix is provided, it is prepended to each generated key.
- Parameters:
d – Nested mapping to flatten.
prefix – Optional namespace to prepend to generated keys.
- Returns:
A flat mapping suitable for Flower Config/Properties.
- rizemind.configuration.transform.from_config(config: dict[str, bool | bytes | float | int | str]) dict[str, Any][source]#
Convert a Flower
Configinto a nested mapping.- Parameters:
config – Flat mapping produced by flatten/to_config.
- Returns:
A nested mapping.
- rizemind.configuration.transform.from_properties(properties: dict[str, bool | bytes | float | int | str]) dict[str, Any][source]#
Convert Flower
Propertiesinto a nested mapping.- Parameters:
properties – Flat mapping produced by flatten/to_properties.
- Returns:
A nested mapping.
- rizemind.configuration.transform.normalize(data: dict[str, Any]) dict[str, int | float | str | bytes | bool | list[int] | list[float] | list[str] | list[bytes] | list[bool]][source]#
Normalize nested values to the limited set supported by Flower.
Converts values to scalars (int, float, str, bytes, bool), lists of scalars, or nested dicts. Values equal to None are dropped. Unsupported list element mixes raise a TypeError. Non-list, non-dict values outside the supported set are converted to their string representation.
- Parameters:
data – Arbitrary nested mapping to normalize.
- Returns:
A new mapping with values restricted to Flower-compatible scalar types, lists of scalars, or nested dicts.
- Raises:
TypeError – If a list contains mixed or unsupported element types.
- rizemind.configuration.transform.to_config(d: dict[str, Any], prefix: str = '') dict[str, bool | bytes | float | int | str][source]#
Return a flat Flower Config from a nested mapping.
Normalizes values and flattens keys. If prefix is provided, keys are namespaced under the given prefix.
- Parameters:
d – Nested mapping to normalize and flatten.
prefix – Optional namespace to prepend.
- Returns:
A Flower Config mapping.
- rizemind.configuration.transform.to_config_record(d: dict[str, Any]) ConfigRecord[source]#
Build a Flower ConfigRecord from a nested mapping.
Normalizes and flattens the mapping before constructing the record.
- Parameters:
d – Nested mapping containing configuration values.
- Returns:
A ConfigRecord with dot-delimited keys and normalized values.
- rizemind.configuration.transform.to_properties(d: dict[str, Any], prefix: str = '') dict[str, bool | bytes | float | int | str][source]#
Return a flat Flower Properties mapping from a nested mapping.
Normalizes values and flattens keys. If prefix is provided, keys are namespaced under the given prefix.
- Parameters:
d – Nested mapping to normalize and flatten.
prefix – Optional namespace to prepend.
- Returns:
A Flower Properties mapping.