moved 'read_config' to storage.py and added 'write_config'
This commit is contained in:
@@ -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')
|
||||
|
||||
Reference in New Issue
Block a user