Repository navigation
chore: annotate Sources and document the ImageSource base class - #255
Merged
Merged
Conversation
Part of Issue 60. Annotates the remaining parameters and returns in Sources.py: __exit__, the nested display and key callbacks, tensor, disp, print and the ROS helpers. view_state is annotated dict[str, Any] so that mypy does not infer int values from the mixed literal. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Up to standards ✅🟢 Issues
|
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.
Annotates
Sources.py, the second largest gap in the type-hint work of Issue 60 (50 of 198 parameters and 17 of 200 returns were unannotated). Annotation and docstring changes only, no behaviour change.__exit__methods taketype[BaseException] | None,BaseException | NoneandTracebackType | None, and the one that took*_is typed too.ImageSource.tensor(normalize=)isstr | tuple[Any, Any] | None, matchingImage.tensor.disp(**kwargs),ROSBag.print(file=),_allowed,_stamp_to_nsand_resolve_typestoreare typed.dispfor images and for point clouds (_label,_make_overlay,_win_title,_update_cloud, theon_keyhandlers and the Open3D key callbacks_on_quit,_on_pause,_on_faster,_on_slower,_on_next,_mk_jump) have types. The Open3D callbacks returnbool, as the library expects.view_stateis annotateddict[str, Any]. mypy had inferreddict[str, int]from the mixed literal and then rejected passing itsfirstvalue as abool.ImageSourcehad no docstring, and gets one.I left alone the 24
:seealso:fields and 12Example:blocks, which AGENTS.md says to migrate gradually, and the methods with no docstring that are documented by their class (__init__,__iter__,__len__). Issue 150 plans to splitSources.pyinto a package; these annotations move with the code.mypy reports no issues and the full suite passes (2151 passed, 33 skipped).
AI-assisted: written with Claude Code (Claude Sonnet 5.5) and reviewed by the maintainer.
🤖 Generated with Claude Code