diff --git a/src/twomartens/masterthesis/cli.py b/src/twomartens/masterthesis/cli.py index 276c46a..14612ff 100644 --- a/src/twomartens/masterthesis/cli.py +++ b/src/twomartens/masterthesis/cli.py @@ -26,18 +26,14 @@ Functions: prepare(...): prepares the SceneNet ground truth data """ import argparse + import math from twomartens.masterthesis import config as conf def config(args: argparse.Namespace) -> None: - if args.action == "get": - print(str(conf.get_property(args.property))) - elif args.action == "set": - conf.set_property(args.property, args.value) - elif args.action == "list": - conf.list_property_values() + _config_execute_action(args, conf.get_property, conf.set_property, conf.list_property_values) def prepare(args: argparse.Namespace) -> None: @@ -158,6 +154,16 @@ def measure_mapping(args: argparse.Namespace) -> None: pickle.dump(counts, file) +def _config_execute_action(args: argparse.Namespace, on_get: callable, + on_set: callable, on_list: callable) -> None: + if args.action == "get": + print(str(on_get(args.property))) + elif args.action == "set": + on_set(args.property, args.value) + elif args.action == "list": + on_list() + + def _ssd_train(args: argparse.Namespace) -> None: import os import pickle