Fix docstrings and remove dead code across public API#583
Merged
Conversation
Systematic audit of all public method docstrings against their implementations, fixing mismatches and removing dead/broken code. Docstring fixes: - Fix `norm` type/default in render_shapes, render_points (was `bool | Normalize, default False`, now `Normalize | None`) - Fix `palette` type across all render methods (add `dict[str, str]`) - Remove false claim that palette defaults to lightgray when groups given - Fix `cmap` description: continuous only, not discrete (render_shapes, render_points) - Fix `scale` description in render_shapes: applies to polygons too - Fix `method` description: "or" not "and", add >10k threshold - Fix `show()` return type: `Axes | list[Axes] | None`, not `sd.SpatialData` - Document all 13 missing `show()` parameters - Fix `render_labels` return type (was `None`) - Fix `render_points` return saying "shapes" (copy-paste) - Fix `render_labels` broadcasting example referencing render_images - Add Notes section to render_images: RGB auto-detection, compositing, cmap broadcast - Add type annotations to colorbar/colorbar_params across all methods - Fix `make_palette_from_data` color column lookup description - Fix OutlineParams docstring (was "Cmap params") - Fix typo "precendence" → "precedence" Dead code removal: - Remove `share_extent` from `show()` (accepted but never used) - Remove `na_color` from `render_images()` (no use case for images) - Remove `**kwargs` from `render_images()` (broken: crashed or was silently dropped) - Remove dead `transfunc` from `LabelsRenderParams` (stored but never read) - Remove vestigial `LabelsRenderParams.outline` field - Remove vestigial `ShapesRenderParams.contour_px` field New behavior: - Warn when user requests `colorbar=True` for 5+ channel images Related: #463, #582 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Change 5+ channel colorbar message to logger.info on auto mode only (explicit colorbar=True is not blocked) - Fix double periods in dataclass docstrings Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Align render_labels cmap/norm docstrings with shapes/points style - Remove misleading kwargs docstring entry from render_labels - Guard na_color processing in _type_check_params to skip images Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #583 +/- ##
==========================================
+ Coverage 76.28% 76.33% +0.05%
==========================================
Files 11 11
Lines 3259 3254 -5
Branches 756 756
==========================================
- Hits 2486 2484 -2
+ Misses 468 467 -1
+ Partials 305 303 -2
🚀 New features to boost your workflow:
|
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.
Summary
share_extent,render_images(**kwargs),render_images(na_color=...), deadtransfuncin labels, vestigial dataclass fieldscolorbar=Truefor 5+ channel imagesDocstring fixes
normtype/default (bool | Normalize, default False→Normalize | None)palettetype: adddict[str, str]cmap: "discrete or continuous" → continuous onlyscale: "circles" → "shapes (circles and polygons)"method: "and" → "or", add >10k thresholdshow()return type:sd.SpatialData→Axes | list[Axes] | Noneshow()parametersrender_labelsreturn type:None→sd.SpatialDatarender_pointsreturn: "shapes" → "points"colorbar/colorbar_paramstype annotationsmake_palette_from_datacolor lookup descriptionDead code removal
show(share_extent=...)render_images(na_color=...)set_bad()never triggers.render_images(**kwargs)_prepare_cmap_norm()which doesn't accept them (would crash).vmin/vmaxdeprecated 18 months ago.LabelsRenderParams.transfunc_render_labels()never reads it. Filed #582 for the broader transfunc inconsistency.LabelsRenderParams.outlineFalse, never set or read.ShapesRenderParams.contour_px