Modified config part in CLI module to use messaging
Signed-off-by: Jim Martens <github@2martens.de>
This commit is contained in:
@ -26,18 +26,14 @@ Functions:
|
|||||||
prepare(...): prepares the SceneNet ground truth data
|
prepare(...): prepares the SceneNet ground truth data
|
||||||
"""
|
"""
|
||||||
import argparse
|
import argparse
|
||||||
|
|
||||||
import math
|
import math
|
||||||
|
|
||||||
from twomartens.masterthesis import config as conf
|
from twomartens.masterthesis import config as conf
|
||||||
|
|
||||||
|
|
||||||
def config(args: argparse.Namespace) -> None:
|
def config(args: argparse.Namespace) -> None:
|
||||||
if args.action == "get":
|
_config_execute_action(args, conf.get_property, conf.set_property, conf.list_property_values)
|
||||||
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()
|
|
||||||
|
|
||||||
|
|
||||||
def prepare(args: argparse.Namespace) -> None:
|
def prepare(args: argparse.Namespace) -> None:
|
||||||
@ -158,6 +154,16 @@ def measure_mapping(args: argparse.Namespace) -> None:
|
|||||||
pickle.dump(counts, file)
|
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:
|
def _ssd_train(args: argparse.Namespace) -> None:
|
||||||
import os
|
import os
|
||||||
import pickle
|
import pickle
|
||||||
|
|||||||
Reference in New Issue
Block a user