Skip to content

Commit 30c0f7f

Browse files
committed
* Formatting updates
1 parent 79b2be2 commit 30c0f7f

7 files changed

Lines changed: 191 additions & 135 deletions

File tree

.pre-commit-config.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ repos:
66
- id: pre-commit-update
77

88
- repo: https://github.com/astral-sh/uv-pre-commit
9-
rev: 0.9.16
9+
rev: 0.9.17
1010
hooks:
1111
# Update the uv lockfile
1212
- id: uv-lock
@@ -45,6 +45,7 @@ repos:
4545
- id: check-yaml
4646
# Makes sure files end in a newline and only a newline
4747
- id: end-of-file-fixer
48+
exclude: src/.*/sample_input.txt
4849
# Removes UTF-8 byte order marker
4950
- id: fix-byte-order-marker
5051
# Replaces or checks mixed line ending
@@ -65,7 +66,7 @@ repos:
6566
- id: yamllint
6667

6768
- repo: https://github.com/astral-sh/ruff-pre-commit
68-
rev: v0.14.8
69+
rev: v0.14.9
6970
hooks:
7071
# Run the linter
7172
- id: ruff-check

pyproject.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ dev = [
66
"pre-commit",
77
"pytest",
88
"pytest-cov",
9+
"scipy-stubs",
910
]
1011

1112
[project]
@@ -16,6 +17,7 @@ dependencies = [
1617
"numpy",
1718
"scipy",
1819
"tqdm",
20+
"z3-solver>=4.15.4.0",
1921
]
2022
description = "My solutions to Advent of Code programming puzzles."
2123
name = "advent-of-code"

src/2017/01/2017_01.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
from typing import List
2-
31
from src.utils.data import load_data
42
from src.utils.submission import submit_or_print
53

@@ -14,7 +12,7 @@ def main(debug: bool) -> None:
1412
submit_or_print(result_part1, result_part2, debug)
1513

1614

17-
def solve(digits: List[int], shift: int) -> int:
15+
def solve(digits: list[int], shift: int) -> int:
1816
return sum(
1917
[d for i, d in enumerate(digits) if digits[(i + shift) % len(digits)] == d]
2018
)

src/2019/02/2019_02.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
from itertools import product
22
from operator import add, mul
3-
from typing import List
43

54
from src.utils.data import load_data
65
from src.utils.submission import submit_or_print
@@ -25,7 +24,7 @@ def main(debug: bool) -> None:
2524
submit_or_print(result_part1, result_part2, debug)
2625

2726

28-
def solve(input_list: List[int], val1: int, val2: int) -> List[int]:
27+
def solve(input_list: list[int], val1: int, val2: int) -> list[int]:
2928
try:
3029
memory = input_list.copy()
3130
memory[1] = val1

src/2020/01/2020_01.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
from itertools import combinations
22
from math import prod
3-
from typing import Set
43

54
from src.utils.data import load_data
65
from src.utils.submission import submit_or_print
76

87

9-
def solve(numbers: Set[int], numbers_count: int, target_sum: int) -> int:
8+
def solve(numbers: set[int], numbers_count: int, target_sum: int) -> int:
109
sets = combinations(numbers, numbers_count)
1110
matching_sets = list(filter(lambda s: sum(s) == target_sum, sets))
1211
assert len(matching_sets) == 1

src/2020/02/2020_02.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import re
22
from collections import Counter
3-
from typing import Any, List, Tuple
3+
from typing import Any
44

55
from src.utils.data import load_data
66
from src.utils.submission import submit_or_print
77

88

9-
def parse_input(input_data: str) -> List[Tuple[Any, ...]]:
9+
def parse_input(input_data: str) -> list[tuple[Any, ...]]:
1010
result = []
1111
for line in input_data.splitlines():
1212
m = re.match(r"(\d+)-(\d+) ([a-z]): ([a-z]+)", line)
@@ -23,14 +23,14 @@ def main(debug: bool) -> None:
2323

2424
lines = parse_input(input_data)
2525

26-
def correct_part1(line: Tuple[Any, ...]):
26+
def correct_part1(line: tuple[Any, ...]):
2727
first_number, second_number, character, password = line
2828
c = Counter(password)
2929
return first_number <= c[character] <= second_number
3030

3131
result_part1 = len(list(filter(correct_part1, lines)))
3232

33-
def correct_part2(line: Tuple[Any, ...]):
33+
def correct_part2(line: tuple[Any, ...]):
3434
first_number, second_number, character, password = line
3535
password = " " + password # make indexing 1-based
3636
return (password[first_number] == character) ^ (

0 commit comments

Comments
 (0)