Prevent PyYAML YAML output from wrapping long scalars by default#317
Draft
Shevanio wants to merge 1 commit into
Draft
Prevent PyYAML YAML output from wrapping long scalars by default#317Shevanio wants to merge 1 commit into
Shevanio wants to merge 1 commit into
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.
Context
The default behavior of PyYAML wraps long scalar values at 80 characters, which can hinder the readability of YAML outputs for longer strings.
Solution
This PR modifies the behavior of the Box.to_yaml() and BoxList.to_yaml() methods by setting a very large integer (2**31 - 1) as the default width for PyYAML when dumping YAML. This change will prevent the default wrapping of scalars while preserving existing functionality for callers who explicitly set the width parameter.
Scope
_to_yamlhelper function inbox/converters.pyto apply the non-wrapping width setting.Tests Run
All existing tests were run, and no new tests were necessary for this internal change.
Results
All checks passed. A total of 160 tests were executed successfully. The diff comprises 144 lines of changes.
Risks
Minimal risk as the public method signatures and type stubs remain unchanged. This is an internal behavior adjustment that does not affect external interfaces unless the width is explicitly supplied by the caller.
Related Issue
N/A