-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
TYP: remove mypy ignore from array_manager.py #52249
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
mroeschke
merged 6 commits into
pandas-dev:main
from
natmokval:37715-remove-mypy-ignore
Mar 29, 2023
Merged
Changes from 4 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
4a9bcb6
TYP: remove ignore from array_manager.py
natmokval 90a5972
Merge branch 'main' into 37715-remove-mypy-ignore
natmokval ca58222
Merge branch 'main' into 37715-remove-mypy-ignore
natmokval 31287f0
TYP: remove ignore from array_manager.py II
natmokval c861a74
TYP: remove ignore from array_manager.py III
natmokval 73c4ad7
Merge branch 'main' into 37715-remove-mypy-ignore
natmokval File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you would need to change line 837 to
indices : range | np.ndarray = range(
Mypy uses early binding, the if block declares the variable for the first time with type
range
. When mypy parses the else block, it thinks the type should be range and not np.ndarray. I believe pyright doesn't do that (for each block it uses its own type and then uses the union after an if/else)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the comment. I did as you suggested.
Could it be the reason why locally I didn't have a failure in
test_dup_across_dtypes(self)
, but in ci there was an error in the same function in linepandas/tests/frame/test_nonunique_indexes.py:147:
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The type annotations shouldn't cause a test to fail at runtime. I'm not familiar with the test but I assume that the code changes from your previous commits might have changed the runtime behavior which triggered some tests to fail.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks, I get it. np.nonzero works much more effectively regarding time than my code changes.