Skip to content

Commit

Permalink
Merge pull request #7 from zucchero-sintattico/deepsource-autofix-5c0…
Browse files Browse the repository at this point in the history
…35f8a

refactor: use `sys.exit()` calls
  • Loading branch information
manuandru authored Jan 27, 2024
2 parents d06de6a + bbfe601 commit d0a537d
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/main.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import argparse
import os
import random
import sys

from train import train, run, evaluate

Expand All @@ -21,7 +22,7 @@ def check_map(map_name):
if map_name not in get_available_maps():
print(f"Map '{map_name}' not found. Available maps:")
print(get_available_maps())
exit(1)
sys.exit(1)

if __name__ == '__main__':
parser = argparse.ArgumentParser(
Expand Down Expand Up @@ -58,7 +59,7 @@ def check_map(map_name):
if args.list:
print("Available maps:")
print(get_available_maps())
exit(0)
sys.exit(0)
elif args.command == 'train':
print("Training the model")
if 'random' not in args.map:
Expand All @@ -73,14 +74,14 @@ def check_map(map_name):
args.num_of_steps,
args.num_of_sub_steps,
args.optimize_speed)
exit(0)
sys.exit(0)
elif args.command == 'run':
print("Running the model")
if args.map == 'random':
args.map = random.choice(available_maps)
check_map(args.map)
run(args.map, args.timesteps)
exit(0)
sys.exit(0)
elif args.command == 'evaluate':
print("Evaluating the model")
if 'random' not in args.map:
Expand All @@ -90,7 +91,7 @@ def check_map(map_name):
random.choice(available_maps) if args.map == 'random' else args.map,
args.timesteps,
args.n_evaluate)
exit(0)
sys.exit(0)
else:
print("Invalid command")
exit(1)
sys.exit(1)

0 comments on commit d0a537d

Please sign in to comment.