-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Add array_ok to SubplotidValidator, used in pie.legend #5465
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
my-tien
commented
Jan 12, 2026
FYI @camdecoster @emilykl
@camdecoster
camdecoster
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good, but there a few small changes to make. Thanks for the PR!
_plotly_utils/basevalidators.py
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it would make more sense to refactor this function to just check if the given input is a valid id. Then you could reference that in the if/then block. It feels weird to define invalid_els for the single value case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did it like this because the return value is already used for the coercion result. (e.g. legend1 → legend). I changed it to return a tuple (coercion result, success) now, maybe this is clearer? Let me know what you think.
While doing that, I noticed that the coercion wasn't actually tested. I added a test for this as well.
- added missing arrayOk in docstring - removed replaced description - Fixed indentation
- return success instead of writing into passed array
2461bc7 to
cef18a9
Compare
Uh oh!
There was an error while loading. Please reload this page.
Description
Update
SubplotidValidatorto handle arrays of values.Additional fix for closing #5463.
Changes
Handle arrays in
SubplotidValidatorAdded array_ok tests
Testing
Be on main
Run the following code:
Note that a
ValueErroris raisedSwitch to this branch
Run the same code again
Note that chart is rendered correctly
Disclaimer
I am required to add that...the software is provided "as is", without warranty of any kind, express or implied, including but not limited to the warranties of merchantability, fitness for a particular purpose and noninfringement. in no event shall the authors or copyright holders be liable for any claim, damages or other liability, whether in an action of contract, tort or otherwise, arising from, out of or in connection with the software or the use or other dealings in the software.