fix(types): resolve all 427 mypy errors#40
Merged
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
class FooMixin(_OpenNMSBase):across all 49 mixins — mypy now sees_get/_post/etc. through the MROparam: str = None→param: Optional[str] = Nonedict[str, Any]literals (14 errors): explicit type annotation on mixed int/str params dictstypes-requests(3 errors): added to dev depsAlso removes
_OpenNMSBasefromclient.py's explicit base list (it now arrives through every mixin, eliminating the MRO conflict) and widensform_datatoOptional[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