-
-
Notifications
You must be signed in to change notification settings - Fork 26.5k
MNT Tags: quality of life improvements #30268
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
Conversation
Co-authored-by: Guillaume Lemaitre <[email protected]>
glemaitre
left a comment
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.
LGTM
doc/developers/develop.rst
Outdated
| tags.input_tags = tags_orig.input_tags | ||
| tags.target_tags = tags_orig.target_tags | ||
| tags.classifier_tags = tags_orig.classifier_tags | ||
| tags.regressor_tags = tags_orig.regressor_tags | ||
| tags.transformer_tags = tags_orig.transformer_tags |
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.
With MyTags(**asdict(tags_orig)) do we need to set all these afterwards?
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.
Yes, asdict goes recursive, which then makes tags.input_tags a dictionary instead of a InputTags instance.
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.
Can we either do:
tags = MyTags(**tags_org.__dict__)or: (Copied from the docs of asdict)
tags_org_dict = {field.name: getattr(tags_orig, field.name) for field in fields(tags_orig)}
tags = MyTags(**tags_org_dict)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.
They don't have a __dict__, but the second one works.
Co-authored-by: Guillaume Lemaitre <[email protected]>
Co-authored-by: Guillaume Lemaitre <[email protected]>
|
This removes the public(ish?) Would it make sense to add a trivial |
It is true that this one kind of public. I would be in favor of introducing an alias. @adrinjalali WDYT? |
|
That test is really for |
|
Makes sense to me, thanks -- forgot this was within-cycle! |
Fixes #30011
This adds tests, and makes it more clear on how to extend tags.
It also does the right check on whether
_more_tagsis implemented but__sklearn_tags__is missing.cc @glemaitre @thomasjpfan