Skip to content
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

Improve Label and MultiLabel __str__ and __repr__ #2202

Merged
merged 3 commits into from Feb 17, 2022

Conversation

ZanSara
Copy link
Contributor

@ZanSara ZanSara commented Feb 17, 2022

Due to the @dataclass decorator and the use of asdict() in MultiLabel, its __repr__ and __str__ were often looking like empty dictionaries.

This PR fixes the empty representation of MultiLabel and also adds a small prefix to the __str__ of both MultiLabel and Label, in such a way that the two outputs are distinguishable.

Closes #1972

Copy link
Member

@mathislucka mathislucka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, this looks good :)

@ZanSara ZanSara merged commit c93b365 into master Feb 17, 2022
@ZanSara ZanSara deleted the str_and_repr_of_multilabel branch February 17, 2022 15:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic:labelling type:bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

__str__ and __repr__ not ideal in MultiLabel dataclass
2 participants