API Deprecate if_delegate_has_method - #22830
Conversation
thomasjpfan
left a comment
There was a problem hiding this comment.
Thanks for the PR!
I think we need to add this to:
scikit-learn/doc/modules/classes.rst
Lines 1657 to 1658 in 09a7293
With "to be removed in 1.3".
| return lambda fn: _AvailableIfDescriptor(fn, check, attribute_name=fn.__name__) | ||
|
|
||
|
|
||
| # TODO remove in version 1.3 |
There was a problem hiding this comment.
How do you feel about adding a syntax for TODO items?
| # TODO remove in version 1.3 | |
| # TODO(1.3) Remove |
This would make these items easier to grep for.
There was a problem hiding this comment.
Anything that help finding these is good :)
| self.delegate_names = delegate_names | ||
|
|
||
| def _check(self, obj): | ||
| warnings.warn( |
There was a problem hiding this comment.
This raises a warning when the method if_delegate_has_method decorates is called. There is the edge case, where if the deprecated method never gets called then the user would not know if_delegate_has_method was deprecated. This is kind of consistent with how we deprecate functions.
The alternative is to deprecate when if_delegate_has_method gets called, i.e. when the method gets wrapped. WDYT?
There was a problem hiding this comment.
I hesitated but I found weird to have the deprecation warning when importing a module (where it's used to decorate a method for instance).
There was a problem hiding this comment.
I do not think this point is a blocker for this PR.
| self.delegate_names = delegate_names | ||
|
|
||
| def _check(self, obj): | ||
| warnings.warn( |
There was a problem hiding this comment.
I do not think this point is a blocker for this PR.
Fixes #20506
The decorator has been replaced by
available_ifeverywhere.