Skip to content

Commit d642532

Browse files
tbitcsoz-agent
andcommitted
fix: mypy — exclude gui from mypy, cast optimizer return type, remove unused ignore
- pyproject.toml: add exclude = ['src/specsmith/gui'] to [tool.mypy]; PySide6 is an optional extra not in the mypy environment so GUI classes that subclass Qt types caused false 'cannot subclass Any' errors - optimizer.py: cast entry['response'] to str to satisfy no-any-return - optimizer.py: remove unused # type: ignore[assignment] on _last_cache_cost Co-Authored-By: Oz <oz-agent@warp.dev>
1 parent 26fec19 commit d642532

2 files changed

Lines changed: 5 additions & 2 deletions

File tree

pyproject.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,9 @@ python_version = "3.10"
101101
strict = true
102102
warn_return_any = true
103103
warn_unused_configs = true
104+
# GUI package requires PySide6, an optional extra not available in the mypy
105+
# environment. Exclude it from type-checking to avoid false positives.
106+
exclude = ["src/specsmith/gui"]
104107

105108
[tool.pytest.ini_options]
106109
testpaths = ["tests"]

src/specsmith/agent/optimizer.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -417,7 +417,7 @@ def get(self, key: str) -> str | None:
417417
self._hits += 1
418418
self._tokens_saved += entry.get("tokens", 0)
419419
self._cost_saved += entry.get("cost", 0.0)
420-
return entry["response"]
420+
return str(entry["response"])
421421

422422
def set(
423423
self,
@@ -800,7 +800,7 @@ def post_call(
800800
self._report.cost_saved_usd += self._cache.cost_saved - getattr(
801801
self, "_last_cache_cost", 0.0
802802
)
803-
self._last_cache_cost: float = self._cache.cost_saved # type: ignore[assignment]
803+
self._last_cache_cost: float = self._cache.cost_saved
804804

805805
def report(self) -> OptimizationReport:
806806
"""Return the current session-level optimization report."""

0 commit comments

Comments
 (0)