From 56aade60fcdde6125246dae21b0e39f463f6ca9d Mon Sep 17 00:00:00 2001 From: Isaac Beh Date: Sun, 2 Jul 2023 11:48:55 +1000 Subject: [PATCH] Removed an instance of Any within gaming.py --- uqcsbot/gaming.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/uqcsbot/gaming.py b/uqcsbot/gaming.py index 2c478aa..1168218 100644 --- a/uqcsbot/gaming.py +++ b/uqcsbot/gaming.py @@ -53,18 +53,19 @@ def get_bgg_id(self, search_name: str) -> Optional[str]: return None # filters for the closest name match - match: Any = {} + match: Dict[str, float] = {} for item in results: - if item.get("id") is None: + item_id = item.get("id") + if item_id is None: continue for element in item: if element.tag == "name": - match[item.get("id")] = SequenceMatcher( + match[item_id] = SequenceMatcher( None, search_name, (x if (x := element.get("value")) is not None else ""), ).ratio() - return max(match, key=match.get) + return max(match, key=lambda x: match.get(x, 0)) def get_board_game_parameters(self, identity: str) -> Optional[Parameters]: """