{{ message }}
Fix return type of pyplot.subplot_tool / NavigationToolbar2.configure_subplots#31996
Closed
karlhillx wants to merge 1 commit into
Closed
Fix return type of pyplot.subplot_tool / NavigationToolbar2.configure_subplots#31996karlhillx wants to merge 1 commit into
karlhillx wants to merge 1 commit into
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates Matplotlib’s public typing and documentation around pyplot.subplot_tool() / NavigationToolbar2.configure_subplots() to match real backend behavior (widgets returns SubplotTool, Qt returns a Qt dialog, toolmanager returns None), without changing runtime behavior.
Changes:
- Widen
pyplot.subplot_tool()return annotation toAnyand update its docstring to describe the backend-dependent return value. - Widen the stubbed return type of
NavigationToolbar2.configure_subplots()toAnyinbackend_bases.pyi.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| lib/matplotlib/pyplot.py | Updates subplot_tool() return type annotation and expands the docstring to document backend-dependent return values. |
| lib/matplotlib/backend_bases.pyi | Updates the public stub signature of NavigationToolbar2.configure_subplots() to return Any. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…re_subplots to Any Per timhoffm on matplotlib#31979. The Qt backends return QDialog subclasses and the toolmanager branch already returns None, so the prior annotation was misleading. Update docstring to describe the backend-dependent return value. Also drop the now-unused TYPE_CHECKING import of SubplotTool and alphabetize the typing import. Closes matplotlib#31979
71587ed to
ed03cea
Compare
Author
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.

Widen the return annotation of
pyplot.subplot_toolandNavigationToolbar2.configure_subplotsfromSubplotTool | NonetoAny. The Qt backends return aQDialogand the toolmanager branch already returnsNone, so the annotations were misleading. Direction per timhoffm on #31979. Docstring updated to describe the backend-dependent return value.Also drop the now-unused
TYPE_CHECKINGimport ofSubplotTool, and alphabetize thetypingimport.Closes #31979