changed main.py

This commit is contained in:
Navan Chauhan 2019-05-24 22:19:42 +05:30
parent 6cbd67bb72
commit fca01b7e7b
1 changed files with 2 additions and 5 deletions

View File

@ -335,11 +335,8 @@ def brakes():
#####################################################
parser = argparse.ArgumentParser()
FUNCTION_MAP = {'overspeed' : speedlim,
'sleep-detector' : sleepiness,
'sudden-braking' : brakes,
'drunk' : drunk }
parser.add_argument('function', choices=FUNCTION_MAP.keys())
FUNCTION_MAP = {'overspeed' : speedlim, 'sleep-detector' : sleepiness, 'sudden-braking' : brakes, 'drunk' : drunk }
parser.add_argument('function', choices=list(FUNCTION_MAP))
args = parser.parse_args()
func = FUNCTION_MAP[args.function]
func()