-
Notifications
You must be signed in to change notification settings - Fork 60
[ODSC-55947] Pretty print python fire output #793
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
Merged
VipulMascarenhas
merged 15 commits into
feature/aquav1.0.1
from
ODSC-55947/pretty_print_fire_output
Apr 22, 2024
Merged
[ODSC-55947] Pretty print python fire output #793
VipulMascarenhas
merged 15 commits into
feature/aquav1.0.1
from
ODSC-55947/pretty_print_fire_output
Apr 22, 2024
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
darenr
approved these changes
Apr 18, 2024
4c9c349 to
4a6bb03
Compare
Member
|
Can you please rebase the |
| Prints: | ||
| The string representation of each dataclass object. | ||
| """ | ||
| if isinstance(data, list): |
Member
Author
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.
@mayoor removed redundant __str__ check, just printing the object is enough.
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.
Description
There's a bug in python fire that causes the
__str__implementation of the dataclass to be ignored in case the result is a list of dataclasses. If the result is just one instance of dataclass and not a list, then__str__implementation works fine.We can use a custom serializer to make sure that the output is correctly updated.
Tests
ads aqua model listwith indent=4 in__str__, but NOT using serialize parameter forfire.Fire(). There are spaces in the output, but fire prints it in one line.ads aqua model listwith indent=4 in__str__, with serialize parameter forfire.Fire(). This will be the new output after the code changes in this PR.ads aqua model listwithout__str__function (this was commented out inserializer.py) but using serialize parameter forfire.Fire(). This will not be used, but added here to show the output of serialize function.