Skip to content

Commit 63a64ab

Browse files
committed
Use American spelling
1 parent f59e61a commit 63a64ab

9 files changed

+28
-28
lines changed

array_api_tests/shape_helpers.py

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

99
__all__ = [
1010
"broadcast_shapes",
11-
"normalise_axis",
11+
"normalize_axis",
1212
"ndindex",
1313
"axis_ndindex",
1414
"axes_ndindex",
@@ -65,7 +65,7 @@ def broadcast_shapes(*shapes: Shape):
6565
return result
6666

6767

68-
def normalise_axis(
68+
def normalize_axis(
6969
axis: Optional[Union[int, Sequence[int]]], ndim: int
7070
) -> Tuple[int, ...]:
7171
if axis is None:

array_api_tests/test_array_object.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ def scalar_objects(
2626
)
2727

2828

29-
def normalise_key(key: Index, shape: Shape) -> Tuple[Union[int, slice], ...]:
29+
def normalize_key(key: Index, shape: Shape) -> Tuple[Union[int, slice], ...]:
3030
"""
31-
Normalise an indexing key.
31+
Normalize an indexing key.
3232
3333
* If a non-tuple index, wrap as a tuple.
3434
* Represent ellipsis as equivalent slices.
@@ -48,7 +48,7 @@ def get_indexed_axes_and_out_shape(
4848
key: Tuple[Union[int, slice, None], ...], shape: Shape
4949
) -> Tuple[Tuple[Sequence[int], ...], Shape]:
5050
"""
51-
From the (normalised) key and input shape, calculates:
51+
From the (normalized) key and input shape, calculates:
5252
5353
* indexed_axes: For each dimension, the axes which the key indexes.
5454
* out_shape: The resulting shape of indexing an array (of the input shape)
@@ -88,7 +88,7 @@ def test_getitem(shape, dtype, data):
8888
out = x[key]
8989

9090
ph.assert_dtype("__getitem__", in_dtype=x.dtype, out_dtype=out.dtype)
91-
_key = normalise_key(key, shape)
91+
_key = normalize_key(key, shape)
9292
axes_indices, expected_shape = get_indexed_axes_and_out_shape(_key, shape)
9393
ph.assert_shape("__getitem__", out_shape=out.shape, expected=expected_shape)
9494
out_zero_sided = any(side == 0 for side in expected_shape)
@@ -119,7 +119,7 @@ def test_setitem(shape, dtypes, data):
119119
x = xp.asarray(obj, dtype=dtypes.result_dtype)
120120
note(f"{x=}")
121121
key = data.draw(xps.indices(shape=shape), label="key")
122-
_key = normalise_key(key, shape)
122+
_key = normalize_key(key, shape)
123123
axes_indices, out_shape = get_indexed_axes_and_out_shape(_key, shape)
124124
value_strat = hh.arrays(dtype=dtypes.result_dtype, shape=out_shape)
125125
if out_shape == ():

array_api_tests/test_fft.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ def assert_s_axes_shape(
9494
axes: Optional[List[int]],
9595
out: Array,
9696
):
97-
_axes = sh.normalise_axis(axes, x.ndim)
97+
_axes = sh.normalize_axis(axes, x.ndim)
9898
_s = x.shape if s is None else s
9999
expected = []
100100
for i in range(x.ndim):
@@ -193,7 +193,7 @@ def test_rfftn(x, data):
193193

194194
ph.assert_float_to_complex_dtype("rfftn", in_dtype=x.dtype, out_dtype=out.dtype)
195195

196-
_axes = sh.normalise_axis(axes, x.ndim)
196+
_axes = sh.normalize_axis(axes, x.ndim)
197197
_s = x.shape if s is None else s
198198
expected = []
199199
for i in range(x.ndim):
@@ -225,7 +225,7 @@ def test_irfftn(x, data):
225225
)
226226

227227
# TODO: assert shape correctly
228-
# _axes = sh.normalise_axis(axes, x.ndim)
228+
# _axes = sh.normalize_axis(axes, x.ndim)
229229
# _s = x.shape if s is None else s
230230
# expected = []
231231
# for i in range(x.ndim):

array_api_tests/test_linalg.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -980,7 +980,7 @@ def test_vector_norm(x, data):
980980
# TODO: Check that the ord values give the correct norms.
981981
# ord = kw.get('ord', 2)
982982

983-
_axes = sh.normalise_axis(axis, x.ndim)
983+
_axes = sh.normalize_axis(axis, x.ndim)
984984

985985
ph.assert_keepdimable_shape('linalg.vector_norm', out_shape=res.shape,
986986
in_shape=x.shape, axes=_axes,

array_api_tests/test_manipulation_functions.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ def test_squeeze(x, data):
190190
)
191191

192192
axes = (axis,) if isinstance(axis, int) else axis
193-
axes = sh.normalise_axis(axes, x.ndim)
193+
axes = sh.normalize_axis(axes, x.ndim)
194194

195195
squeezable_axes = [i for i, side in enumerate(x.shape) if side == 1]
196196
if any(i not in squeezable_axes for i in axes):
@@ -230,7 +230,7 @@ def test_flip(x, data):
230230

231231
ph.assert_dtype("flip", in_dtype=x.dtype, out_dtype=out.dtype)
232232

233-
_axes = sh.normalise_axis(kw.get("axis", None), x.ndim)
233+
_axes = sh.normalize_axis(kw.get("axis", None), x.ndim)
234234
for indices in sh.axes_ndindex(x.shape, _axes):
235235
reverse_indices = indices[::-1]
236236
assert_array_ndindex("flip", x, x_indices=indices, out=out,
@@ -360,7 +360,7 @@ def test_roll(x, data):
360360
assert_array_ndindex("roll", x, x_indices=indices, out=out, out_indices=shifted_indices, kw=kw)
361361
else:
362362
shifts = (shift,) if isinstance(shift, int) else shift
363-
axes = sh.normalise_axis(kw["axis"], x.ndim)
363+
axes = sh.normalize_axis(kw["axis"], x.ndim)
364364
shifted_indices = roll_ndindex(x.shape, shifts, axes)
365365
assert_array_ndindex("roll", x, x_indices=sh.ndindex(x.shape), out=out, out_indices=shifted_indices, kw=kw)
366366

array_api_tests/test_searching_functions.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ def test_argmax(x, data):
3636
out = xp.argmax(x, **kw)
3737

3838
ph.assert_default_index("argmax", out.dtype)
39-
axes = sh.normalise_axis(kw.get("axis", None), x.ndim)
39+
axes = sh.normalize_axis(kw.get("axis", None), x.ndim)
4040
ph.assert_keepdimable_shape(
4141
"argmax", in_shape=x.shape, out_shape=out.shape, axes=axes, keepdims=keepdims, kw=kw
4242
)
@@ -73,7 +73,7 @@ def test_argmin(x, data):
7373
out = xp.argmin(x, **kw)
7474

7575
ph.assert_default_index("argmin", out.dtype)
76-
axes = sh.normalise_axis(kw.get("axis", None), x.ndim)
76+
axes = sh.normalize_axis(kw.get("axis", None), x.ndim)
7777
ph.assert_keepdimable_shape(
7878
"argmin", in_shape=x.shape, out_shape=out.shape, axes=axes, keepdims=keepdims, kw=kw
7979
)

array_api_tests/test_sorting_functions.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ def test_argsort(x, data):
5656
ph.assert_default_index("argsort", out.dtype)
5757
ph.assert_shape("argsort", out_shape=out.shape, expected=x.shape, kw=kw)
5858
axis = kw.get("axis", -1)
59-
axes = sh.normalise_axis(axis, x.ndim)
59+
axes = sh.normalize_axis(axis, x.ndim)
6060
scalar_type = dh.get_scalar_type(x.dtype)
6161
for indices in sh.axes_ndindex(x.shape, axes):
6262
elements = [scalar_type(x[idx]) for idx in indices]
@@ -117,7 +117,7 @@ def test_sort(x, data):
117117
ph.assert_dtype("sort", out_dtype=out.dtype, in_dtype=x.dtype)
118118
ph.assert_shape("sort", out_shape=out.shape, expected=x.shape, kw=kw)
119119
axis = kw.get("axis", -1)
120-
axes = sh.normalise_axis(axis, x.ndim)
120+
axes = sh.normalize_axis(axis, x.ndim)
121121
scalar_type = dh.get_scalar_type(x.dtype)
122122
for indices in sh.axes_ndindex(x.shape, axes):
123123
elements = [scalar_type(x[idx]) for idx in indices]

array_api_tests/test_statistical_functions.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def test_cumulative_sum(x, data):
2828
if x.ndim == 1:
2929
axes = axes | st.none()
3030
axis = data.draw(axes, label='axis')
31-
_axis, = sh.normalise_axis(axis, x.ndim)
31+
_axis, = sh.normalize_axis(axis, x.ndim)
3232
dtype = data.draw(kwarg_dtypes(x.dtype))
3333
include_initial = data.draw(st.booleans(), label="include_initial")
3434

@@ -108,7 +108,7 @@ def test_max(x, data):
108108
out = xp.max(x, **kw)
109109

110110
ph.assert_dtype("max", in_dtype=x.dtype, out_dtype=out.dtype)
111-
_axes = sh.normalise_axis(kw.get("axis", None), x.ndim)
111+
_axes = sh.normalize_axis(kw.get("axis", None), x.ndim)
112112
ph.assert_keepdimable_shape(
113113
"max", in_shape=x.shape, out_shape=out.shape, axes=_axes, keepdims=keepdims, kw=kw
114114
)
@@ -138,7 +138,7 @@ def test_mean(x, data):
138138
out = xp.mean(x, **kw)
139139

140140
ph.assert_dtype("mean", in_dtype=x.dtype, out_dtype=out.dtype)
141-
_axes = sh.normalise_axis(kw.get("axis", None), x.ndim)
141+
_axes = sh.normalize_axis(kw.get("axis", None), x.ndim)
142142
ph.assert_keepdimable_shape(
143143
"mean", in_shape=x.shape, out_shape=out.shape, axes=_axes, keepdims=keepdims, kw=kw
144144
)
@@ -161,7 +161,7 @@ def test_min(x, data):
161161
out = xp.min(x, **kw)
162162

163163
ph.assert_dtype("min", in_dtype=x.dtype, out_dtype=out.dtype)
164-
_axes = sh.normalise_axis(kw.get("axis", None), x.ndim)
164+
_axes = sh.normalize_axis(kw.get("axis", None), x.ndim)
165165
ph.assert_keepdimable_shape(
166166
"min", in_shape=x.shape, out_shape=out.shape, axes=_axes, keepdims=keepdims, kw=kw
167167
)
@@ -209,7 +209,7 @@ def test_prod(x, data):
209209
assert dh.is_int_dtype(out.dtype) # sanity check
210210
else:
211211
ph.assert_dtype("prod", in_dtype=x.dtype, out_dtype=out.dtype, expected=expected_dtype)
212-
_axes = sh.normalise_axis(kw.get("axis", None), x.ndim)
212+
_axes = sh.normalize_axis(kw.get("axis", None), x.ndim)
213213
ph.assert_keepdimable_shape(
214214
"prod", in_shape=x.shape, out_shape=out.shape, axes=_axes, keepdims=keepdims, kw=kw
215215
)
@@ -239,7 +239,7 @@ def test_prod(x, data):
239239
)
240240
def test_std(x, data):
241241
axis = data.draw(hh.axes(x.ndim), label="axis")
242-
_axes = sh.normalise_axis(axis, x.ndim)
242+
_axes = sh.normalize_axis(axis, x.ndim)
243243
N = sum(side for axis, side in enumerate(x.shape) if axis not in _axes)
244244
correction = data.draw(
245245
st.floats(0.0, N, allow_infinity=False, allow_nan=False) | st.integers(0, N),
@@ -298,7 +298,7 @@ def test_sum(x, data):
298298
assert dh.is_int_dtype(out.dtype) # sanity check
299299
else:
300300
ph.assert_dtype("sum", in_dtype=x.dtype, out_dtype=out.dtype, expected=expected_dtype)
301-
_axes = sh.normalise_axis(kw.get("axis", None), x.ndim)
301+
_axes = sh.normalize_axis(kw.get("axis", None), x.ndim)
302302
ph.assert_keepdimable_shape(
303303
"sum", in_shape=x.shape, out_shape=out.shape, axes=_axes, keepdims=keepdims, kw=kw
304304
)
@@ -329,7 +329,7 @@ def test_sum(x, data):
329329
)
330330
def test_var(x, data):
331331
axis = data.draw(hh.axes(x.ndim), label="axis")
332-
_axes = sh.normalise_axis(axis, x.ndim)
332+
_axes = sh.normalize_axis(axis, x.ndim)
333333
N = sum(side for axis, side in enumerate(x.shape) if axis not in _axes)
334334
correction = data.draw(
335335
st.floats(0.0, N, allow_infinity=False, allow_nan=False) | st.integers(0, N),

array_api_tests/test_utility_functions.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ def test_all(x, data):
2121
out = xp.all(x, **kw)
2222

2323
ph.assert_dtype("all", in_dtype=x.dtype, out_dtype=out.dtype, expected=xp.bool)
24-
_axes = sh.normalise_axis(kw.get("axis", None), x.ndim)
24+
_axes = sh.normalize_axis(kw.get("axis", None), x.ndim)
2525
ph.assert_keepdimable_shape(
2626
"all", in_shape=x.shape, out_shape=out.shape, axes=_axes, keepdims=keepdims, kw=kw
2727
)
@@ -49,7 +49,7 @@ def test_any(x, data):
4949
out = xp.any(x, **kw)
5050

5151
ph.assert_dtype("any", in_dtype=x.dtype, out_dtype=out.dtype, expected=xp.bool)
52-
_axes = sh.normalise_axis(kw.get("axis", None), x.ndim)
52+
_axes = sh.normalize_axis(kw.get("axis", None), x.ndim)
5353
ph.assert_keepdimable_shape(
5454
"any", in_shape=x.shape, out_shape=out.shape, axes=_axes, keepdims=keepdims, kw=kw,
5555
)

0 commit comments

Comments
 (0)