Skip to content

Commit a137bd8

Browse files
committed
Rename signatures module to array_api
1 parent f80d74a commit a137bd8

33 files changed

+65
-48
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
from .array_object import *
2+
from .constants import *
3+
from .creation_functions import *
4+
from .data_type_functions import *
5+
from .data_types import *
6+
from .elementwise_functions import *
7+
from .linear_algebra_functions import *
8+
from .manipulation_functions import *
9+
from .searching_functions import *
10+
from .set_functions import *
11+
from .sorting_functions import *
12+
from .statistical_functions import *
13+
from .utility_functions import *
14+
15+
#__all__ = ['Any', 'Device', 'Dtype', 'Enum', 'Optional', 'PyCapsule', 'Tuple', 'Union', '_types', 'abs', 'acos', 'acosh', 'add', 'all', 'annotations', 'any', 'arange', 'argmax', 'argmin', 'argsort', 'array', 'array_object', 'asarray', 'asin', 'asinh', 'astype', 'atan', 'atan2', 'atanh', 'bitwise_and', 'bitwise_invert', 'bitwise_left_shift', 'bitwise_or', 'bitwise_right_shift', 'bitwise_xor', 'broadcast_arrays', 'broadcast_to', 'can_cast', 'ceil', 'concat', 'constants', 'cos', 'cosh', 'creation_functions', 'data_type_functions', 'data_types', 'divide', 'dtype', 'e', 'elementwise_functions', 'ellipsis', 'empty', 'empty_like', 'equal', 'exp', 'expand_dims', 'expm1', 'eye', 'finfo', 'flip', 'floor', 'floor_divide', 'from_dlpack', 'full', 'full_like', 'greater', 'greater_equal', 'iinfo', 'inf', 'isfinite', 'isinf', 'isnan', 'less', 'less_equal', 'linear_algebra_functions', 'linspace', 'log', 'log10', 'log1p', 'log2', 'logaddexp', 'logical_and', 'logical_not', 'logical_or', 'logical_xor', 'manipulation_functions', 'matmul', 'matrix_transpose', 'max', 'mean', 'meshgrid', 'min', 'multiply', 'nan', 'negative', 'newaxis', 'nonzero', 'not_equal', 'ones', 'ones_like', 'permute_dims', 'pi', 'positive', 'pow', 'prod', 'remainder', 'reshape', 'result_type', 'roll', 'round', 'searching_functions', 'set_functions', 'sign', 'sin', 'sinh', 'sort', 'sorting_functions', 'sqrt', 'square', 'squeeze', 'stack', 'statistical_functions', 'std', 'subtract', 'sum', 'tan', 'tanh', 'tensordot', 'tril', 'triu', 'trunc', 'unique_all', 'unique_counts', 'unique_inverse', 'unique_values', 'utility_functions', 'var', 'vecdot', 'where', 'zeros', 'zeros_like']

spec/API_specification/signatures/array_object.py renamed to spec/API_specification/array_api/array_object.py

+27-25
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ def __abs__(self: array, /) -> array:
135135
136136
137137
.. note::
138-
Element-wise results must equal the results returned by the equivalent element-wise function :func:`~signatures.elementwise_functions.abs`.
138+
Element-wise results must equal the results returned by the equivalent element-wise function :func:`~array_api.elementwise_functions.abs`.
139139
"""
140140

141141
def __add__(self: array, other: Union[int, float, array], /) -> array:
@@ -181,7 +181,7 @@ def __add__(self: array, other: Union[int, float, array], /) -> array:
181181
182182
183183
.. note::
184-
Element-wise results must equal the results returned by the equivalent element-wise function :func:`~signatures.elementwise_functions.add`.
184+
Element-wise results must equal the results returned by the equivalent element-wise function :func:`~array_api.elementwise_functions.add`.
185185
"""
186186

187187
def __and__(self: array, other: Union[int, bool, array], /) -> array:
@@ -202,7 +202,7 @@ def __and__(self: array, other: Union[int, bool, array], /) -> array:
202202
203203
204204
.. note::
205-
Element-wise results must equal the results returned by the equivalent element-wise function :func:`~signatures.elementwise_functions.bitwise_and`.
205+
Element-wise results must equal the results returned by the equivalent element-wise function :func:`~array_api.elementwise_functions.bitwise_and`.
206206
"""
207207

208208
def __array_namespace__(self: array, /, *, api_version: Optional[str] = None) -> Any:
@@ -239,7 +239,7 @@ def __bool__(self: array, /) -> bool:
239239

240240
def __dlpack__(self: array, /, *, stream: Optional[Union[int, Any]] = None) -> PyCapsule:
241241
"""
242-
Exports the array for consumption by :func:`~signatures.creation_functions.from_dlpack` as a DLPack capsule.
242+
Exports the array for consumption by :func:`~array_api.creation_functions.from_dlpack` as a DLPack capsule.
243243
244244
Parameters
245245
----------
@@ -294,7 +294,7 @@ def __dlpack__(self: array, /, *, stream: Optional[Union[int, Any]] = None) -> P
294294

295295
def __dlpack_device__(self: array, /) -> Tuple[Enum, int]:
296296
"""
297-
Returns device type and device ID in DLPack format. Meant for use within :func:`~signatures.creation_functions.from_dlpack`.
297+
Returns device type and device ID in DLPack format. Meant for use within :func:`~array_api.creation_functions.from_dlpack`.
298298
299299
Parameters
300300
----------
@@ -336,7 +336,7 @@ def __eq__(self: array, other: Union[int, float, bool, array], /) -> array:
336336
337337
338338
.. note::
339-
Element-wise results must equal the results returned by the equivalent element-wise function :func:`~signatures.elementwise_functions.equal`.
339+
Element-wise results must equal the results returned by the equivalent element-wise function :func:`~array_api.elementwise_functions.equal`.
340340
"""
341341

342342
def __float__(self: array, /) -> float:
@@ -411,7 +411,7 @@ def __floordiv__(self: array, other: Union[int, float, array], /) -> array:
411411
412412
413413
.. note::
414-
Element-wise results must equal the results returned by the equivalent element-wise function :func:`~signatures.elementwise_functions.floor_divide`.
414+
Element-wise results must equal the results returned by the equivalent element-wise function :func:`~array_api.elementwise_functions.floor_divide`.
415415
"""
416416

417417
def __ge__(self: array, other: Union[int, float, array], /) -> array:
@@ -432,7 +432,7 @@ def __ge__(self: array, other: Union[int, float, array], /) -> array:
432432
433433
434434
.. note::
435-
Element-wise results must equal the results returned by the equivalent element-wise function :func:`~signatures.elementwise_functions.greater_equal`.
435+
Element-wise results must equal the results returned by the equivalent element-wise function :func:`~array_api.elementwise_functions.greater_equal`.
436436
"""
437437

438438
def __getitem__(self: array, key: Union[int, slice, ellipsis, Tuple[Union[int, slice, ellipsis], ...], array], /) -> array:
@@ -470,7 +470,7 @@ def __gt__(self: array, other: Union[int, float, array], /) -> array:
470470
471471
472472
.. note::
473-
Element-wise results must equal the results returned by the equivalent element-wise function :func:`~signatures.elementwise_functions.greater`.
473+
Element-wise results must equal the results returned by the equivalent element-wise function :func:`~array_api.elementwise_functions.greater`.
474474
"""
475475

476476
def __index__(self: array, /) -> int:
@@ -522,7 +522,7 @@ def __invert__(self: array, /) -> array:
522522
523523
524524
.. note::
525-
Element-wise results must equal the results returned by the equivalent element-wise function :func:`~signatures.elementwise_functions.bitwise_invert`.
525+
Element-wise results must equal the results returned by the equivalent element-wise function :func:`~array_api.elementwise_functions.bitwise_invert`.
526526
"""
527527

528528
def __le__(self: array, other: Union[int, float, array], /) -> array:
@@ -543,7 +543,7 @@ def __le__(self: array, other: Union[int, float, array], /) -> array:
543543
544544
545545
.. note::
546-
Element-wise results must equal the results returned by the equivalent element-wise function :func:`~signatures.elementwise_functions.less_equal`.
546+
Element-wise results must equal the results returned by the equivalent element-wise function :func:`~array_api.elementwise_functions.less_equal`.
547547
"""
548548

549549
def __lshift__(self: array, other: Union[int, array], /) -> array:
@@ -564,7 +564,7 @@ def __lshift__(self: array, other: Union[int, array], /) -> array:
564564
565565
566566
.. note::
567-
Element-wise results must equal the results returned by the equivalent element-wise function :func:`~signatures.elementwise_functions.bitwise_left_shift`.
567+
Element-wise results must equal the results returned by the equivalent element-wise function :func:`~array_api.elementwise_functions.bitwise_left_shift`.
568568
"""
569569

570570
def __lt__(self: array, other: Union[int, float, array], /) -> array:
@@ -585,7 +585,7 @@ def __lt__(self: array, other: Union[int, float, array], /) -> array:
585585
586586
587587
.. note::
588-
Element-wise results must equal the results returned by the equivalent element-wise function :func:`~signatures.elementwise_functions.less`.
588+
Element-wise results must equal the results returned by the equivalent element-wise function :func:`~array_api.elementwise_functions.less`.
589589
"""
590590

591591
def __matmul__(self: array, other: array, /) -> array:
@@ -616,7 +616,7 @@ def __matmul__(self: array, other: array, /) -> array:
616616
617617
618618
.. note::
619-
Results must equal the results returned by the equivalent function :func:`~signatures.linear_algebra_functions.matmul`.
619+
Results must equal the results returned by the equivalent function :func:`~array_api.linear_algebra_functions.matmul`.
620620
621621
**Raises**
622622
@@ -676,7 +676,7 @@ def __mod__(self: array, other: Union[int, float, array], /) -> array:
676676
677677
678678
.. note::
679-
Element-wise results must equal the results returned by the equivalent element-wise function :func:`~signatures.elementwise_functions.remainder`.
679+
Element-wise results must equal the results returned by the equivalent element-wise function :func:`~array_api.elementwise_functions.remainder`.
680680
"""
681681

682682
def __mul__(self: array, other: Union[int, float, array], /) -> array:
@@ -715,7 +715,7 @@ def __mul__(self: array, other: Union[int, float, array], /) -> array:
715715
716716
717717
.. note::
718-
Element-wise results must equal the results returned by the equivalent element-wise function :func:`~signatures.elementwise_functions.multiply`.
718+
Element-wise results must equal the results returned by the equivalent element-wise function :func:`~array_api.elementwise_functions.multiply`.
719719
"""
720720

721721
def __ne__(self: array, other: Union[int, float, bool, array], /) -> array:
@@ -736,7 +736,7 @@ def __ne__(self: array, other: Union[int, float, bool, array], /) -> array:
736736
737737
738738
.. note::
739-
Element-wise results must equal the results returned by the equivalent element-wise function :func:`~signatures.elementwise_functions.not_equal`.
739+
Element-wise results must equal the results returned by the equivalent element-wise function :func:`~array_api.elementwise_functions.not_equal`.
740740
"""
741741

742742
def __neg__(self: array, /) -> array:
@@ -758,7 +758,7 @@ def __neg__(self: array, /) -> array:
758758
759759
760760
.. note::
761-
Element-wise results must equal the results returned by the equivalent element-wise function :func:`~signatures.elementwise_functions.negative`.
761+
Element-wise results must equal the results returned by the equivalent element-wise function :func:`~array_api.elementwise_functions.negative`.
762762
"""
763763

764764
def __or__(self: array, other: Union[int, bool, array], /) -> array:
@@ -779,7 +779,7 @@ def __or__(self: array, other: Union[int, bool, array], /) -> array:
779779
780780
781781
.. note::
782-
Element-wise results must equal the results returned by the equivalent element-wise function :func:`~signatures.elementwise_functions.bitwise_or`.
782+
Element-wise results must equal the results returned by the equivalent element-wise function :func:`~array_api.elementwise_functions.bitwise_or`.
783783
"""
784784

785785
def __pos__(self: array, /) -> array:
@@ -798,7 +798,7 @@ def __pos__(self: array, /) -> array:
798798
799799
800800
.. note::
801-
Element-wise results must equal the results returned by the equivalent element-wise function :func:`~signatures.elementwise_functions.positive`.
801+
Element-wise results must equal the results returned by the equivalent element-wise function :func:`~array_api.elementwise_functions.positive`.
802802
"""
803803

804804
def __pow__(self: array, other: Union[int, float, array], /) -> array:
@@ -853,7 +853,7 @@ def __pow__(self: array, other: Union[int, float, array], /) -> array:
853853
854854
855855
.. note::
856-
Element-wise results must equal the results returned by the equivalent element-wise function :func:`~signatures.elementwise_functions.pow`.
856+
Element-wise results must equal the results returned by the equivalent element-wise function :func:`~array_api.elementwise_functions.pow`.
857857
"""
858858

859859
def __rshift__(self: array, other: Union[int, array], /) -> array:
@@ -874,7 +874,7 @@ def __rshift__(self: array, other: Union[int, array], /) -> array:
874874
875875
876876
.. note::
877-
Element-wise results must equal the results returned by the equivalent element-wise function :func:`~signatures.elementwise_functions.bitwise_right_shift`.
877+
Element-wise results must equal the results returned by the equivalent element-wise function :func:`~array_api.elementwise_functions.bitwise_right_shift`.
878878
"""
879879

880880
def __setitem__(self: array, key: Union[int, slice, ellipsis, Tuple[Union[int, slice, ellipsis], ...], array], value: Union[int, float, bool, array], /) -> None:
@@ -918,7 +918,7 @@ def __sub__(self: array, other: Union[int, float, array], /) -> array:
918918
919919
920920
.. note::
921-
Element-wise results must equal the results returned by the equivalent element-wise function :func:`~signatures.elementwise_functions.subtract`.
921+
Element-wise results must equal the results returned by the equivalent element-wise function :func:`~array_api.elementwise_functions.subtract`.
922922
"""
923923

924924
def __truediv__(self: array, other: Union[int, float, array], /) -> array:
@@ -971,7 +971,7 @@ def __truediv__(self: array, other: Union[int, float, array], /) -> array:
971971
972972
973973
.. note::
974-
Element-wise results must equal the results returned by the equivalent element-wise function :func:`~signatures.elementwise_functions.divide`.
974+
Element-wise results must equal the results returned by the equivalent element-wise function :func:`~array_api.elementwise_functions.divide`.
975975
"""
976976

977977
def __xor__(self: array, other: Union[int, bool, array], /) -> array:
@@ -992,7 +992,7 @@ def __xor__(self: array, other: Union[int, bool, array], /) -> array:
992992
993993
994994
.. note::
995-
Element-wise results must equal the results returned by the equivalent element-wise function :func:`~signatures.elementwise_functions.bitwise_xor`.
995+
Element-wise results must equal the results returned by the equivalent element-wise function :func:`~array_api.elementwise_functions.bitwise_xor`.
996996
"""
997997

998998
def to_device(self: array, device: Device, /, *, stream: Optional[Union[int, Any]] = None) -> array:
@@ -1019,3 +1019,5 @@ def to_device(self: array, device: Device, /, *, stream: Optional[Union[int, Any
10191019
"""
10201020

10211021
array = _array
1022+
1023+
__all__ = ['array']

spec/API_specification/signatures/creation_functions.py renamed to spec/API_specification/array_api/creation_functions.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ def asarray(obj: Union[array, bool, int, float, NestedSequence, SupportsBufferPr
5454
.. admonition:: Note
5555
:class: note
5656
57-
If ``dtype`` is not ``None``, then array conversions should obey :ref:`type-promotion` rules. Conversions not specified according to :ref:`type-promotion` rules may or may not be permitted by a conforming array library. To perform an explicit cast, use :func:`signatures.data_type_functions.astype`.
57+
If ``dtype`` is not ``None``, then array conversions should obey :ref:`type-promotion` rules. Conversions not specified according to :ref:`type-promotion` rules may or may not be permitted by a conforming array library. To perform an explicit cast, use :func:`array_api.data_type_functions.astype`.
5858
5959
.. note::
6060
If an input value exceeds the precision of the resolved output array data type, behavior is left unspecified and, thus, implementation-defined.

spec/API_specification/signatures/linalg.py renamed to spec/API_specification/array_api/linalg.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ def inv(x: array, /) -> array:
157157

158158
def matmul(x1: array, x2: array, /) -> array:
159159
"""
160-
Alias for :func:`~signatures.linear_algebra_functions.matmul`.
160+
Alias for :func:`~array_api.linear_algebra_functions.matmul`.
161161
"""
162162

163163
def matrix_norm(x: array, /, *, keepdims: bool = False, ord: Optional[Union[int, float, Literal[inf, -inf, 'fro', 'nuc']]] = 'fro') -> array:
@@ -249,7 +249,7 @@ def matrix_rank(x: array, /, *, rtol: Optional[Union[float, array]] = None) -> a
249249

250250
def matrix_transpose(x: array, /) -> array:
251251
"""
252-
Alias for :func:`~signatures.linear_algebra_functions.matrix_transpose`.
252+
Alias for :func:`~array_api.linear_algebra_functions.matrix_transpose`.
253253
"""
254254

255255
def outer(x1: array, x2: array, /) -> array:
@@ -406,7 +406,7 @@ def svdvals(x: array, /) -> array:
406406

407407
def tensordot(x1: array, x2: array, /, *, axes: Union[int, Tuple[Sequence[int], Sequence[int]]] = 2) -> array:
408408
"""
409-
Alias for :func:`~signatures.linear_algebra_functions.tensordot`.
409+
Alias for :func:`~array_api.linear_algebra_functions.tensordot`.
410410
"""
411411

412412
def trace(x: array, /, *, offset: int = 0) -> array:
@@ -440,7 +440,7 @@ def trace(x: array, /, *, offset: int = 0) -> array:
440440

441441
def vecdot(x1: array, x2: array, /, *, axis: int = None) -> array:
442442
"""
443-
Alias for :func:`~signatures.linear_algebra_functions.vecdot`.
443+
Alias for :func:`~array_api.linear_algebra_functions.vecdot`.
444444
"""
445445

446446
def vector_norm(x: array, /, *, axis: Optional[Union[int, Tuple[int, ...]]] = None, keepdims: bool = False, ord: Union[int, float, Literal[inf, -inf]] = 2) -> array:

spec/API_specification/array_object.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ Bitwise Operators
246246

247247
-------------------------------------------------
248248

249-
.. currentmodule:: signatures.array_object
249+
.. currentmodule:: array_api.array_object
250250

251251
Attributes
252252
----------

spec/API_specification/constants.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ A conforming implementation of the array API standard must provide and support t
1010
Objects in API
1111
--------------
1212

13-
.. currentmodule:: signatures.constants
13+
.. currentmodule:: array_api.constants
1414

1515
..
1616
NOTE: please keep the functions in alphabetical order

spec/API_specification/creation_functions.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ A conforming implementation of the array API standard must provide and support t
1111
Objects in API
1212
--------------
1313

14-
.. currentmodule:: signatures.creation_functions
14+
.. currentmodule:: array_api.creation_functions
1515

1616
..
1717
NOTE: please keep the functions in alphabetical order

spec/API_specification/data_type_functions.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ A conforming implementation of the array API standard must provide and support t
99
Objects in API
1010
--------------
1111

12-
.. currentmodule:: signatures.data_type_functions
12+
.. currentmodule:: array_api.data_type_functions
1313

1414
..
1515
NOTE: please keep the functions in alphabetical order

spec/API_specification/data_types.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ Methods
100100
..
101101
NOTE: please keep the functions in alphabetical order
102102
103-
.. currentmodule:: signatures.data_types
103+
.. currentmodule:: array_api.data_types
104104

105105
.. autosummary::
106106
:toctree: generated

spec/API_specification/elementwise_functions.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ A conforming implementation of the array API standard must provide and support t
1919
Objects in API
2020
--------------
2121

22-
.. currentmodule:: signatures.elementwise_functions
22+
.. currentmodule:: array_api.elementwise_functions
2323

2424
..
2525
NOTE: please keep the functions in alphabetical order

0 commit comments

Comments
 (0)