-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
62 lines (48 loc) · 1.71 KB
/
main.py
File metadata and controls
62 lines (48 loc) · 1.71 KB
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
from typing import Optional
import sys
import os
def new_day() -> None:
day_dirs = [d[3:] for d in os.listdir() if d[3:].isnumeric()]
next_day: int = max([int(day) for day in day_dirs]) + 1 if day_dirs else 1
day_str: str = f"{next_day:02d}"
dir_str: str = f"day{day_str}"
os.mkdir(dir_str)
[open(f"{dir_str}/{f}", "a").close() for f in
["assignment1.txt", "assignment2.txt", "input.txt", "input_short.txt", "__init__.py"]]
file_code_contents: str = f"""import numpy as np
import functools
import itertools
import unittest
import math
import time
from collections import defaultdict
from collections import Counter
from typing import Optional
from Utils.GeneralUtils import Utils
class Day{day_str}:
@staticmethod
def part_1(full_input: bool) -> int:
lines: list[str] = Utils.read_input(is_full_input=full_input, day="{day_str}")
pass
@staticmethod
def part_2(full_input: bool) -> int:
lines: list[str] = Utils.read_input(is_full_input=full_input, day="{day_str}")
pass
class Day{day_str}Tests(unittest.TestCase):
def test_part_1(self):
self.assertEqual(1, Day{day_str}.part_1(False))
# start: float = time.time()
# self.assertEqual(1, Day{day_str}.part_1(True))
# print("%s sec" % (time.time() - start))
pass
def test_part_2(self):
# self.assertEqual(1, Day{day_str}.part_2(False))
# start: float = time.time()
# self.assertEqual(1, Day{day_str}.part_2(True))
# print("%s sec" % (time.time() - start))
pass
"""
with open(f"{dir_str}/Day{day_str}.py", "w") as file:
file.write(file_code_contents)
if __name__ == "__main__":
new_day()