8000 DOC Ensures that if_delegate_has_method passes numpydoc validation (#… · scikit-learn/scikit-learn@0c8820b · GitHub
[go: up one dir, main page]

Skip to content

Commit 0c8820b

Browse files
michparaglemaitrethomasjpfan
authored
DOC Ensures that if_delegate_has_method passes numpydoc validation (#24633)
Co-authored-by: Guillaume Lemaitre <g.lemaitre58@gmail.com> Co-authored-by: Thomas J. Fan <thomasjpfan@gmail.com>
1 parent aa7fd7a commit 0c8820b

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

sklearn/tests/test_docstrings.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313

1414
FUNCTION_DOCSTRING_IGNORE_LIST = [
1515
"sklearn.utils.extmath.fast_logdet",
16-
"sklearn.utils.metaestimators.if_delegate_has_method",
1716
]
1817
FUNCTION_DOCSTRING_IGNORE_LIST = set(FUNCTION_DOCSTRING_IGNORE_LIST)
1918

sklearn/utils/metaestimators.py

-4Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -142,22 +142,27 @@ def _check(self, obj):
142142

143143
# TODO(1.3) remove
144144
def if_delegate_has_method(delegate):
145-
"""Create a decorator for methods that are delegated to a sub-estimator
146-
147-
This enables ducktyping by hasattr returning True according to the
148-
sub-estimator.
145+
"""Create a decorator for methods that are delegated to a sub-estimator.
149146
150147
.. deprecated:: 1.3
151148
`if_delegate_has_method` is deprecated in version 1.1 and will be removed in
152149
version 1.3. Use `available_if` instead.
153150
151+
This enables ducktyping by hasattr returning True according to the
152+
sub-estimator.
153+
154154
Parameters
155155
----------
156156
delegate : str, list of str or tuple of str
157157
Name of the sub-estimator that can be accessed as an attribute of the
158158
base object. If a list or a tuple of names are provided, the first
159159
sub-estimator that is an attribute of the base object will be used.
160160
161+
Returns
162+
-------
163+
callable
164+
Callable makes the decorated method available if the delegate
165+
has a method with the same name as the decorated method.
161166
"""
162167
if isinstance(delegate, list):
163168
delegate = tuple(delegate)

0 commit comments

Comments
 (0)
0