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:
@@ -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
|
||||
|
||||
+10
-12
@@ -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__":
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user