Skip to content

Commit 3dd1cc5

Browse files
Clean up Python projects
1 parent a414de5 commit 3dd1cc5

17 files changed

+132
-16
lines changed

2020/python/README.md

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../README.md

2020/python/aoc_2020/day01.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
from itertools import permutations
33
from operator import mul
44

5-
input = open("2020/input/day01.txt").read()
5+
input = open("../input/day01.txt").read()
66
numbers = [int(x) for x in input.splitlines()]
77

88

2020/python/aoc_2020/day02.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ def parse_line(line):
66
return a, b, target, password
77

88

9-
input = open("2020/input/day02.txt").read()
9+
input = open("../input/day02.txt").read()
1010
passwords = [parse_line(x) for x in input.splitlines()]
1111

1212

2020/python/aoc_2020/day03.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from functools import reduce
22
from operator import mul
33

4-
input = open("2020/input/day03.txt").read().splitlines()
4+
input = open("../input/day03.txt").read().splitlines()
55

66

77
def traverse(step_x, step_y):

2020/python/aoc_2020/day04.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ def parse_passport(data: str) -> Passport:
9393
return Passport(fields)
9494

9595

96-
with open("2020/input/day04.txt", encoding="utf8") as file:
96+
with open("../input/day04.txt", encoding="utf8") as file:
9797
passport_data = file.read().split(os.linesep + os.linesep)
9898
passports = [parse_passport(lines) for lines in passport_data]
9999

2020/python/aoc_2020/day05.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def find_seat_location(seat: str) -> Tuple[int, int]:
3434
return find_row(seat[:7]), find_column(seat[7:])
3535

3636

37-
with open("2020/input/day05.txt", encoding="utf8") as file:
37+
with open("../input/day05.txt", encoding="utf8") as file:
3838
seats = [find_seat_location(line) for line in file.read().splitlines()]
3939
seat_ids = [row * 8 + column for row, column in seats]
4040
max_seat = max(seat_ids)

2020/python/aoc_2020/day06.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ def intersect(group: List[List[str]]) -> List[str]:
2121
return list(result)
2222

2323

24-
with open("2020/input/day06.txt", encoding="utf8") as file:
24+
with open("../input/day06.txt", encoding="utf8") as file:
2525
groups = [
2626
group.splitlines() for group in file.read().split(os.linesep + os.linesep)
2727
]

2020/python/aoc_2020/day07.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ def count_children(color: str):
5454
return count_children("shiny gold")
5555

5656

57-
with open("2020/input/07.txt", encoding="utf-8") as file:
57+
with open("../input/07.txt", encoding="utf-8") as file:
5858
input = [parse_line(line) for line in file.readlines()]
5959
print("Part one:", part_one(input))
6060
print("Part two:", part_two(input))

2020/python/aoc_2020/day08.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ def boot(code: list[str]):
2121
return acc, pos == len(code)
2222

2323

24-
with open("2020/input/08.txt", encoding="utf-8") as file:
24+
with open("../input/08.txt", encoding="utf-8") as file:
2525
input = file.readlines()
2626

2727
acc, _ = boot(input)

2020/python/aoc_2020/day09.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def part_two(invalid: int, input: list[int]):
2929
return part_two(invalid, input[1:])
3030

3131

32-
with open("2020/input/09.txt", encoding="utf-8") as file:
32+
with open("../input/09.txt", encoding="utf-8") as file:
3333
input = [int(line) for line in file.readlines()]
3434

3535
invalid = part_one(input)
File renamed without changes.

pyproject.toml renamed to 2020/python/pyproject.toml

+1-5
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,9 @@
11
[tool.poetry]
2-
name = "advent-of-code"
2+
name = "aoc-2020"
33
version = "0.1.0"
44
description = ""
55
authors = ["Sander Ploegsma <[email protected]>"]
66
readme = "README.md"
7-
packages = [
8-
{ include = "2020/python/aoc_2020" },
9-
{ include = "2023/python/aoc_2023" },
10-
]
117

128
[tool.poetry.dependencies]
139
python = "^3.11"

2023/python/README.md

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../README.md

2023/python/aoc_2023/day01.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import re
33
import string
44

5-
with open("2023/input/01.txt", encoding="utf-8") as f:
5+
with open("../input/01.txt", encoding="utf-8") as f:
66
input = [line.strip() for line in f.readlines()]
77

88

2023/python/aoc_2023/day02.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def power(game: Game) -> int:
3737
return r_max * g_max * b_max
3838

3939

40-
with open("2023/input/02.txt", encoding="utf-8") as f:
40+
with open("../input/02.txt", encoding="utf-8") as f:
4141
input = f.readlines()
4242

4343
games = [parse_game(line.strip()) for line in input]

2023/python/poetry.lock

+100
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

2023/python/pyproject.toml

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
[tool.poetry]
2+
name = "aoc-2023"
3+
version = "0.1.0"
4+
description = ""
5+
authors = ["Sander Ploegsma <[email protected]>"]
6+
readme = "README.md"
7+
8+
[tool.poetry.dependencies]
9+
python = "^3.11"
10+
11+
12+
[tool.poetry.group.dev.dependencies]
13+
pytest = "^7.4.3"
14+
ruff = "^0.1.6"
15+
16+
[build-system]
17+
requires = ["poetry-core"]
18+
build-backend = "poetry.core.masonry.api"

0 commit comments

Comments
 (0)