Repository navigation
Conversation
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.
When
BoxList.to_json(multiline=True)is called without a filename, it currently returns a JSON array instead of one JSON value per line. Likewise,BoxList.from_json(json_string, multiline=True)ignores the flag and raisesJSONDecodeError: Extra datafor multiple JSON lines. Both operations already work with files.This change honors
multiline=Truefor string input and output, matching the existing file behavior, including blank/comment lines and universal newlines. The default JSON array behavior stays unchanged.Added 15 regression cases covering empty input, mixed values, Unicode line separators, CR/LF/CRLF, comments, JSON options, invalid JSON, and default array behavior. On the original code, 11 fail and 4 pass.
Validation on Windows / Python 3.12.14:
python -X utf8 -m pytest --cov=box -q: 174 passed, 92% total coverage. UTF-8 mode is needed for an existing TOML fixture on this Windows installation.mypy box: success (8 source files).git diff --checkpasses.Includes changelog and contributor credit as requested by CONTRIBUTING.rst. Targets
develop.Prepared with Codex (GPT-6) assistance.