add requirements, update documentation

This commit is contained in:
WorldTeacher
2024-10-02 15:11:13 +02:00
parent e7bcce328b
commit f4bc3de357
11 changed files with 53 additions and 7 deletions

View File

@@ -132,7 +132,8 @@ class Config:
if self._config is None:
raise RuntimeError("Configuration not loaded")
omegaconf.OmegaConf.save(self._config, "config/settings.yaml")
def apply_options(options:list):
def apply_options(self, options:list):
if self._config is None:
raise RuntimeError("Configuration not loaded")
for option in options:
@@ -148,7 +149,14 @@ class Config:
def updateValue(self, key:str, value):
if self._config is None:
raise RuntimeError("Configuration not loaded")
self._config[key] = value
if "." in key:
keys = key.split(".")
if keys[0] in self._config:
self._config[keys[0]][keys[1]] = value
else:
raise KeyError(f"Option {keys[0]} not found in configuration")
else:
self._config[key] = value
if __name__ == "__main__":
cfg = Config("config/settings.yaml")
#print(cfg.database.path)