From 73a0170d65237fbcb5ad61f8b2b37488cc7275de Mon Sep 17 00:00:00 2001 From: AFredefon Date: Wed, 11 Mar 2026 07:09:58 +0100 Subject: [PATCH] fix: resolve mypy type errors in TUI app and build_log screen --- fuzzforge-cli/src/fuzzforge_cli/tui/app.py | 9 +++++---- fuzzforge-cli/src/fuzzforge_cli/tui/screens/build_log.py | 6 ++++-- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/fuzzforge-cli/src/fuzzforge_cli/tui/app.py b/fuzzforge-cli/src/fuzzforge_cli/tui/app.py index 7999459..80c79fc 100644 --- a/fuzzforge-cli/src/fuzzforge_cli/tui/app.py +++ b/fuzzforge-cli/src/fuzzforge_cli/tui/app.py @@ -35,7 +35,7 @@ if TYPE_CHECKING: _AgentRow = tuple[str, "AIAgent", Path, str, bool] -class SingleClickDataTable(DataTable): +class SingleClickDataTable(DataTable[Any]): """DataTable subclass that also fires ``RowClicked`` on a single mouse click. Textual's built-in ``RowSelected`` only fires on Enter or on a second click @@ -56,7 +56,7 @@ class SingleClickDataTable(DataTable): """Return the data table that fired this event.""" return self.data_table - async def _on_click(self, event: events.Click) -> None: # type: ignore[override] + async def _on_click(self, event: events.Click) -> None: """Forward to parent, then post RowClicked on every mouse click. The hub table is handled exclusively via RowClicked. RowSelected is @@ -450,9 +450,10 @@ class FuzzForgeApp(App[None]): self._build_dialog_open = True - def _on_build_dialog_done(confirmed: bool, sn: str = server_name, im: str = image, hn: str = hub_name) -> None: + def _on_build_dialog_done(result: bool | None) -> None: self._build_dialog_open = False - self._on_build_confirmed(confirmed, sn, im, hn) + if result is not None: + self._on_build_confirmed(result, server_name, image, hub_name) self.push_screen( BuildImageScreen(server_name, image, hub_name), diff --git a/fuzzforge-cli/src/fuzzforge_cli/tui/screens/build_log.py b/fuzzforge-cli/src/fuzzforge_cli/tui/screens/build_log.py index cf9357e..e260af8 100644 --- a/fuzzforge-cli/src/fuzzforge_cli/tui/screens/build_log.py +++ b/fuzzforge-cli/src/fuzzforge_cli/tui/screens/build_log.py @@ -8,6 +8,8 @@ open at any time while the build is running and see up-to-date output. from __future__ import annotations +from typing import Any + from textual.app import ComposeResult from textual.containers import Horizontal, Vertical from textual.screen import ModalScreen @@ -51,13 +53,13 @@ class BuildLogScreen(ModalScreen[None]): log_widget.write_line(line) self._last_line += len(new_lines) - active: dict = getattr(self.app, "_active_builds", {}) + active: dict[str, Any] = getattr(self.app, "_active_builds", {}) status = self.query_one("#build-status", Label) if self._image in active: status.update("[yellow]⏳ Building…[/yellow]") else: # Build is done — check if we have a result stored - results: dict = getattr(self.app, "_build_results", {}) + results: dict[str, Any] = getattr(self.app, "_build_results", {}) if self._image in results: if results[self._image]: status.update(f"[green]✓ {self._image} built successfully[/green]")