From 4e02b74f07ad449f5a562f17659c85c80bc0c4d2 Mon Sep 17 00:00:00 2001 From: claude Date: Thu, 25 Jun 2026 07:08:57 +0000 Subject: [PATCH] fix(types): resolve pyright errors introduced in #269 changes - manifest.py: remove unused load_bottle_chain_from_dir import - manifest_extends.py: drop redundant ManifestEgressRoute annotation - test_cli_start_selector.py: remove unused call import - test_cli_tui.py: move Optional/constants to top, annotate FakeScreen, remove unused curses import - test_manifest_bottle_merge.py: add type args to dict, annotate **kwargs --- bot_bottle/manifest.py | 2 +- bot_bottle/manifest_extends.py | 2 +- tests/unit/test_cli_start_selector.py | 2 +- tests/unit/test_cli_tui.py | 22 ++++++++++------------ tests/unit/test_manifest_bottle_merge.py | 4 ++-- 5 files changed, 15 insertions(+), 17 deletions(-) diff --git a/bot_bottle/manifest.py b/bot_bottle/manifest.py index b8ad744..d58b99b 100644 --- a/bot_bottle/manifest.py +++ b/bot_bottle/manifest.py @@ -486,7 +486,7 @@ class ManifestIndex: bottle = raw_bottle if merged == raw_bottle.git_user else replace(raw_bottle, git_user=merged) return Manifest(agent=agent, bottle=bottle) - from .manifest_loader import load_bottle_chain_from_dir, scan_agent_names + from .manifest_loader import scan_agent_names from .manifest_schema import validate_agent_frontmatter_keys from .yaml_subset import YamlSubsetError, parse_frontmatter diff --git a/bot_bottle/manifest_extends.py b/bot_bottle/manifest_extends.py index 05d122b..174003f 100644 --- a/bot_bottle/manifest_extends.py +++ b/bot_bottle/manifest_extends.py @@ -48,7 +48,7 @@ def _merge_two_bottles_runtime(base: "ManifestBottle", override: "ManifestBottle for n in merged_repos_names ) - merged_routes: tuple[ManifestEgressRoute, ...] = base.egress.routes + override.egress.routes + merged_routes = base.egress.routes + override.egress.routes merged_egress = ManifestEgressConfig(routes=merged_routes, Log=override.egress.Log) return ManifestBottle( diff --git a/tests/unit/test_cli_start_selector.py b/tests/unit/test_cli_start_selector.py index 57b9700..b4311eb 100644 --- a/tests/unit/test_cli_start_selector.py +++ b/tests/unit/test_cli_start_selector.py @@ -11,7 +11,7 @@ from __future__ import annotations import os import unittest -from unittest.mock import MagicMock, call, patch +from unittest.mock import MagicMock, patch import bot_bottle.cli.start as start_mod import bot_bottle.cli.tui as tui_mod diff --git a/tests/unit/test_cli_tui.py b/tests/unit/test_cli_tui.py index 02a51ec..9d4b9a2 100644 --- a/tests/unit/test_cli_tui.py +++ b/tests/unit/test_cli_tui.py @@ -8,9 +8,13 @@ a real curses session (which requires a TTY). from __future__ import annotations import unittest +from typing import Any, Optional from bot_bottle.cli.tui import _filter_items, _multiselect_loop, filter_multiselect, filter_select +_KEY_ESC = 27 +_KEY_CTRL_D = 4 + class TestFilterItems(unittest.TestCase): def setUp(self): @@ -68,18 +72,15 @@ class TestMultiselectLoopReordering(unittest.TestCase): def _run(self, keys: list[int], items: list[str], initial: list[str]) -> Optional[list[str]]: """Run _multiselect_loop with a synthetic screen feeding `keys`.""" - import curses as _curses - key_iter = iter(keys) class FakeScreen: - def erase(self): pass - def getmaxyx(self): return (40, 80) - def refresh(self): pass - def getch(self): - return next(key_iter) - def addstr(self, *a, **kw): pass - def keypad(self, *a): pass + def erase(self) -> None: pass + def getmaxyx(self) -> tuple[int, int]: return (40, 80) + def refresh(self) -> None: pass + def getch(self) -> int: return next(key_iter) + def addstr(self, *a: Any) -> None: pass + def keypad(self, *a: Any) -> None: pass return _multiselect_loop(FakeScreen(), items, title="", initial=initial) # type: ignore[arg-type] @@ -144,9 +145,6 @@ class TestMultiselectLoopReordering(unittest.TestCase): self.assertEqual(["a", "b"], result) -from typing import Optional -_KEY_ESC = 27 -_KEY_CTRL_D = 4 if __name__ == "__main__": diff --git a/tests/unit/test_manifest_bottle_merge.py b/tests/unit/test_manifest_bottle_merge.py index f32d59b..a0b3795 100644 --- a/tests/unit/test_manifest_bottle_merge.py +++ b/tests/unit/test_manifest_bottle_merge.py @@ -17,11 +17,11 @@ from bot_bottle.manifest import ManifestBottle, ManifestError, ManifestIndex from bot_bottle.manifest_extends import merge_bottles_runtime -def _index(bottles: dict, agents: dict) -> ManifestIndex: +def _index(bottles: dict[str, object], agents: dict[str, object]) -> ManifestIndex: return ManifestIndex.from_json_obj({"bottles": bottles, "agents": agents}) -def _bottle(**kwargs) -> ManifestBottle: +def _bottle(**kwargs: object) -> ManifestBottle: return ManifestBottle.from_dict("test", kwargs)