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) asyamlto 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
yamlcode to. Defaults to None which makes this function return a string.offset (int) – Block indentation level. Defaults to 0 See https://yaml.dev/doc/ruamel.yaml/detail/#Indentation_of_block_sequences
- Returns:
String if
file_nameisNoneorNoneiffile_nameis a valid path.- Return type:
str | None