-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup_day.py
executable file
·40 lines (28 loc) · 966 Bytes
/
setup_day.py
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
import argparse
import os
import sys
def main(year, day):
os.system('./session.sh')
path = os.getcwd()
day_path = f"{path}/{year}/{day}/"
os.mkdir(day_path)
os.chdir(day_path)
test_cases = """cases = [
{'level': 1, 'input': None, 'output': None},
]"""
solution = """from aoc_utils import aoc_utils
from tests import cases
def answer(problem_input, level, test=False):
return 0
aoc_utils.run(answer, cases)
"""
with open("solution.py", "w") as s:
s.write(solution)
with open("tests.py", "w") as tc:
tc.write(test_cases)
if __name__ == '__main__':
cl = argparse.ArgumentParser(description="This script generates python templates for each AoC day.")
cl.add_argument("--year", required=True, help="the year of AoC we are working with")
cl.add_argument("--day", required=True, help="the day of AoC we are working with")
args = cl.parse_args()
sys.exit(main(args.year, args.day))