Skip to content

Commit ca73a6b

Browse files
committed
Add return type annotations to the function stubs
1 parent 02108e0 commit ca73a6b

11 files changed

+151
-142
lines changed

array_api_tests/function_stubs/array_object.py

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -16,157 +16,157 @@
1616

1717
from ._types import array
1818

19-
def __abs__(x: array):
19+
def __abs__(x: array) -> array:
2020
"""
2121
Note: __abs__ is a method of the array object.
2222
"""
2323
pass
2424

25-
def __add__(x1: array, x2: array):
25+
def __add__(x1: array, x2: array) -> array:
2626
"""
2727
Note: __add__ is a method of the array object.
2828
"""
2929
pass
3030

31-
def __and__(x1: array, x2: array):
31+
def __and__(x1: array, x2: array) -> array:
3232
"""
3333
Note: __and__ is a method of the array object.
3434
"""
3535
pass
3636

37-
def __eq__(x1: array, x2: array):
37+
def __eq__(x1: array, x2: array) -> array:
3838
"""
3939
Note: __eq__ is a method of the array object.
4040
"""
4141
pass
4242

43-
def __floordiv__(x1: array, x2: array):
43+
def __floordiv__(x1: array, x2: array) -> array:
4444
"""
4545
Note: __floordiv__ is a method of the array object.
4646
"""
4747
pass
4848

49-
def __ge__(x1: array, x2: array):
49+
def __ge__(x1: array, x2: array) -> array:
5050
"""
5151
Note: __ge__ is a method of the array object.
5252
"""
5353
pass
5454

55-
def __ge__(x1: array, x2: array):
55+
def __getitem__(x, key):
5656
"""
5757
Note: __getitem__ is a method of the array object.
5858
"""
5959
pass
6060

61-
def __gt__(x1: array, x2: array):
61+
def __gt__(x1: array, x2: array) -> array:
6262
"""
6363
Note: __gt__ is a method of the array object.
6464
"""
6565
pass
6666

67-
def __invert__(x: array):
67+
def __invert__(x: array) -> array:
6868
"""
6969
Note: __invert__ is a method of the array object.
7070
"""
7171
pass
7272

73-
def __le__(x1: array, x2: array):
73+
def __le__(x1: array, x2: array) -> array:
7474
"""
7575
Note: __le__ is a method of the array object.
7676
"""
7777
pass
7878

79-
def __le__(x1: array, x2: array):
79+
def __len__(x):
8080
"""
8181
Note: __len__ is a method of the array object.
8282
"""
8383
pass
8484

85-
def __lshift__(x1: array, x2: array):
85+
def __lshift__(x1: array, x2: array) -> array:
8686
"""
8787
Note: __lshift__ is a method of the array object.
8888
"""
8989
pass
9090

91-
def __lt__(x1: array, x2: array):
91+
def __lt__(x1: array, x2: array) -> array:
9292
"""
9393
Note: __lt__ is a method of the array object.
9494
"""
9595
pass
9696

97-
def __matmul__(x1: array, x2: array):
97+
def __matmul__(x1: array, x2: array) -> array:
9898
"""
9999
Note: __matmul__ is a method of the array object.
100100
"""
101101
pass
102102

103-
def __mod__(x1: array, x2: array):
103+
def __mod__(x1: array, x2: array) -> array:
104104
"""
105105
Note: __mod__ is a method of the array object.
106106
"""
107107
pass
108108

109-
def __mul__(x1: array, x2: array):
109+
def __mul__(x1: array, x2: array) -> array:
110110
"""
111111
Note: __mul__ is a method of the array object.
112112
"""
113113
pass
114114

115-
def __ne__(x1: array, x2: array):
115+
def __ne__(x1: array, x2: array) -> array:
116116
"""
117117
Note: __ne__ is a method of the array object.
118118
"""
119119
pass
120120

121-
def __neg__(x: array):
121+
def __neg__(x: array) -> array:
122122
"""
123123
Note: __neg__ is a method of the array object.
124124
"""
125125
pass
126126

127-
def __or__(x1: array, x2: array):
127+
def __or__(x1: array, x2: array) -> array:
128128
"""
129129
Note: __or__ is a method of the array object.
130130
"""
131131
pass
132132

133-
def __pos__(x: array):
133+
def __pos__(x: array) -> array:
134134
"""
135135
Note: __pos__ is a method of the array object.
136136
"""
137137
pass
138138

139-
def __pow__(x1: array, x2: array):
139+
def __pow__(x1: array, x2: array) -> array:
140140
"""
141141
Note: __pow__ is a method of the array object.
142142
"""
143143
pass
144144

145-
def __rshift__(x1: array, x2: array):
145+
def __rshift__(x1: array, x2: array) -> array:
146146
"""
147147
Note: __rshift__ is a method of the array object.
148148
"""
149149
pass
150150

