def config(self, config):
"""VES option configuration"""
for key, value in config.items('config'):
if key in self._app_config:
try:
if type(self._app_config[key]) == int:
value = int(value)
elif type(self._app_config[key]) == float:
value = float(value)
elif type(self._app_config[key]) == bool:
value = bool(strtobool(value))
if isinstance(value, type(self._app_config[key])):
self._app_config[key] = value
else:
logging.error("Type mismatch with %s" % key)
sys.exit()
except ValueError:
logging.error("Incorrect value type for %s" % key)
sys.exit()
else:
logging.error("Incorrect key configuration %s" % key)
sys.exit()
评论列表
文章目录