-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtemplate.py
More file actions
44 lines (36 loc) · 960 Bytes
/
template.py
File metadata and controls
44 lines (36 loc) · 960 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
40
41
42
43
44
import logging
LOGGER = logging.getLogger()
def get_input_lines(filename):
lines = None
with open(filename, "r") as f:
lines = f.readlines()
return lines
def main(lines):
# Code goes here
pass
if __name__ == "__main__":
import argparse
parser = argparse.ArgumentParser()
parser.add_argument(
"-x",
"--example",
action="store_true",
help="Run on input.ex.txt",
)
parser.add_argument(
"-i",
"--input",
default="input.txt",
help="Pass a custom file as input",
)
parser.add_argument(
"-d",
"--debug",
action="store_true",
help="Change logging level to debug",
)
ARGS = parser.parse_args()
input_filename = "input.ex.txt" if ARGS.example else ARGS.input
level = logging.DEBUG if ARGS.debug else logging.INFO
logging.basicConfig(level = level)
main(get_input_lines(input_filename))