Add typing to graph/primitives.py#1875
Merged
mscuthbert merged 4 commits intomasterfrom Apr 22, 2026
Merged
Conversation
Adds type annotations throughout graph/primitives.py: - matplotlib.axes.Axes / matplotlib.figure.Figure for subplot/figure params (via TYPE_CHECKING import) - list | None for self.data; assert-narrowed in each renderSubplot - Proper types for all simple attributes (str, int, float, bool, dict, etc.) - tuple[str, ...] annotations on keywordConfigurables in all subclasses - Return types on all methods - Fixed pre-existing issues: list-vs-tuple in set_xlim calls, dead xRange variable, span None guard in HorizontalBarWeighted - # type: ignore[attr-defined] for Axes3D.bar3d (mpl_toolkits lacks stubs) AI-assisted Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Replace all bare `assert self.figure/data/span is not None` with proper
`if x is None: raise ValueError('...')` guards followed by the assert
for mypy narrowing
- Restore `# type: ignore[attr-defined]` on Axes3D.bar3d call dropped in merge
AI-assisted
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
AI-assisted Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.
Adds lots of typing, but especially
matplotlib.axes.Axes/matplotlib.figure.Figuretype annotations to all subplot/figure parameters (imported underTYPE_CHECKING)# type: ignore[attr-defined]forAxes3D.bar3dsincempl_toolkitslacks type stubslistvstupleinset_xlimcalls, deadxRangevariable inGraphHorizontalBarWeighted,spanNone guard moved before its usegraph/plot.py(MRO type conflicts ondataandkeywordConfigurables)AI-assisted (Claude)