151-
def __rshift__(x1: array, x2: array):
151+
def __setitem__(x, key, value):
152152
"""
153153
Note: __setitem__ is a method of the array object.
154154
"""
155155
pass
156156

157-
def __sub__(x1: array, x2: array):
157+
def __sub__(x1: array, x2: array) -> array:
158158
"""
159159
Note: __sub__ is a method of the array object.
160160
"""
161161
pass
162162

163-
def __truediv__(x1: array, x2: array):
163+
def __truediv__(x1: array, x2: array) -> array:
164164
"""
165165
Note: __truediv__ is a method of the array object.
166166
"""
167167
pass
168168

169-
def __xor__(x1: array, x2: array):
169+
def __xor__(x1: array, x2: array) -> array:
170170
"""
171171
Note: __xor__ is a method of the array object.
172172
"""

array_api_tests/function_stubs/creation_functions.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,37 +16,37 @@
1616

1717
from ._types import Optional, Tuple, Union, array, device, dtype
1818

19-
def arange(start: Union[int, float], *, stop: Optional[Union[int, float]] = None, step: Union[int, float] = 1, dtype: Optional[dtype] = None, device: Optional[device] = None):
19+
def arange(start: Union[int, float], *, stop: Optional[Union[int, float]] = None, step: Union[int, float] = 1, dtype: Optional[dtype] = None, device: Optional[device] = None) -> array:
2020
pass
2121

22-
def empty(shape: Union[int, Tuple[int, ...]], *, dtype: Optional[dtype] = None, device: Optional[device] = None):
22+
def empty(shape: Union[int, Tuple[int, ...]], *, dtype: Optional[dtype] = None, device: Optional[device] = None) -> array:
2323
pass
2424

25-
def empty_like(x: array, *, dtype: Optional[dtype] = None, device: Optional[device] = None):
25+
def empty_like(x: array, *, dtype: Optional[dtype] = None, device: Optional[device] = None) -> array:
2626
pass
2727

28-
def eye(N: int, *, M: Optional[int] = None, k: Optional[int] = 0, dtype: Optional[dtype] = None, device: Optional[device] = None):
28+
def eye(N: int, *, M: Optional[int] = None, k: Optional[int] = 0, dtype: Optional[dtype] = None, device: Optional[device] = None) -> array:
2929
pass
3030

31-
def full(shape: Union[int, Tuple[int, ...]], fill_value: Union[int, float], *, dtype: Optional[dtype] = None, device: Optional[device] = None):
31+
def full(shape: Union[int, Tuple[int, ...]], fill_value: Union[int, float], *, dtype: Optional[dtype] = None, device: Optional[device] = None) -> array:
3232
pass
3333

34-
def full_like(x: array, fill_value: Union[int, float], *, dtype: Optional[dtype] = None, device: Optional[device] = None):
34+
def full_like(x: array, fill_value: Union[int, float], *, dtype: Optional[dtype] = None, device: Optional[device] = None) -> array:
3535
pass
3636

37-
def linspace(start: Union[int, float], stop: Union[int, float], num: int, *, dtype: Optional[dtype] = None, device: Optional[device] = None, endpoint: Optional[bool] = True):
37+
def linspace(start: Union[int, float], stop: Union[int, float], num: int, *, dtype: Optional[dtype] = None, device: Optional[device] = None, endpoint: Optional[bool] = True) -> array:
3838
pass
3939

40-
def ones(shape: Union[int, Tuple[int, ...]], *, dtype: Optional[dtype] = None, device: Optional[device] = None):
40+
def ones(shape: Union[int, Tuple[int, ...]], *, dtype: Optional[dtype] = None, device: Optional[device] = None) -> array:
4141
pass
4242

43-
def ones_like(x: array, *, dtype: Optional[dtype] = None, device: Optional[device] = None):
43+
def ones_like(x: array, *, dtype: Optional[dtype] = None, device: Optional[device] = None) -> array:
4444
pass
4545

46-
def zeros(shape: Union[int, Tuple[int, ...]], *, dtype: Optional[dtype] = None, device: Optional[device] = None):
46+
def zeros(shape: Union[int, Tuple[int, ...]], *, dtype: Optional[dtype] = None, device: Optional[device] = None) -> array:
4747
pass
4848

49-
def zeros_like(x: array, *, dtype: Optional[dtype] = None, device: Optional[device] = None):
49+
def zeros_like(x: array, *, dtype: Optional[dtype] = None, device: Optional[device] = None) -> array:
5050
pass
5151

5252
__all__ = ['arange', 'empty', 'empty_like', 'eye', 'full', 'full_like', 'linspace', 'ones', 'ones_like', 'zeros', 'zeros_like']

0 commit comments

Comments
 (0)