added .module to import and defined contains
This commit is contained in:
parent
f80ec9cf66
commit
a605b6675e
|
|
@ -1,7 +1,7 @@
|
||||||
# Interprets config files
|
# Interprets config files
|
||||||
import os
|
import os
|
||||||
import yaml
|
import yaml
|
||||||
from bootstraparse import error_mngr
|
from bootstraparse.modules import error_mngr
|
||||||
|
|
||||||
|
|
||||||
class ConfigLoader:
|
class ConfigLoader:
|
||||||
|
|
@ -87,9 +87,15 @@ class ConfigLoader:
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
return self.loaded_conf[item]
|
return self.loaded_conf[item]
|
||||||
except KeyError:
|
except KeyError: # make sure getitem is never used
|
||||||
error_mngr.log_exception(KeyError(f"Error: {item} is not in {self.loaded_conf}"), level='CRITICAL')
|
error_mngr.log_exception(KeyError(f"Error: {item} is not in {self.loaded_conf}"), level='CRITICAL')
|
||||||
|
|
||||||
|
def __contains__(self, item):
|
||||||
|
"""
|
||||||
|
Same as a dictionary.
|
||||||
|
"""
|
||||||
|
return item in self.loaded_conf
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
"""
|
"""
|
||||||
Returns config as string
|
Returns config as string
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue