add requirements, update documentation
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user