bridge.utils.yaml_utils#
Module Contents#
Functions#
Dump a dataclass object or other Python object to a YAML file or string. |
API#
- bridge.utils.yaml_utils.dump_dataclass_to_yaml(
- obj: Any,
- filename: Optional[str] = None,
Dump a dataclass object or other Python object to a YAML file or string.
Uses safe representers to handle common types.
- Parameters:
obj – The object to dump.
filename – If provided, the path to the file where YAML should be written. If None, returns the YAML string directly.
- Returns:
If filename is None, returns the YAML string representation of the object. Otherwise, returns None.