Skip to content

Commit 46c268d

Browse files
committed
🐛 Fix types, python version and linter warnings
1 parent 10695c3 commit 46c268d

File tree

4 files changed

+101
-101
lines changed

4 files changed

+101
-101
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name = "esc-drammatic-pause"
33
version = "0.1.0"
44
description = "Add your description here"
55
readme = "README.md"
6-
requires-python = ">=3.12"
6+
requires-python = ">=3.12,<3.14"
77
dependencies = [
88
"pytest>=8.4.0",
99
"rich>=14.0.0",

src/__main__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ def sort_dict[A, B](d: dict[A, B], *, reverse: bool = True) -> dict[A, B]:
6060

6161

6262
@app.command()
63-
def run(jury_path: Path = "jury.txt", participating_countries: int = 37, rest_of_world_vote: bool = True) -> None: # pyright: ignore [reportArgumentType]
63+
def run(jury_path: Path = "jury.txt", participating_countries: int = 37, rest_of_world_vote: bool = True) -> None: # pyright: ignore [reportArgumentType] # noqa: FBT001, FBT002
6464
"""Run the ESC jury and televoting scoring prediction system."""
6565
jury_file = Path(jury_path)
6666
if not jury_file.exists():

tests/test_esc.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -34,20 +34,18 @@ class ESCData(TypedDict):
3434
winner: str
3535
participating_countries: int
3636

37-
with open(DATASET_BASE / "countries.json", "rb") as f:
37+
38+
with (DATASET_BASE / "countries.json").open("rb") as f:
3839
COUNTRY_NAMES: dict[str, str] = orjson.loads(f.read())
3940

41+
4042
def get_country_name(country_code: str) -> str:
4143
"""Convert country code to full country name."""
42-
4344
return COUNTRY_NAMES.get(country_code.upper(), country_code)
4445

4546

4647
def get_country_mapping(year: int) -> dict[int, str]:
47-
"""
48-
Map contestant IDs to country codes by reading the contestants directory.
49-
Returns a dict: {contestant_id: country_code}
50-
"""
48+
"""Map contestant IDs to country codes by reading the contestants directory."""
5149
contestants_dir = DATASET_PATH / str(year) / "contestants"
5250
country_mapping: dict[int, str] = {}
5351

@@ -93,8 +91,8 @@ def parse_year_data(year: int) -> ESCData:
9391
# Count participating countries
9492
participating_countries = count_participating_countries(year)
9593

96-
jury_scores = {}
97-
televote_scores = {}
94+
jury_scores: dict[str, int] = {}
95+
televote_scores: dict[str, int] = {}
9896
winner = None
9997

10098
performances = data.get("performances", [])
@@ -171,8 +169,10 @@ def test_esc_grand_final(year: int, data: ESCData) -> None:
171169
result = runner.invoke(
172170
app,
173171
[
174-
"--jury-path", f.name,
175-
"--participating-countries", str(participating_countries),
172+
"--jury-path",
173+
f.name,
174+
"--participating-countries",
175+
str(participating_countries),
176176
"--rest-of-world-vote" if rest_of_world_vote else "--no-rest-of-world-vote",
177177
],
178178
input="\n".join(inputs),
@@ -183,4 +183,4 @@ def test_esc_grand_final(year: int, data: ESCData) -> None:
183183
except Exception:
184184
pytest.fail(f"Could not parse winner from output:\n{result.output}", pytrace=False)
185185

186-
assert actual == expected_winner, f"For {year}, expected winner {expected_winner} but got {actual!r}"
186+
assert actual == expected_winner, f"For {year}, expected winner {expected_winner} but got {actual!r}"

0 commit comments

Comments
 (0)