Skip to content

chore: annotate ImageIO - #260

Merged
petercorke merged 2 commits into
mainfrom
chore/types-imageio
Nov 23, 2026
Merged

petercorke merged 2 commits into
mainfrom
chore/types-imageio

Conversation

@petercorke

Copy link
Copy Markdown
Owner

Annotates ImageIO.py, the last library file in the type-hint work of Issue 60 (7 of 39 parameters and 1 of 15 returns were unannotated). The bin/ command-line scripts are left as they are, since they are not part of the public API. Annotation and docstring changes only, no behaviour change.

  • showwindow(h: int, ax: Axes | None = None), the Window helper class it returns (h, ax, and image: ImageMixinBase | None) and the stereo Cursor class in stdisp (ax: Axes, ax2: Axes, returns None) are typed. image is the ImageMixinBase, which has _A, because the mixin passes itself.
  • The mixin class has a docstring, and a :type h: int line that the signature now gives is removed.
  • The empty if TYPE_CHECKING: pass block, and the import it made unused, are removed.

I left alone the 7 :seealso: fields and 7 Example: blocks, which AGENTS.md says to migrate gradually. ruff check reports one unused variable (y in Cursor.on_mouse_move) that was there before and is not part of this change.

With this, parameter annotations across src/machinevisiontoolbox go from 86.1% (Issue 60, 2026-10-17) to 95.2%, and returns from 92.7% to 96.2%, counting the PRs that have merged or are queued. What is left is the bin/ scripts.

mypy reports no issues and the full suite passes (2158 passed, 33 skipped).

AI-assisted: written with Claude Code (Claude Sonnet 5.5) and reviewed by the maintainer.

🤖 Generated with Claude Code

Part of Issue 60. Types showwindow(h, ax), the Window helper class and the
stereo Cursor class, and gives the mixin a docstring. Drops a :type: line that
the signature now gives.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 0 complexity · 0 duplication

Metric Results
Complexity 0
Duplication 0

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@petercorke
petercorke merged commit 2c51800 into main Nov 23, 2026
34 checks passed
@petercorke
petercorke deleted the chore/types-imageio branch November 23, 2026 09:37
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