-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Add typing to test_plot.py #8889
Conversation
for more information, see https://pre-commit.ci
# nb. this function also matches meshes from pcolormesh | ||
return plt.gcf().findobj(mpl.collections.QuadMesh) | ||
return plt.gcf().findobj(mpl.collections.QuadMesh) # type: ignore[return-value] # mpl error? |
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 believe the typing for findobj
is wrong. Looks to me it mostly returns the same type as the input.
https://github.com/matplotlib/matplotlib/blob/78b6bdc04f89dafe4d157855a9023826cab8a0fd/lib/matplotlib/artist.pyi#L131-L135
Probably should be something like TypeVar("T_Artist", bound=Artist)
.
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.
cc @ksunden if you're still interested.
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.
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.
Nice, thank you @ksunden !
Enforce typing on all tests in
test_plot.py
and add the remaining type hints.