chore: enable strict mypy checks and fix pre-commit mypy hook
Add type annotations to all previously untyped functions and remove 9 suppressed error codes (call-arg, assignment, return-value, operator, has-type, dict-item, misc, list-item, annotation-unchecked) by fixing the underlying type issues. Add [[tool.mypy.overrides]] with ignore_missing_imports for KiCAD-specific modules (pcbnew, sexpdata, skip, cairosvg, kipy, PIL) so the pre-commit mypy hook passes in its isolated venv. Add types-requests and pytest to additional_dependencies in .pre-commit-config.yaml. Also fixes several real bugs uncovered by stricter checks: incorrect static calls to instance methods in swig_backend, wrong return type on get_size, missing value param in BoardAPI.place_component, variable shadowing in kicad_process.py, unqualified LibraryManager reference in kicad_interface, and missing top-level Path import. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -95,6 +95,8 @@ def _build_freerouting_cmd(
|
||||
"""Build the command to run Freerouting."""
|
||||
if use_docker:
|
||||
docker_exe = _find_docker()
|
||||
if docker_exe is None:
|
||||
raise RuntimeError("Docker/Podman executable not found")
|
||||
board_dir = os.path.dirname(dsn_path)
|
||||
dsn_name = os.path.basename(dsn_path)
|
||||
ses_name = os.path.basename(ses_path)
|
||||
@@ -120,6 +122,8 @@ def _build_freerouting_cmd(
|
||||
]
|
||||
else:
|
||||
java_exe = _find_java()
|
||||
if java_exe is None:
|
||||
raise RuntimeError("Java executable not found")
|
||||
return [
|
||||
java_exe,
|
||||
"-jar",
|
||||
@@ -136,7 +140,7 @@ def _build_freerouting_cmd(
|
||||
class FreeroutingCommands:
|
||||
"""Handles Freerouting autoroute operations."""
|
||||
|
||||
def __init__(self, board=None):
|
||||
def __init__(self, board: Any = None) -> None:
|
||||
self.board = board
|
||||
|
||||
def _resolve_execution_mode(self, jar_path: str) -> Dict[str, Any]:
|
||||
|
||||
Reference in New Issue
Block a user