mirror of
https://github.com/ChuckBuilds/LEDMatrix.git
synced 2026-10-05 23:05:10 +00:00
fix(plugins): call the runtime view's display_modes directly
Codacy flagged the getattr/callable indirection as 'lookup is not callable'. The view is a PluginRuntimeView or None; anything else raises inside the existing try and falls back to the manifest. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -205,12 +205,11 @@ class PluginCatalog:
|
|||||||
def _live_display_modes(self, plugin_id: str) -> Optional[List[str]]:
|
def _live_display_modes(self, plugin_id: str) -> Optional[List[str]]:
|
||||||
"""The modes the running display registered for ``plugin_id``, or None."""
|
"""The modes the running display registered for ``plugin_id``, or None."""
|
||||||
view = self._runtime_view()
|
view = self._runtime_view()
|
||||||
lookup = getattr(view, 'display_modes', None)
|
if view is None:
|
||||||
if not callable(lookup):
|
|
||||||
return None
|
return None
|
||||||
try:
|
try:
|
||||||
modes = lookup(plugin_id)
|
modes = view.display_modes(plugin_id)
|
||||||
except Exception as exc:
|
except Exception as exc: # includes a source returning something else
|
||||||
self.logger.debug("Could not read display modes for %s: %s", plugin_id, exc)
|
self.logger.debug("Could not read display modes for %s: %s", plugin_id, exc)
|
||||||
return None
|
return None
|
||||||
return list(modes) if isinstance(modes, list) and modes else None
|
return list(modes) if isinstance(modes, list) and modes else None
|
||||||
|
|||||||
Reference in New Issue
Block a user