Accept list and ndarray for show(figsize=...)#646
Merged
Conversation
Validator only accepted tuple, rejecting the idiomatic figsize=[w, h] and programmatically built numpy arrays. matplotlib accepts both, so the restriction was unnecessary friction.
- Drop `numbers.Real` dependency; use `int | float` to match the existing idiom in `_validate_show_parameters`. - Inline the sequence-type check; tighten error message. - Test `_validate_show_parameters` directly so the reject cases skip fixture setup and rendering (drops runtime from ~4s to <0.1s).
Per maintainer preference, omit the parametrized validator tests.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #646 +/- ##
=======================================
Coverage 76.35% 76.35%
=======================================
Files 11 11
Lines 3239 3239
Branches 762 762
=======================================
Hits 2473 2473
Misses 467 467
Partials 299 299
🚀 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
_validate_show_parametersrejectedfigsize=[w, h]andnp.array([w, h])even though matplotlib accepts both. Closes show(figsize=[10, 6]) raises TypeError — only tuples accepted, not lists or arrays #626.numbers.Real(booleans excluded), with a clearer error message for invalid inputs.