Skip to content

fix(types): resolve all 427 mypy errors#40

Merged
cnewkirk merged 4 commits into
mainfrom
fix/mypy-clean
Apr 30, 2026
Merged

fix(types): resolve all 427 mypy errors#40
cnewkirk merged 4 commits into
mainfrom
fix/mypy-clean

Conversation

@cnewkirk

Copy link
Copy Markdown
Owner

Summary

  • Mixin inheritance (321 errors): class FooMixin(_OpenNMSBase): across all 49 mixins — mypy now sees _get/_post/etc. through the MRO
  • Optional annotations (89 errors): param: str = Noneparam: Optional[str] = None
  • dict[str, Any] literals (14 errors): explicit type annotation on mixed int/str params dicts
  • types-requests (3 errors): added to dev deps

Also removes _OpenNMSBase from client.py's explicit base list (it now arrives through every mixin, eliminating the MRO conflict) and widens form_data to Optional[Any] to accept TypedDict arguments.

Result: mypy opennms_api_wrapper/Success: no issues found in 61 source files. 490 tests pass. Ruff clean.

🤖 Generated with Claude Code

Chance Newkirk and others added 4 commits April 29, 2026 16:55
Four change types:
- Mixin inheritance: class FooMixin(_OpenNMSBase) so mypy sees _get/_post etc.
- Optional annotations: param: str = None → param: Optional[str] = None
- dict[str, Any] literals: annotate mixed-type params dicts explicitly
- Widened form_data to Optional[Any] to accept TypedDict arguments

Also removes _OpenNMSBase from client.py explicit base list (now inherited
through all mixins, removing the MRO conflict) and adds types-requests to
dev deps.

490 tests pass. mypy exits 0 on 61 source files.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
dict[str, Any] subscript syntax requires 3.9+. Add
`from __future__ import annotations` to the 8 files that use it
so annotation evaluation is deferred and the package stays 3.8-compatible.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…s to pyproject

E402: from __future__ import annotations must follow the module docstring,
not precede it. Reorders the line in the 8 affected files.

Also pins types-requests in pyproject.toml dev deps so a fresh
`pip install -e ".[dev]"` provides the stubs that the mypy CI check needs.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@cnewkirk
cnewkirk merged commit a9b19ee into main Apr 30, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant