55particular, type promotion rules are different (the standard has no
66value-based casting). The standard also specifies a more limited subset of
77array 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
1010namespace.
1111
1212The standard compliant class is only a wrapper class. It is *not* a subclass
@@ -73,7 +73,7 @@ def _new(cls, x, /):
7373 This is a private method for initializing the array API Array
7474 object.
7575
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
7777 method. Use one of the creation functions instead, such as
7878 ``asarray``.
7979
@@ -86,7 +86,7 @@ def _new(cls, x, /):
8686 _dtype = _DType (x .dtype )
8787 if _dtype not in _all_dtypes :
8888 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 } '"
9090 )
9191 obj ._array = x
9292 obj ._dtype = _dtype
@@ -95,7 +95,7 @@ def _new(cls, x, /):
9595 # Prevent Array() from working
9696 def __new__ (cls , * args , ** kwargs ):
9797 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."
9999 )
100100
101101 # These functions are not required by the spec, but are implemented for
@@ -121,7 +121,7 @@ def __repr__(self: Array, /) -> str:
121121 return prefix + mid + suffix
122122
123123 # 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.
125125 def __array__ (self , dtype : None | np .dtype [Any ] = None ) -> npt .NDArray [Any ]:
126126 """
127127 Warning: this method is NOT part of the array API spec. Implementers
@@ -338,7 +338,7 @@ def _validate_index(self, key):
338338 if i is not None :
339339 nonexpanding_key .append (i )
340340 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" )
342342 if isinstance (i , Array ):
343343 if i .dtype in _boolean_dtypes :
344344 key_has_mask = True
@@ -471,7 +471,7 @@ def __array_namespace__(
471471 if api_version is not None and not api_version .startswith ("2021." ):
472472 raise ValueError (f"Unrecognized array API version: { api_version !r} " )
473473 import array_api_strict
474- return array_api
474+ return array_api_strict
475475
476476 def __bool__ (self : Array , / ) -> bool :
477477 """
@@ -571,7 +571,7 @@ def __getitem__(
571571 # docstring of _validate_index
572572 self ._validate_index (key )
573573 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
575575 key = key ._array
576576 res = self ._array .__getitem__ (key )
577577 return self ._new (res )
@@ -761,7 +761,7 @@ def __setitem__(
761761 # docstring of _validate_index
762762 self ._validate_index (key )
763763 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
765765 key = key ._array
766766 self ._array .__setitem__ (key , asarray (value )._array )
767767
0 commit comments