@@ -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+
4042def 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
4647def 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