Fix flake8 errors for 2023:1-10
This commit is contained in:
parent
b681e5cdb7
commit
a1bf11a5ed
12 changed files with 20 additions and 19 deletions
|
|
@ -36,3 +36,7 @@ Execute separate puzzle on file save (replace `XX` with the puzzle number):
|
|||
|
||||
(requires `entr` and `wl-paste`, Mac users can instead use `pbpaste`. If you
|
||||
prefer X at Linux, use `xclip -selection clipboard -o`).
|
||||
|
||||
To lint files:
|
||||
|
||||
ls output/*.py | entr -r -c flake8 output --ignore=E741,E501,E203
|
||||
|
|
|
|||
|
|
@ -56,8 +56,8 @@ if __name__ == "__main__":
|
|||
# import sys; inp = sys.stdin.read().strip()
|
||||
|
||||
# uncomment to use AoC provided puzzle input
|
||||
# with open(f"./input/{padded_no}.txt", "r") as f:
|
||||
# inp = f.read()
|
||||
# with open("./input/{padded_no}.txt", "r") as f:
|
||||
# inp = f.read().strip()
|
||||
|
||||
# uncomment to do initial data processing shared by part 1-2
|
||||
inp = solve(inp)
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ def part_2(data):
|
|||
|
||||
|
||||
if __name__ == "__main__":
|
||||
with open(f"./input/01.txt", "r") as f:
|
||||
with open("./input/01.txt", "r") as f:
|
||||
inp = f.read().strip()
|
||||
|
||||
a = part_1(inp)
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ def part_2(data):
|
|||
|
||||
|
||||
if __name__ == "__main__":
|
||||
with open(f"./input/02.txt", "r") as f:
|
||||
with open("./input/02.txt", "r") as f:
|
||||
inp = f.read().strip()
|
||||
|
||||
a = part_1(inp)
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ def presolve(data):
|
|||
|
||||
|
||||
if __name__ == "__main__":
|
||||
with open(f"./input/03.txt", "r") as f:
|
||||
with open("./input/03.txt", "r") as f:
|
||||
inp = f.read().strip()
|
||||
|
||||
parsed = presolve(inp)
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ def presolve(data):
|
|||
b = set(re.findall(r"\d+", b))
|
||||
ab = len(a & b)
|
||||
if ab > 0:
|
||||
scores.append(2**(ab - 1))
|
||||
scores.append(2 ** (ab - 1))
|
||||
count[cid] += 1
|
||||
for i in range(cid + 1, cid + ab + 1):
|
||||
count[i] += count[cid]
|
||||
|
|
@ -35,7 +35,7 @@ def presolve(data):
|
|||
|
||||
|
||||
if __name__ == "__main__":
|
||||
with open(f"./input/04.txt", "r") as f:
|
||||
with open("./input/04.txt", "r") as f:
|
||||
inp = f.read().strip()
|
||||
|
||||
inp = presolve(inp)
|
||||
|
|
|
|||
|
|
@ -1,7 +1,5 @@
|
|||
import re
|
||||
from itertools import repeat
|
||||
from math import inf
|
||||
from multiprocessing import Pool, freeze_support
|
||||
from output import answer
|
||||
|
||||
n = 5
|
||||
|
|
@ -63,7 +61,7 @@ def _nearest(start, processes, reverse=False):
|
|||
|
||||
|
||||
if __name__ == "__main__":
|
||||
with open(f"./input/05.txt", "r") as f:
|
||||
with open("./input/05.txt", "r") as f:
|
||||
inp = f.read().strip()
|
||||
|
||||
inp = presolve(inp)
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ def presolve(data):
|
|||
|
||||
|
||||
if __name__ == "__main__":
|
||||
with open(f"./input/06.txt", "r") as f:
|
||||
with open("./input/06.txt", "r") as f:
|
||||
inp = f.read().strip()
|
||||
|
||||
inp = presolve(inp)
|
||||
|
|
|
|||
|
|
@ -84,7 +84,7 @@ if __name__ == "__main__":
|
|||
|
||||
doctest.testmod()
|
||||
|
||||
with open(f"./input/07.txt", "r") as f:
|
||||
with open("./input/07.txt", "r") as f:
|
||||
inp = f.read().strip()
|
||||
|
||||
a = part_1(inp)
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ def presolve(data):
|
|||
|
||||
|
||||
if __name__ == "__main__":
|
||||
with open(f"./input/08.txt", "r") as f:
|
||||
with open("./input/08.txt", "r") as f:
|
||||
inp = f.read().strip()
|
||||
|
||||
inp = presolve(inp)
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ def _solve(lines):
|
|||
|
||||
|
||||
if __name__ == "__main__":
|
||||
with open(f"./input/09.txt", "r") as f:
|
||||
with open("./input/09.txt", "r") as f:
|
||||
inp = f.read().strip()
|
||||
|
||||
a = part_1(inp)
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
import re
|
||||
from collections import Counter, defaultdict, deque
|
||||
from collections import deque
|
||||
from output import answer
|
||||
|
||||
n = 10
|
||||
|
|
@ -26,12 +25,12 @@ A = {
|
|||
}
|
||||
|
||||
|
||||
@answer(1, "Answer is {}")
|
||||
@answer(1, "Farthest away pipe is at {}")
|
||||
def part_1(presolved):
|
||||
return presolved[0]
|
||||
|
||||
|
||||
@answer(2, "Actually, answer is {}")
|
||||
@answer(2, "{} spots are encapsulated by pipes")
|
||||
def part_2(presolved):
|
||||
return presolved[1]
|
||||
|
||||
|
|
@ -83,7 +82,7 @@ def presolve(data):
|
|||
|
||||
|
||||
if __name__ == "__main__":
|
||||
with open(f"./input/10.txt", "r") as f:
|
||||
with open("./input/10.txt", "r") as f:
|
||||
inp = f.read()
|
||||
|
||||
inp = presolve(inp)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue