Skip to content

Commit 798aeeb

Browse files
DOC Ensures that available_if passes numpydoc validation (#24586)
Co-authored-by: Thomas J. Fan <thomasjpfan@gmail.com>
1 parent aca8f20 commit 798aeeb

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

sklearn/tests/test_docstrings.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
"sklearn.utils.fixes.threadpool_limits",
2626
"sklearn.utils.gen_batches",
2727
"sklearn.utils.gen_even_slices",
28-
"sklearn.utils.metaestimators.available_if",
2928
"sklearn.utils.metaestimators.if_delegate_has_method",
3029
]
3130
FUNCTION_DOCSTRING_IGNORE_LIST = set(FUNCTION_DOCSTRING_IGNORE_LIST)

sklearn/utils/metaestimators.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ def out(*args, **kwargs):
141141

142142

143143
def available_if(check):
144-
"""An attribute that is available only if check returns a truthy value
144+
"""An attribute that is available only if check returns a truthy value.
145145
146146
Parameters
147147
----------
@@ -150,6 +150,12 @@ def available_if(check):
150150
a truthy value if the attribute is available, and either return False
151151
or raise an AttributeError if not available.
152152
153+
Returns
154+
-------
155+
callable
156+
Callable makes the decorated method available if `check` returns
157+
a truthy value, otherwise the decorated method is unavailable.
158+
153159
Examples
154160
--------
155161
>>> from sklearn.utils.metaestimators import available_if

0 commit comments

Comments
 (0)