Skip to content

Commit bc4c7a3

Browse files
committed
refactor(api)!: standardize ArrayValue method signatures
1 parent e0bc9b7 commit bc4c7a3

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

ibis/expr/types/arrays.py

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ def __getitem__(self, index: int | ir.IntegerValue | slice) -> ir.Value:
149149
op = ops.ArrayIndex(self, index)
150150
return op.to_expr()
151151

152-
def concat(self, other: ArrayValue, *args: ArrayValue) -> ArrayValue:
152+
def concat(self, other: ArrayValue, /, *args: ArrayValue) -> ArrayValue:
153153
"""Concatenate this array with one or more arrays.
154154
155155
Parameters
@@ -231,7 +231,7 @@ def __add__(self, other: ArrayValue) -> ArrayValue:
231231
def __radd__(self, other: ArrayValue) -> ArrayValue:
232232
return ops.ArrayConcat((other, self)).to_expr()
233233

234-
def repeat(self, n: int | ir.IntegerValue) -> ArrayValue:
234+
def repeat(self, n: int | ir.IntegerValue, /) -> ArrayValue:
235235
"""Repeat this array `n` times.
236236
237237
Parameters
@@ -338,7 +338,7 @@ def unnest(self) -> ir.Value:
338338
except com.ExpressionError:
339339
return expr
340340

341-
def join(self, sep: str | ir.StringValue) -> ir.StringValue:
341+
def join(self, sep: str | ir.StringValue, /) -> ir.StringValue:
342342
"""Join the elements of this array expression with `sep`.
343343
344344
Parameters
@@ -423,6 +423,7 @@ def map(
423423
func: Deferred
424424
| Callable[[ir.Value], ir.Value]
425425
| Callable[[ir.Value, ir.Value], ir.Value],
426+
/,
426427
) -> ir.ArrayValue:
427428
"""Apply a `func` or `Deferred` to each element of this array expression.
428429
@@ -533,6 +534,7 @@ def filter(
533534
predicate: Deferred
534535
| Callable[[ir.Value], bool | ir.BooleanValue]
535536
| Callable[[ir.Value, ir.IntegerValue], bool | ir.BooleanValue],
537+
/,
536538
) -> ir.ArrayValue:
537539
"""Filter array elements using `predicate` function or `Deferred`.
538540
@@ -638,7 +640,7 @@ def filter(
638640
param, index, body = self._construct_array_func_inputs(predicate)
639641
return ops.ArrayFilter(self, param=param, index=index, body=body).to_expr()
640642

641-
def contains(self, other: ir.Value) -> ir.BooleanValue:
643+
def contains(self, other: ir.Value, /) -> ir.BooleanValue:
642644
"""Return whether the array contains `other`.
643645
644646
Parameters
@@ -692,7 +694,7 @@ def contains(self, other: ir.Value) -> ir.BooleanValue:
692694
"""
693695
return ops.ArrayContains(self, other).to_expr()
694696

695-
def index(self, other: ir.Value) -> ir.IntegerValue:
697+
def index(self, other: ir.Value, /) -> ir.IntegerValue:
696698
"""Return the position of `other` in an array.
697699
698700
Parameters
@@ -757,7 +759,7 @@ def index(self, other: ir.Value) -> ir.IntegerValue:
757759
"""
758760
return ops.ArrayPosition(self, other).to_expr()
759761

760-
def remove(self, other: ir.Value) -> ir.ArrayValue:
762+
def remove(self, other: ir.Value, /) -> ir.ArrayValue:
761763
"""Remove `other` from `self`.
762764
763765
Parameters
@@ -866,7 +868,7 @@ def sort(self) -> ir.ArrayValue:
866868
"""
867869
return ops.ArraySort(self).to_expr()
868870

869-
def union(self, other: ir.ArrayValue) -> ir.ArrayValue:
871+
def union(self, other: ir.ArrayValue, /) -> ir.ArrayValue:
870872
"""Union two arrays.
871873
872874
Parameters
@@ -917,7 +919,7 @@ def union(self, other: ir.ArrayValue) -> ir.ArrayValue:
917919
"""
918920
return ops.ArrayUnion(self, other).to_expr()
919921

920-
def intersect(self, other: ArrayValue) -> ArrayValue:
922+
def intersect(self, other: ArrayValue, /) -> ArrayValue:
921923
"""Intersect two arrays.
922924
923925
Parameters
@@ -958,7 +960,7 @@ def intersect(self, other: ArrayValue) -> ArrayValue:
958960
"""
959961
return ops.ArrayIntersect(self, other).to_expr()
960962

961-
def zip(self, other: ArrayValue, *others: ArrayValue) -> ArrayValue:
963+
def zip(self, other: ArrayValue, /, *others: ArrayValue) -> ArrayValue:
962964
"""Zip two or more arrays together.
963965
964966
Parameters
@@ -1385,7 +1387,7 @@ def __getitem__(self, index: int | ir.IntegerValue | slice) -> ir.Column:
13851387

13861388
@public
13871389
@deferrable
1388-
def array(values: Iterable[V]) -> ArrayValue:
1390+
def array(values: Iterable[V], /) -> ArrayValue:
13891391
"""Create an array expression.
13901392
13911393
If any values are [column expressions](../concepts/datatypes.qmd) the

0 commit comments

Comments
 (0)