From 816310458156c7cdc4e87104d263adc7a39cc2cb Mon Sep 17 00:00:00 2001 From: Chuck <33324927+ChuckBuilds@users.noreply.github.com> Date: Thu, 24 Sep 2026 11:02:22 -0400 Subject: [PATCH] style(offscreen): lint fixes for the new code (Codacy) Co-Authored-By: Claude Opus 5.5 --- src/display_manager.py | 19 +++++++++++-------- .../testing/visual_display_manager.py | 3 ++- src/vegas_mode/plugin_adapter.py | 5 ++--- 3 files changed, 15 insertions(+), 12 deletions(-) diff --git a/src/display_manager.py b/src/display_manager.py index cbcc6f60..87b5afa2 100644 --- a/src/display_manager.py +++ b/src/display_manager.py @@ -138,24 +138,26 @@ class _OffscreenMatrix(_LogicalMatrix): Reports the surface's size, so plugins that lay out from ``matrix.width`` follow it, and swallows every write that would reach the hardware. Nothing - drawn off-screen may touch the panel the render loop is driving. + drawn off-screen may touch the panel the render loop is driving. Method + names mirror the rgbmatrix API they stand in for. """ + # pylint: disable=invalid-name __slots__ = () - def SetImage(self, *args: Any, **kwargs: Any) -> None: + def SetImage(self, *_args: Any, **_kwargs: Any) -> None: """Inert: off-screen drawing never reaches the panel.""" - def SetPixel(self, *args: Any, **kwargs: Any) -> None: + def SetPixel(self, *_args: Any, **_kwargs: Any) -> None: """Inert: off-screen drawing never reaches the panel.""" def Clear(self) -> None: """Inert: off-screen drawing never reaches the panel.""" - def Fill(self, *args: Any, **kwargs: Any) -> None: + def Fill(self, *_args: Any, **_kwargs: Any) -> None: """Inert: off-screen drawing never reaches the panel.""" - def SwapOnVSync(self, canvas: Any, *args: Any, **kwargs: Any) -> Any: + def SwapOnVSync(self, canvas: Any, *_args: Any, **_kwargs: Any) -> Any: """Inert: hands the canvas straight back without waiting on the panel.""" return canvas @@ -174,7 +176,8 @@ class _OffscreenSurface: def __init__(self, width: int, height: int, real_matrix: Any) -> None: self.image = Image.new('RGB', (width, height)) self.draw = ImageDraw.Draw(self.image) - self.draw.fontmode = "1" # 1-bit text: the panel has no partial brightness, so AA only smears glyphs. + # 1-bit text: the panel has no partial brightness, so AA only smears glyphs. + self.draw.fontmode = "1" self.matrix = (_OffscreenMatrix(real_matrix, width, height) if real_matrix is not None else None) @@ -190,7 +193,7 @@ def _per_thread_canvas_attr(name: str) -> property: shared = "_shared_" + name def fget(self: "DisplayManager") -> Any: - surface = self._current_surface() + surface = self._current_surface() # pylint: disable=protected-access if surface is not None: return getattr(surface, name) try: @@ -199,7 +202,7 @@ def _per_thread_canvas_attr(name: str) -> property: raise AttributeError(name) from None def fset(self: "DisplayManager", value: Any) -> None: - surface = self._current_surface() + surface = self._current_surface() # pylint: disable=protected-access if surface is not None: setattr(surface, name, value) else: diff --git a/src/plugin_system/testing/visual_display_manager.py b/src/plugin_system/testing/visual_display_manager.py index aed4d568..3513e140 100644 --- a/src/plugin_system/testing/visual_display_manager.py +++ b/src/plugin_system/testing/visual_display_manager.py @@ -263,7 +263,8 @@ class VisualTestDisplayManager: self.matrix = _MatrixProxy(target_w, target_h) self.image = Image.new('RGB', (target_w, target_h), (0, 0, 0)) self.draw = ImageDraw.Draw(self.image) - self.draw.fontmode = "1" # Match production: 1-bit text, so goldens show what the panel shows. + # Match production: 1-bit text, so goldens show what the panel shows. + self.draw.fontmode = "1" self._capture_mode_active = True yield self finally: diff --git a/src/vegas_mode/plugin_adapter.py b/src/vegas_mode/plugin_adapter.py index e283ecaf..aa1b79c2 100644 --- a/src/vegas_mode/plugin_adapter.py +++ b/src/vegas_mode/plugin_adapter.py @@ -160,11 +160,10 @@ class PluginAdapter: there is no plugin manager to ask -- the behaviour before the lock was taken here at all. """ - get_lock = getattr(self.plugin_manager, 'get_plugin_lock', None) - if get_lock is None: + if not hasattr(self.plugin_manager, 'get_plugin_lock'): yield True return - lock = get_lock(plugin_id) + lock = self.plugin_manager.get_plugin_lock(plugin_id) acquired = lock.acquire(timeout=self.PLUGIN_LOCK_TIMEOUT) try: yield acquired