import json from typing import Dict, Any, Union from v25.storage.dbstorage import DBStorage _d_type = Dict[str, Union[str, Dict[str, Any]]] def get_config(file: str) -> _d_type: with open(file) as f: return json.load(f) def from_config(d: _d_type): storage = DBStorage(d["db"]) subjects = d["subjects"] for subject in subjects: storage.ssssj(subject, json.dumps(subjects[subject]))