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
This commit is contained in:
@@ -488,7 +488,7 @@ class ManifestIndex:
|
|||||||
bottle = raw_bottle if merged == raw_bottle.git_user else replace(raw_bottle, git_user=merged)
|
bottle = raw_bottle if merged == raw_bottle.git_user else replace(raw_bottle, git_user=merged)
|
||||||
return Manifest(agent=agent, bottle=bottle)
|
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 .manifest_schema import validate_agent_frontmatter_keys
|
||||||
from .yaml_subset import YamlSubsetError, parse_frontmatter
|
from .yaml_subset import YamlSubsetError, parse_frontmatter
|
||||||
|
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ def _merge_two_bottles_runtime(base: "ManifestBottle", override: "ManifestBottle
|
|||||||
for n in merged_repos_names
|
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)
|
merged_egress = ManifestEgressConfig(routes=merged_routes, Log=override.egress.Log)
|
||||||
|
|
||||||
return ManifestBottle(
|
return ManifestBottle(
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ from __future__ import annotations
|
|||||||
|
|
||||||
import os
|
import os
|
||||||
import unittest
|
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.start as start_mod
|
||||||
import bot_bottle.cli.tui as tui_mod
|
import bot_bottle.cli.tui as tui_mod
|
||||||
|
|||||||
+10
-12
@@ -8,9 +8,13 @@ a real curses session (which requires a TTY).
|
|||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import unittest
|
import unittest
|
||||||
|
from typing import Any, Optional
|
||||||
|
|
||||||
from bot_bottle.cli.tui import _filter_items, _multiselect_loop, filter_multiselect, filter_select
|
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):
|
class TestFilterItems(unittest.TestCase):
|
||||||
def setUp(self):
|
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]]:
|
def _run(self, keys: list[int], items: list[str], initial: list[str]) -> Optional[list[str]]:
|
||||||
"""Run _multiselect_loop with a synthetic screen feeding `keys`."""
|
"""Run _multiselect_loop with a synthetic screen feeding `keys`."""
|
||||||
import curses as _curses
|
|
||||||
|
|
||||||
key_iter = iter(keys)
|
key_iter = iter(keys)
|
||||||
|
|
||||||
class FakeScreen:
|
class FakeScreen:
|
||||||
def erase(self): pass
|
def erase(self) -> None: pass
|
||||||
def getmaxyx(self): return (40, 80)
|
def getmaxyx(self) -> tuple[int, int]: return (40, 80)
|
||||||
def refresh(self): pass
|
def refresh(self) -> None: pass
|
||||||
def getch(self):
|
def getch(self) -> int: return next(key_iter)
|
||||||
return next(key_iter)
|
def addstr(self, *a: Any) -> None: pass
|
||||||
def addstr(self, *a, **kw): pass
|
def keypad(self, *a: Any) -> None: pass
|
||||||
def keypad(self, *a): pass
|
|
||||||
|
|
||||||
return _multiselect_loop(FakeScreen(), items, title="", initial=initial) # type: ignore[arg-type]
|
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)
|
self.assertEqual(["a", "b"], result)
|
||||||
|
|
||||||
|
|
||||||
from typing import Optional
|
|
||||||
_KEY_ESC = 27
|
|
||||||
_KEY_CTRL_D = 4
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|||||||
@@ -17,11 +17,11 @@ from bot_bottle.manifest import ManifestBottle, ManifestError, ManifestIndex
|
|||||||
from bot_bottle.manifest_extends import merge_bottles_runtime
|
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})
|
return ManifestIndex.from_json_obj({"bottles": bottles, "agents": agents})
|
||||||
|
|
||||||
|
|
||||||
def _bottle(**kwargs) -> ManifestBottle:
|
def _bottle(**kwargs: object) -> ManifestBottle:
|
||||||
return ManifestBottle.from_dict("test", kwargs)
|
return ManifestBottle.from_dict("test", kwargs)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user