-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
39 lines (29 loc) · 838 Bytes
/
main.py
File metadata and controls
39 lines (29 loc) · 838 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
from gamuLogger import Logger, info, error, debug, debugFunc, critical
import argparse
@debugFunc(True) # True or False to enable or disable chrono
def addition(a, b):
return a + b
@debugFunc(True)
def division(a, b):
return a / b
def main():
parser = argparse.ArgumentParser()
Logger.configArgParse(parser)
parser.add_argument("a", type=int)
parser.add_argument("b", type=int)
args = parser.parse_args()
Logger.parseArgs(args)
a = args.a
b = args.b
info(f"Adding {a} and {b}")
result = addition(a, b)
info(f"Result: {result}")
info(f"Dividing {a} by {b}")
try:
result = division(a, b)
info(f"Result: {result}")
except Exception as e:
critical(f"Error: {e}")
exit(1)
if __name__ == "__main__":
main()