8000 CLN Make _NumPyAPIWrapper naming consistent to _ArrayAPIWrapper (#26039) · scikit-learn/scikit-learn@bdc5df9 · GitHub
[go: up one dir, main page]

Skip to content

Commit bdc5df9

Browse files
authored
CLN Make _NumPyAPIWrapper naming consistent to _ArrayAPIWrapper (#26039)
1 parent 19da1e2 commit bdc5df9

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

sklearn/utils/_array_api.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ def take(self, X, indices, *, axis):
4949
return self._namespace.stack(selected, axis=axis)
5050

5151

52-
class _NumPyApiWrapper:
52+
class _NumPyAPIWrapper:
5353
"""Array API compat wrapper for any numpy version
5454
5555
NumPy < 1.22 does not expose the numpy.array_api namespace. This
@@ -98,7 +98,7 @@ def get_namespace(*arrays):
9898
See: https://numpy.org/neps/nep-0047-array-api-standard.html
9999
100100
If `arrays` are regular numpy arrays, an instance of the
101-
`_NumPyApiWrapper` compatibility wrapper is returned instead.
101+
`_NumPyAPIWrapper` compatibility wrapper is returned instead.
102102
103103
Namespace support is not enabled by default. To enabled it
104104
call:
@@ -110,7 +110,7 @@ def get_namespace(*arrays):
110110
with sklearn.config_context(array_api_dispatch=True):
111111
# your code here
112112
113-
Otherwise an instance of the `_NumPyApiWrapper`
113+
Otherwise an instance of the `_NumPyAPIWrapper`
114114
compatibility wrapper is always returned irrespective of
115115
the fact that arrays implement the `__array_namespace__`
116116
protocol or not.
@@ -133,7 +133,7 @@ def get_namespace(*arrays):
133133
# Returns a tuple: (array_namespace, is_array_api)
134134

135135
if not get_config()["array_api_dispatch"]:
136-
return _NumPyApiWrapper(), False
136+
return _NumPyAPIWrapper(), False
137137

138138
namespaces = {
139139
x.__array_namespace__() if hasattr(x, "__array_namespace__") else None
@@ -152,7 +152,7 @@ def get_namespace(*arrays):
152152
(xp,) = namespaces
153153
if xp is None:
154154
# Use numpy as default
155-
return _NumPyApiWrapper(), False
155+
return _NumPyAPIWrapper(), False
156156

157157
return _ArrayAPIWrapper(xp), True
158158

sklearn/utils/tests/test_array_api.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
from sklearn.base import BaseEstimator
66
from sklearn.utils._array_api import get_namespace
7-
from sklearn.utils._array_api import _NumPyApiWrapper
7+
from sklearn.utils._array_api import _NumPyAPIWrapper
88
from sklearn.utils._array_api import _ArrayAPIWrapper
99
from sklearn.utils._array_api import _asarray_with_order
1010
from sklearn.utils._array_api import _convert_to_numpy
@@ -27,7 +27,7 @@ def test_get_namespace_ndarray():
2727
with config_context(array_api_dispatch=array_api_dispatch):
2828
xp_out, is_array_api = get_namespace(X_np)
2929
assert not is_array_api
30-
assert isinstance(xp_out, _NumPyApiWrapper)
30+
assert isinstance(xp_out, _NumPyAPIWrapper)
3131

3232

3333
def test_get_namespace_array_api():

0 commit comments

Comments
 (0)
0