Fixed problem with non-str values for config parser

Signed-off-by: Jim Martens <github@2martens.de>
This commit is contained in:
2019-07-04 15:48:14 +02:00
parent 2fe02452ea
commit 7819f6fceb

View File

@ -44,8 +44,8 @@ _CONFIG_PROPS = {
"weights": (str, "") "weights": (str, "")
}, },
"Debug": { "Debug": {
"summaries": (bool, True), "summaries": (bool, "True"),
"train_images": (bool, False) "train_images": (bool, "False")
} }
} }
@ -58,7 +58,7 @@ def get_property(key: str) -> str:
parser.read(config_file) parser.read(config_file)
section, prop = tuple(key.split(".")) section, prop = tuple(key.split("."))
return str(parser.get(section, prop)) return parser.get(section, prop)
def set_property(key: str, value: str) -> None: def set_property(key: str, value: str) -> None:
@ -69,8 +69,7 @@ def set_property(key: str, value: str) -> None:
parser.read(config_file) parser.read(config_file)
section, prop = tuple(key.split(".")) section, prop = tuple(key.split("."))
cast_method = _CONFIG_PROPS[section][key][0] parser.set(section, prop, value)
parser.set(section, prop, cast_method(value))
def list_property_values() -> None: def list_property_values() -> None: