added todos
This commit is contained in:
parent
f86b647c21
commit
db70eeb69e
|
|
@ -1,6 +1,5 @@
|
||||||
# Interprets config files
|
# Interprets config files
|
||||||
import os
|
import os
|
||||||
|
|
||||||
import yaml
|
import yaml
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -59,11 +58,14 @@ class ConfigLoader:
|
||||||
basename = os.path.basename(filepath)
|
basename = os.path.basename(filepath)
|
||||||
name, ext = os.path.splitext(basename)
|
name, ext = os.path.splitext(basename)
|
||||||
with open(filepath, "r") as f:
|
with open(filepath, "r") as f:
|
||||||
if name not in self.loaded_conf:
|
try:
|
||||||
self.loaded_conf[name] = yaml.safe_load(f)
|
if name not in self.loaded_conf:
|
||||||
else:
|
self.loaded_conf[name] = yaml.safe_load(f)
|
||||||
self.loaded_conf[name].update(yaml.safe_load(f))
|
else:
|
||||||
print(f"Warning: {name} is already in {self.loaded_conf}")
|
self.loaded_conf[name].update(yaml.safe_load(f))
|
||||||
|
print(f"Warning: {name} is already in {self.loaded_conf}")
|
||||||
|
except yaml.parser.ParserError as e:
|
||||||
|
raise yaml.parser.ParserError(e) # TODO: make a custom error message
|
||||||
|
|
||||||
def load_from_folder(self, folder):
|
def load_from_folder(self, folder):
|
||||||
"""
|
"""
|
||||||
|
|
@ -85,7 +87,7 @@ class ConfigLoader:
|
||||||
return self.loaded_conf[item]
|
return self.loaded_conf[item]
|
||||||
except KeyError:
|
except KeyError:
|
||||||
print(f"Error: {item} is not in {self.loaded_conf}")
|
print(f"Error: {item} is not in {self.loaded_conf}")
|
||||||
raise FileNotFoundError
|
raise KeyError # TODO: add to error manager
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
"""
|
"""
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue