-
-
Notifications
You must be signed in to change notification settings - Fork 19.1k
STY: ignore mypy errors #62482
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
STY: ignore mypy errors #62482
Conversation
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 for doing this. When we have mypy
errors, we try to include text of the mypy error in a comment, so there is a few places where you need to add those.
value.asi8, # type: ignore[attr-defined] | ||
) | ||
|
||
node = getattr(self.group, key) | ||
# error: Item "ExtensionArray" of "Union[Any, ExtensionArray]" has no | ||
# attribute "tz" | ||
node._v_attrs.tz = _get_tz(value.tz) # type: ignore[union-attr] | ||
node._v_attrs.tz = _get_tz(value.tz) # type: ignore[attr-defined] |
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.
add mypy error in comments (both places)
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.
done
pandas/core/algorithms.py
Outdated
values = cls._from_sequence(values, dtype=dtype) # type: ignore[assignment] | ||
|
||
else: | ||
values = values.astype(dtype, copy=False) | ||
values = values.astype(dtype, copy=False) # type: ignore[assignment] | ||
|
||
return values |
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 this can be fixed as follows. (and you can remove the comments in 218-219). Move the return values
statement after line 220 where it says values = cls.from_sequence ...
and after line 223 the values = values.astype...
statement so that it is no longer at the end of the function.
If mypy
still complains on either statement, you need to have a comment in there with the mypy
error (as in lines 218-219)
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 don't know If I've done what you asked, but ended up having these errors:
pandas/core/algorithms.py:232: error: Incompatible return value type (got "ExtensionArray", expected "ndarray[tuple[Any, ...], dtype[Any]]") [return-value]
pandas/core/algorithms.py:234: error: Incompatible return value type (got "ndarray[tuple[Any, ...], dtype[Any]]", expected "ExtensionArray") [return-value]
Check if the changes are correct please
# error: Unsupported target for indexed assignment ("Union[ndarray[Any, Any], | ||
# datetime64, timedelta64]") | ||
result[axis_mask] = iNaT # type: ignore[index] | ||
result[axis_mask] = iNaT |
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.
You can remove the comment here since you removed the ignore
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.
done
Co-authored-by: Irv Lustig <[email protected]>
Thanks @Alvaro-Kothe |
Owee, I'm MrMeeseeks, Look at me. There seem to be a conflict, please backport manually. Here are approximate instructions:
And apply the correct labels and milestones. Congratulations — you did some good work! Hopefully your backport PR will be tested by the continuous integration and merged soon! Remember to remove the If these instructions are inaccurate, feel free to suggest an improvement. |
I don't believe backporting is required because branch 2.3.x does not use the latest version of NumPy. Line 25 in 2ca088d
|
I'll let @mroeschke comment here, but I think backporting may be required because the CI requires the latest version of |
Indeed no need to backport (at the moment), the CI build on 2.3.x that runs linting is indeed pinned to numpy<2 as @Alvaro-Kothe mentions, so the typing errors are in general slightly different (and I don't think it is worth the effort to try to align that at this point) |
Co-authored-by: Irv Lustig <[email protected]>
I think this will make the CI green again.
The errors are because of a new version of numpy:
Original errors