5
5
particular, type promotion rules are different (the standard has no
6
6
value-based casting). The standard also specifies a more limited subset of
7
7
array methods and functionalities than are implemented on ndarray. Since the
8
- goal of the array_api namespace is to be a minimal implementation of the array
9
- API standard, we need to define a separate wrapper class for the array_api
8
+ goal of the array_api_strict namespace is to be a minimal implementation of the array
9
+ API standard, we need to define a separate wrapper class for the array_api_strict
10
10
namespace.
11
11
12
12
The standard compliant class is only a wrapper class. It is *not* a subclass
@@ -73,7 +73,7 @@ def _new(cls, x, /):
73
73
This is a private method for initializing the array API Array
74
74
object.
75
75
76
- Functions outside of the array_api submodule should not use this
76
+ Functions outside of the array_api_strict module should not use this
77
77
method. Use one of the creation functions instead, such as
78
78
``asarray``.
79
79
@@ -86,7 +86,7 @@ def _new(cls, x, /):
86
86
_dtype = _DType (x .dtype )
87
87
if _dtype not in _all_dtypes :
88
88
raise TypeError (
89
- f"The array_api namespace does not support the dtype '{ x .dtype } '"
89
+ f"The array_api_strict namespace does not support the dtype '{ x .dtype } '"
90
90
)
91
91
obj ._array = x
92
92
obj ._dtype = _dtype
@@ -95,7 +95,7 @@ def _new(cls, x, /):
95
95
# Prevent Array() from working
96
96
def __new__ (cls , * args , ** kwargs ):
97
97
raise TypeError (
98
- "The array_api Array object should not be instantiated directly. Use an array creation function, such as asarray(), instead."
98
+ "The array_api_strict Array object should not be instantiated directly. Use an array creation function, such as asarray(), instead."
99
99
)
100
100
101
101
# These functions are not required by the spec, but are implemented for
@@ -121,7 +121,7 @@ def __repr__(self: Array, /) -> str:
121
121
return prefix + mid + suffix
122
122
123
123
# This function is not required by the spec, but we implement it here for
124
- # convenience so that np.asarray(np.array_api .Array) will work.
124
+ # convenience so that np.asarray(array_api_strict .Array) will work.
125
125
def __array__ (self , dtype : None | np .dtype [Any ] = None ) -> npt .NDArray [Any ]:
126
126
"""
127
127
Warning: this method is NOT part of the array API spec. Implementers
@@ -338,7 +338,7 @@ def _validate_index(self, key):
338
338
if i is not None :
339
339
nonexpanding_key .append (i )
340
340
if isinstance (i , np .ndarray ):
341
- raise IndexError ("Index arrays for np.array_api must be np.array_api arrays" )
341
+ raise IndexError ("Index arrays for array_api_strict must be array_api_strict arrays" )
342
342
if isinstance (i , Array ):
343
343
if i .dtype in _boolean_dtypes :
344
344
key_has_mask = True
@@ -471,7 +471,7 @@ def __array_namespace__(
471
471
if api_version is not None and not api_version .startswith ("2021." ):
472
472
raise ValueError (f"Unrecognized array API version: { api_version !r} " )
473
473
import array_api_strict
474
- return array_api
474
+ return array_api_strict
475
475
476
476
def __bool__ (self : Array , / ) -> bool :
477
477
"""
@@ -571,7 +571,7 @@ def __getitem__(
571
571
# docstring of _validate_index
572
572
self ._validate_index (key )
573
573
if isinstance (key , Array ):
574
- # Indexing self._array with array_api arrays can be erroneous
574
+ # Indexing self._array with array_api_strict arrays can be erroneous
575
575
key = key ._array
576
576
res = self ._array .__getitem__ (key )
577
577
return self ._new (res )
@@ -761,7 +761,7 @@ def __setitem__(
761
761
# docstring of _validate_index
762
762
self ._validate_index (key )
763
763
if isinstance (key , Array ):
764
- # Indexing self._array with array_api arrays can be erroneous
764
+ # Indexing self._array with array_api_strict arrays can be erroneous
765
765
key = key ._array
766
766
self ._array .__setitem__ (key , asarray (value )._array )
767
767
0 commit comments