From 199b2cff85a8299c5392478ac17375d126511a3c Mon Sep 17 00:00:00 2001 From: Chuck <33324927+ChuckBuilds@users.noreply.github.com> Date: Thu, 1 Oct 2026 08:31:48 -0400 Subject: [PATCH] style(sports): variable annotations instead of type comments pyflakes (Codacy) does not read "# type:" comments, so it flagged the Optional and List imports they use as unused (F401). Inline annotations say the same to mypy. The drift-report normaliser, which the stage 4 parity test shares, now treats "x: T = v" as "x = v" -- it already dropped annotations elsewhere -- so the core copies still match the plugins' plain assignments. Co-Authored-By: Claude Opus 5.5 --- scripts/sports_drift_report.py | 8 ++++++++ src/common/sports_live_scroll.py | 2 +- src/common/sports_plugin_host.py | 4 ++-- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/scripts/sports_drift_report.py b/scripts/sports_drift_report.py index 4f239b07..de4377ce 100644 --- a/scripts/sports_drift_report.py +++ b/scripts/sports_drift_report.py @@ -140,6 +140,14 @@ class _Canonical(ast.NodeTransformer): node.annotation = None return node + def visit_AnnAssign(self, node): + # ``x: T = v`` is ``x = v``; a bare ``x: T`` does nothing at runtime. + self.generic_visit(node) + if node.value is None: + return None + return ast.copy_location( + ast.Assign(targets=[node.target], value=node.value), node) + class _Folded(_Canonical): """Canonical, plus sport names folded out of identifiers and strings.""" diff --git a/src/common/sports_live_scroll.py b/src/common/sports_live_scroll.py index 2797b26c..3d82b7f0 100644 --- a/src/common/sports_live_scroll.py +++ b/src/common/sports_live_scroll.py @@ -181,7 +181,7 @@ class SportsLiveScrollMixin: def _live_scroll_fingerprint(self, league=None) -> tuple: """Fingerprint of every live game the strip's managers hold now.""" - games = [] # type: List[Any] + games: List[Any] = [] for manager in self._live_scroll_managers(league): games.extend(getattr(manager, "live_games", None) or []) return self._fingerprint_games(games) diff --git a/src/common/sports_plugin_host.py b/src/common/sports_plugin_host.py index bccc024e..7122e65b 100644 --- a/src/common/sports_plugin_host.py +++ b/src/common/sports_plugin_host.py @@ -103,10 +103,10 @@ class SportsPluginHostMixin: concurrent background plugin.update() for the same manager returns early rather than fetching twice. """ - threads = getattr(self, "_switch_refresh_threads", None) # type: Optional[Dict[int, threading.Thread]] + threads: Optional[Dict[int, threading.Thread]] = getattr(self, "_switch_refresh_threads", None) if threads is None: threads = self._switch_refresh_threads = {} - stamps = getattr(self, "_switch_refresh_at", None) # type: Optional[Dict[int, float]] + stamps: Optional[Dict[int, float]] = getattr(self, "_switch_refresh_at", None) if stamps is None: stamps = self._switch_refresh_at = {}