moved 'read_config' to storage.py and added 'write_config'

This commit is contained in:
2023-08-12 13:55:39 +02:00
parent 6ed459be6f
commit f371a6146e
2 changed files with 12 additions and 7 deletions
+11
View File
@@ -22,6 +22,17 @@ def read_file(fname: pathlib.Path, tags_only: bool = False) -> Dict[str, Any]:
"file": fname.name}
def read_config(path: str) -> ConfigType:
with open(path, 'r') as f:
config = yaml.load(f, Loader=yaml.FullLoader)
return config
def write_config(path: str, config: ConfigType) -> None:
with open(path, 'w') as f:
yaml.dump(config, f)
def dump_data(data: Dict[str, Any]) -> str:
with io.StringIO() as fd:
fd.write(f'TAGS: {" ".join(data["tags"])}\n')