v25/v25/config.py
2020-08-22 23:19:22 +03:00

20 lines
421 B
Python

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]))