def _load(self):
"""Load config file into memory."""
try:
with open(self.file, 'r') as file:
self._data = yaml.load(file)
except IOError:
# no config file
pass
except yaml.YAMLError as err:
raise Exception(
'Could not parse corrupt config file: %s\n'
'Try running "rm %s"' % (
str(err),
self.file,
)
)
# set defaults
for key, value in Config.defaults.items():
if key not in self._data:
self._data[key] = value
评论列表
文章目录