Skip to content

Commit a43ba75

Browse files
Use positional/keyword only args delimiter in manipulation functions
1 parent 3ead0af commit a43ba75

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

dpctl/tensor/_manipulation_functions.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ def _broadcast_shapes(*args):
8383
return _broadcast_shape_impl(array_shapes)
8484

8585

86-
def permute_dims(X, axes):
86+
def permute_dims(X, /, axes):
8787
"""permute_dims(x, axes)
8888
8989
Permute the axes (dimensions) of an array; returns the permuted
@@ -120,7 +120,7 @@ def permute_dims(X, axes):
120120
)
121121

122122

123-
def expand_dims(X, axis):
123+
def expand_dims(X, /, *, axis=0):
124124
"""expand_dims(x, axis)
125125
126126
Expands the shape of an array by inserting a new axis (dimension)
@@ -166,7 +166,7 @@ def expand_dims(X, axis):
166166
return dpt.reshape(X, shape)
167167

168168

169-
def squeeze(X, axis=None):
169+
def squeeze(X, /, axis=None):
170170
"""squeeze(x, axis)
171171
172172
Removes singleton dimensions (axes) from array `x`.
@@ -211,7 +211,7 @@ def squeeze(X, axis=None):
211211
return dpt.reshape(X, new_shape)
212212

213213

214-
def broadcast_to(X, shape):
214+
def broadcast_to(X, /, shape):
215215
"""broadcast_to(x, shape)
216216
217217
Broadcast an array to a new `shape`; returns the broadcasted
@@ -277,7 +277,7 @@ def broadcast_arrays(*args):
277277
return [broadcast_to(X, shape) for X in args]
278278

279279

280-
def flip(X, axis=None):
280+
def flip(X, /, *, axis=None):
281281
"""flip(x, axis)
282282
283283
Reverses the order of elements in an array `x` along the given `axis`.
@@ -309,7 +309,7 @@ def flip(X, axis=None):
309309
return X[indexer]
310310

311311

312-
def roll(X, shift, axis=None):
312+
def roll(X, /, shift, *, axis=None):
313313
"""
314314
roll(x, shift, axis)
315315
@@ -467,7 +467,7 @@ def _concat_axis_None(arrays):
467467
return res
468468

469469

470-
def concat(arrays, axis=0):
470+
def concat(arrays, /, *, axis=0):
471471
"""concat(arrays, axis)
472472
473473
Joins a sequence of arrays along an existing axis.
@@ -535,7 +535,7 @@ def concat(arrays, axis=0):
535535
return res
536536

537537

538-
def stack(arrays, axis=0):
538+
def stack(arrays, /, *, axis=0):
539539
"""
540540
stack(arrays, axis)
541541
@@ -596,7 +596,7 @@ def stack(arrays, axis=0):
596596
return res
597597

598598

599-
def unstack(X, axis=0):
599+
def unstack(X, /, *, axis=0):
600600
"""unstack(x, axis=0)
601601
602602
Splits an array in a sequence of arrays along the given axis.
@@ -625,7 +625,7 @@ def unstack(X, axis=0):
625625
return tuple(Y[i] for i in range(Y.shape[0]))
626626

627627

628-
def moveaxis(X, source, destination):
628+
def moveaxis(X, source, destination, /):
629629
"""moveaxis(x, source, destination)
630630
631631
Moves axes of an array to new positions.
@@ -714,7 +714,7 @@ def swapaxes(X, axis1, axis2):
714714
return dpt.permute_dims(X, tuple(ind))
715715

716716

717-
def repeat(x, repeats, axis=None):
717+
def repeat(x, repeats, /, *, axis=None):
718718
"""repeat(x, repeats, axis=None)
719719
720720
Repeat elements of an array.
@@ -930,7 +930,7 @@ def repeat(x, repeats, axis=None):
930930
return res
931931

932932

933-
def tile(x, repetitions):
933+
def tile(x, repetitions, /):
934934
"""tile(x, repetitions)
935935
936936
Repeat an input array `x` along each axis a number of times given by

dpctl/tensor/_reshape.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ def reshaped_strides(old_sh, old_sts, new_sh, order="C"):
8787
return new_sts if valid else None
8888

8989

90-
def reshape(X, shape, order="C", copy=None):
90+
def reshape(X, /, shape, *, order="C", copy=None):
9191
"""reshape(x, shape, order="C")
9292
9393
Reshapes array `x` into new shape.

0 commit comments

Comments
 (0)