File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change 5
5
import os
6
6
import typing as t
7
7
8
+ import yaml
8
9
from typing_extensions import Self
9
10
10
11
from vcspull ._internal .config_reader import ConfigReader
@@ -61,3 +62,14 @@ def write_config(config_path: pathlib.Path, content: str) -> pathlib.Path:
61
62
def load_raw (data : str , fmt : t .Literal ["yaml" , "json" ]) -> dict [str , t .Any ]:
62
63
"""Load configuration data via string value. Accepts yaml or json."""
63
64
return ConfigReader ._load (fmt = fmt , content = data )
65
+
66
+
67
+ def save_config_yaml (config_file_path : pathlib .Path , data : dict [t .Any , t .Any ]) -> None :
68
+ """Save a dictionary to a YAML file by utilizing write_config.
69
+
70
+ The primary difference from `write_config` is that this function
71
+ accepts a dictionary and handles YAML serialization before calling
72
+ `write_config`.
73
+ """
74
+ yaml_content : str = yaml .dump (data )
75
+ write_config (config_file_path , yaml_content )
You can’t perform that action at this time.
0 commit comments