naming¶
Utilities for expanding name templates using metadata.
- class merge_utils.naming.Formatter(metadata: dict | None = None)[source]¶
Wrapper class to access metadata dictionary.
Initialize the Formatter with a metadata dictionary.
- eval(condition: str) bool[source]¶
Evaluate a condition using the metadata dictionary.
- Parameters:
condition – condition string to evaluate
- Returns:
evaluated value
- format(template: ConfigString, defer_uuid: bool = False)[source]¶
Format a config string using the metadata dictionary.
- Parameters:
template – config string template
- format_key(key: str, val: any, spec: str) str[source]¶
Format a metadata key with a given specification.
- Parameters:
key – key name
val – key value
spec – format specification
- Returns:
formatted string