You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(types): add mypy type checking and fix 47 type errors (#716)
* fix(types): add mypy type checking and fix 47 type errors
- Add mypy to pre-commit hook (runs on src/ and pyproject.toml changes)
- Fix python_version 3.11 → 3.13 in mypy config to match requires-python
- Add mypy_path = "src" for correct src-layout module resolution
- Add jq to mypy ignore_missing_imports (Windows ARM64 conditional dep)
Type fixes across 12 files:
- auth/provider.py: fix OAuth error literals (invalid_client→invalid_request,
server_error→invalid_client); preserve None for optional PKCE code_challenge
- client/rest_client.py: type payload dict, add fallback return after retry loop
- tools/backup.py: assert ws_client not None after error checks
- tools/tools_areas.py: remove duplicate type annotations in if/else branches
- tools/tools_config_dashboards.py: fix Traversable variable conflict, use cast
instead of assert for jq_result narrowing
- tools/tools_config_automations.py: cast Any return to dict[str, Any]
- tools/tools_traces.py: str() cast on return, type sort_key function
- tools/tools_service.py, tools_addons.py, tools_mcp_component.py, backup.py:
add missing **kwargs: Any annotations
- server.py: cast Any-returning methods, fix list|dict return type
- __main__.py: replace Any with specific types (HomeAssistantOAuthProvider,
HomeAssistantClient, Settings, Coroutine) via TYPE_CHECKING imports
* Update src/ha_mcp/tools/tools_mcp_component.py
0 commit comments