Skip to content

Add typing to graph/primitives.py#1875

Merged
mscuthbert merged 4 commits intomasterfrom
worktree-claude+graph-typing
Apr 22, 2026
Merged

Add typing to graph/primitives.py#1875
mscuthbert merged 4 commits intomasterfrom
worktree-claude+graph-typing

Conversation

@mscuthbert
Copy link
Copy Markdown
Member

@mscuthbert mscuthbert commented Apr 22, 2026

Adds lots of typing, but especially matplotlib.axes.Axes / matplotlib.figure.Figure type annotations to all subplot/figure parameters (imported under TYPE_CHECKING)

  • # type: ignore[attr-defined] for Axes3D.bar3d since mpl_toolkits lacks type stubs
  • Fixes pre-existing issues uncovered by mypy: list vs tuple in set_xlim calls, dead xRange variable in GraphHorizontalBarWeighted, span None guard moved before its use
  • Resolves 11 pre-existing mypy errors in graph/plot.py (MRO type conflicts on data and keywordConfigurables)

AI-assisted (Claude)

mscuthbert and others added 2 commits April 21, 2026 14:36
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>
@coveralls
Copy link
Copy Markdown

coveralls commented Apr 22, 2026

Coverage Status

coverage: 93.054% (-0.02%) from 93.071% — worktree-claude+graph-typing into master

mscuthbert and others added 2 commits April 21, 2026 15:11
- 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>
@mscuthbert mscuthbert merged commit 7e77707 into master Apr 22, 2026
8 checks passed
@mscuthbert mscuthbert deleted the worktree-claude+graph-typing branch April 22, 2026 01:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants