Skip to content

Commit 8c3c1bf

Browse files
chore: configure mypy
1 parent 1f4e2cf commit 8c3c1bf

File tree

4 files changed

+23
-10
lines changed

4 files changed

+23
-10
lines changed

pyproject.toml

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ dependencies = [
7272
"ruff>=0.0.243",
7373
]
7474
[tool.hatch.envs.lint.scripts]
75-
typing = "mypy --install-types --non-interactive {args:src/adventofcode tests}"
75+
typing = "mypy --install-types --non-interactive {args:src/adventofcode}"
7676
style = [
7777
"ruff {args:.}",
7878
"black --check --diff {args:.}",
@@ -180,4 +180,15 @@ tag_format = "v$version"
180180
version = "1.8.2"
181181
version_files = [
182182
"src/adventofcode/__about__.py",
183-
]
183+
]
184+
185+
[[tool.mypy.overrides]]
186+
module = [
187+
"rich.console",
188+
"rich.table",
189+
"httpx",
190+
"utils",
191+
"config",
192+
]
193+
disable_error_code = ["name-defined"]
194+
ignore_missing_imports = true

src/adventofcode/scripts/runner.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ def run_all() -> None:
2323
config.RUNNING_ALL = False
2424

2525

26-
def _run_day(module: str, year: int, day: int):
26+
def _run_day(module, year: int, day: int):
2727
"""
2828
Runs all solutions in the given day
2929
"""

src/adventofcode/year_2022/day_13_2022.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,14 @@ def parse_line(line: str) -> Packet:
1717
def parse_pairs(input_data: list[str]) -> list[Pair]:
1818
"""Parse input into list of Pair"""
1919
pairs: list[tuple[Packet, Packet]] = []
20-
current_pair: Pair = ()
20+
current_pair: Pair = () # type: ignore
2121

2222
for line in [*input_data, ""]:
2323
if not line:
2424
pairs.append(current_pair)
25-
current_pair: Pair = ()
25+
current_pair = () # type: ignore
2626
else:
27-
current_pair += (parse_line(line),)
27+
current_pair += (parse_line(line),) # type: ignore
2828

2929
return pairs
3030

@@ -65,6 +65,8 @@ def compare_pairs(left: Packet, right: Packet) -> bool | None:
6565
if (outcome := compare_pairs(_left_value, _right_value)) is not None:
6666
return outcome
6767

68+
return None
69+
6870

6971
def find_packets(input_data: list[str]) -> int:
7072
"""Find sum of Pair indexes that are in the correct order"""
@@ -87,7 +89,7 @@ def find_distress_signal(input_data: list[str]) -> int:
8789
pairs = parse_pairs(input_data)
8890
divider_packet_one = [[2]]
8991
divider_packet_two = [[6]]
90-
packets: list[Packet] = [divider_packet_one, divider_packet_two]
92+
packets: list[Packet] = [divider_packet_one, divider_packet_two] # type: ignore
9193

9294
for pair in pairs:
9395
left, right = pair
@@ -101,8 +103,8 @@ def find_distress_signal(input_data: list[str]) -> int:
101103
packets[index], packets[index + 1] = packets[index + 1], packets[index]
102104

103105
# Find divider packets
104-
one = packets.index(divider_packet_one) + 1
105-
two = packets.index(divider_packet_two) + 1
106+
one = packets.index(divider_packet_one) + 1 # type: ignore
107+
two = packets.index(divider_packet_two) + 1 # type: ignore
106108
return one * two
107109

108110

src/adventofcode/year_2022/day_15_2022.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ def find_beacon_position(input_data: list[str], range_value: int = 4000000) -> i
9494

9595
with Pool() as p:
9696
results = p.map(partial(find_positions_at_y, pairs), range(range_value))
97-
x, y = next(filter(bool, results))
97+
x, y = next(filter(bool, results)) # type: ignore
9898
return x * range_value + y
9999

100100

0 commit comments

Comments
 (0)