cleanup: consolidate format helpers, add style parameter - #1858
Open
RawNuke wants to merge 1 commit into
Open
Conversation
Delete format_dict_to_string (0 callers, redundant with format_data_structure). Add style='compact' mode to format_data_structure that matches any_to_str output. Make any_to_str a thin alias for format_data_structure(style='compact'). Add table tests for both indented and compact styles. Closes kyegomez#1851 Signed-off-by: RawNuke <67506722+RawNuke@users.noreply.github.com>
|
Hello there, thank you for opening an PR ! 🙏🏻 The team was notified and they will get back to you asap. |
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.
What
Consolidates the four overlapping format helpers as described in #1851.
Changes
format_dict_to_string(31 lines, 0 callers) and its re-export fromswarms/utils/__init__.pystyleparameter toformat_data_structure:"indented"(default, existing behavior) and"compact"(matchesany_to_stroutput)any_to_stra thin alias that callsformat_data_structure(data, style="compact")— all 5+ call sites continue to work with no changesfunc_to_str.pyis left for thebase_toolcleanup since no live code reaches itany_to_strtests pass unchangedWhy
Two functions (
any_to_strandformat_data_structure) were used by different parts of the codebase to render the same kinds of objects, producing inconsistent output. Now there is one function with a predictable output format per style.How to test
26 tests pass.
If this helped, RawNuke welcomes sponsorship: https://github.com/sponsors/RawNuke