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:
Chuck
2026-10-05 09:54:38 -04:00
co-authored by Claude Opus 5.5
parent 554426e023
commit e74447c65e
+3 -4
View File
@@ -205,12 +205,11 @@ class PluginCatalog:
def _live_display_modes(self, plugin_id: str) -> Optional[List[str]]:
"""The modes the running display registered for ``plugin_id``, or None."""
view = self._runtime_view()
lookup = getattr(view, 'display_modes', None)
if not callable(lookup):
if view is None:
return None
try:
modes = lookup(plugin_id)
except Exception as exc:
modes = view.display_modes(plugin_id)
except Exception as exc: # includes a source returning something else
self.logger.debug("Could not read display modes for %s: %s", plugin_id, exc)
return None
return list(modes) if isinstance(modes, list) and modes else None