You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

24 lines
561 B

import yaml
import json
import logging
logger = logging.getLogger("fds")
class Config():
def __init__(self, config_file: str):
with open(config_file, "r") as cfile:
self.__dict__ = yaml.safe_load(cfile)
self.set_params(self.__dict__)
def set_params(self, config: dict):
for k, v in config.items():
# if type(v) is dict:
# set_params(v)
setattr(self, k, v)
def __repr__(self):
return json.dumps(self.__dict__, indent=4)
class LogConfig(Config):
...