write_dict
- glotaran.builtin.io.yml.utils.write_dict(data: Mapping[str, Any] | Sequence[Any], file_name: str | Path | None = None, offset: int = 0) str | None [source]
Write a mapping (e.g.
dict
) or sequence (e.g.list
) asyaml
to file or str.- Parameters:
data (Mapping[str, Any] | Sequence[Any]) – Data that should be converted to
yaml
.file_name (str | Path | None) – Path of the file to write the
yaml
code to. Defaults to None which makes this function return a string.offset (int) – Block indentation level. Defaults to 0 See https://yaml.readthedocs.io/en/latest/detail/#indentation-of-block-sequences
- Returns:
String if
file_name
isNone
orNone
iffile_name
is a valid path.- Return type:
str | None