Repository navigation
fix: use Colormap.with_extremes instead of set_bad, set_under and set_over - #263
Merged
Merged
Conversation
…_over Matplotlib has made Colormap.set_bad, set_under and set_over pending deprecation. idisp and showpixels now use with_extremes, which returns a copy. showpixels called set_bad on the colormap it was given, so a Colormap object passed by the caller was changed; it no longer is. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 0 |
| Duplication | 0 |
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.
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.
Fixes bug list items 12 and 24. Matplotlib has made
Colormap.set_bad,set_underandset_overpending deprecation ("Usecmap.with_extremes(bad=...)orColormap(bad=...)instead").idisp(base/imageio.py) sets the under, over and bad colors with onecmap.with_extremes(...)call, and only for the colors that were given. It no longer needscopy.copy, becausewith_extremesreturns a copy.Image.showpixels(ImageIO.py) usescmap.with_extremes(bad=badcolor).showpixelscalledset_badon the colormap it was given, so aColormapobject passed by the caller was changed. It no longer is.Tests, which all fail on the old code:
showpixels(badcolor=)andidisp(undercolor=, overcolor=, badcolor=)raise noPendingDeprecationWarningand set the colors, andshowpixelsleaves the caller's colormap alone. mypy reports no issues and the full suite passes (2161 passed, 33 skipped).AI-assisted: written with Claude Code (Claude Sonnet 5.5) and reviewed by the maintainer.
🤖 Generated with Claude Code