-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Upgrade mypy to 1.17.1 and fix all type errors #10694
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Conversation
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
- Update mypy from 1.15 to 1.17.1 in CI requirements - Fix 65 mypy errors across 20 files to achieve zero errors - Key fixes: - Remove obsolete type: ignore comments - Fix pandas MultiIndex type compatibility (list conversions) - Resolve dictionary key type issues (Hashable vs str) - Add type annotations for better type inference - Fix scipy/pandas interface compatibility in tests - Correct Variable.data setter override placement All changes are minimal type annotation improvements without logic modifications. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
Keep pd.Index objects instead of converting to lists to preserve dtype behavior in MultiIndex levels.
CI environment may report some type: ignore comments as unused while they're needed locally. Adding unused-ignore to suppress these warnings.
- Added types-requests to CI dependencies to provide typing for requests module - Removed type: ignore comments that were showing as unused both locally and in CI - Kept only the type: ignore that are actually necessary (one in test_plot.py)
The CI environment showed different mypy behavior than local environment, requiring us to keep these type: ignore comments with unused-ignore flag
- Add type: ignore for indexes.py indexing operation - Add type: ignore for alignment.py return type issues - Add type: ignore for cftimeindex.py shift method override
- Change level_coords_dtype type from dict[str, Any] to dict[Hashable | None, Any] - This matches pandas MultiIndex.names which can be Hashable or None - Remove unnecessary str() conversions added in previous commit - Remove obsolete type: ignore comment and TODO that questioned if Hashables are ok (they are) This is a cleaner solution that better reflects the actual pandas API.
for more information, see https://pre-commit.ci
- Changed return type from list[str] | None to list[Hashable | None] | None - This matches pandas MultiIndex.names actual type (list[Hashable | None]) - Removed unnecessary str() conversion that was losing type information - Now returns list(index.names) directly, preserving the correct types
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
CI
Continuous Integration tools
dependencies
Pull requests that update a dependency file
topic-CF conventions
topic-cftime
topic-groupby
topic-indexing
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
Changes
Core Library Fixes (10 files)
type: ignorecommentsTest File Fixes (10 files)
Testing
Success: no issues found in 193 source files🤖 Generated with Claude Code