Skip to content

Four more pose methods that said they always return a figure - #369

Merged
alexarje merged 1 commit into
masterfrom
mypy-tail-3
Aug 23, 2026
Merged

Four more pose methods that said they always return a figure#369
alexarje merged 1 commit into
masterfrom
mypy-tail-3

Conversation

@alexarje

Copy link
Copy Markdown
Contributor

Continuing the tail of #350. mypy 52 → 50, 682 tests pass.

The number understates this one. Annotating the six render_* helpers in _pose_visualize.py — which had no return annotations at all — first pushed the count up to 54, because four public methods in _pose.py declared -> MgFigure while receiving MgFigure | None from them.

So pose_waterfall(), pose_segments(), pose_center() and pose_distance() have always been able to return None — on too few frames, or an empty render — and have always said otherwise. Same shape as the nine audio methods corrected in 1.13.0: the code was right, the description was wrong. Signatures and docstrings now agree with it.

Two inference fixes in the same file:

  • points.append(None) is deliberate, recording a keypoint below the confidence threshold as absent. The list was inferred list[tuple[int, int]] from its first append, so the intended None was flagged as the error.
  • _trail is a deque or None depending on whether marker history was requested, unannotated at three sites.

Remaining after this: 50.

🤖 Generated with Claude Code

#350's tail: mypy 52 to 50, and the number understates it. Annotating the six
`render_*` helpers in `_pose_visualize.py`, which carried no return annotations
at all, first pushed the count UP to 54 --- because four public methods in
`_pose.py` declared `-> MgFigure` while receiving `MgFigure | None` from them.

So `pose_waterfall()`, `pose_segments()`, `pose_center()` and `pose_distance()`
have always been able to return None, on too few frames or an empty render, and
have always said otherwise. The same shape as the nine audio methods corrected
in 1.13.0: the code was right and the description was wrong. Signatures and
docstrings now agree with it.

Two inference fixes in the same file. `points.append(None)` is deliberate --- a
keypoint below the confidence threshold is recorded as absent --- but the list
was inferred `list[tuple[int, int]]` from its first append, so the intended
None was the error. And `_trail` is a deque or None depending on whether marker
history was asked for, unannotated at three sites.

682 tests pass, 4 skipped.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@alexarje
alexarje merged commit 3bcd057 into master Aug 23, 2026
12 checks passed
@alexarje
alexarje deleted the mypy-tail-3 branch August 23, 2026 14:04
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.

1 participant