write_yaml_config#

openstef_core.base_model.write_yaml_config(config: BaseModel | Sequence[BaseModel], path: Path) → None[source]#

Write a config or sequence of configs to a YAML file.

Parameters:
  • config (BaseModel | Sequence[BaseModel]) – The configuration object(s) to serialize.

  • path (Path) – Destination path for the YAML file (will be overwritten).

Example

>>> from pathlib import Path
>>> from pydantic import BaseModel
>>> class MyConfig(BaseModel):
...     foo: int
>>> cfg = MyConfig(foo=123)
>>> write_yaml_config(cfg, Path("/tmp/test.yaml"))
Parameters:
Return type:

None