Fix unformatted placeholders in secondary_y and output_type error messages - #5772
Open
David-Wu1119 wants to merge 3 commits into
Open
David-Wu1119 wants to merge 3 commits into
David-Wu1119 wants to merge 3 commits into
Conversation
The error raised when adding a trace with `secondary_y=True` to a subplot
that was not created with the `secondary_y` spec, and the error raised for
an invalid `output_type` in `plotly.io.from_json`/`read_json`, were plain
strings that were never formatted, so users saw the literal
"{subplot_type}", "({row}, {col})" and "{output_type}". Format them like
the neighbouring messages in the same functions already do.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
camdecoster
requested changes
Sep 23, 2026
camdecoster
left a comment
Contributor
There was a problem hiding this comment.
Thanks for the PR! Could you please convert these to f-strings? Also, please remove the tests you added. They aren't needed. We also won't update the changelog for a change like this, so could you please revert that change?
Per review: format the two messages with f-strings instead of str.format(), and remove the added tests and CHANGELOG entry. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Author
|
Thanks @camdecoster! Done in dd7cdd4: switched both messages to f-strings and removed the tests and the changelog entry, so the diff is now just the two lines in |
This branch has not been deployed
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.
Link to issue
No existing issue. I searched for both messages and found none.
Description of change
Two
ValueErrormessages were never formatted, so users see the raw placeholders:This PR makes both messages f-strings. After the change they read
Subplot with type 'xy' at grid position (1, 2) was not ...andInvalid output type: Bogus.Testing strategy
No new tests or changelog entry, per review. Checked by hand that both messages now read
Subplot with type 'xy' at grid position (1, 2) was not ...andInvalid output type: Bogus.tests/test_core/test_subplots/andtests/test_io/test_to_from_json.pypass (106 tests), andruff format --checkandruff checkwith the pinned 0.11.12 pass on the changed files.Guidelines
Found with a scan for string literals that contain
{name}placeholders but are never formatted; written with AI assistance.🤖 Generated with Claude Code