Skip to content

Commit 633ccab

Browse files
committed
refactor(api)!: expr argument of ibis.asc/ibis.desc is now positional-only; nulls_first is keyword-only
1 parent 869fe02 commit 633ccab

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

ibis/expr/api.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -592,7 +592,7 @@ def _deferred_method_call(expr, method_name, **kwargs):
592592
return method(value)
593593

594594

595-
def desc(expr: ir.Column | str, nulls_first: bool = False) -> ir.Value:
595+
def desc(expr: ir.Column | str, /, *, nulls_first: bool = False) -> ir.Value:
596596
"""Create a descending sort key from `expr` or column name.
597597
598598
Parameters
@@ -633,7 +633,7 @@ def desc(expr: ir.Column | str, nulls_first: bool = False) -> ir.Value:
633633
return _deferred_method_call(expr, "desc", nulls_first=nulls_first)
634634

635635

636-
def asc(expr: ir.Column | str, nulls_first: bool = False) -> ir.Value:
636+
def asc(expr: ir.Column | str, /, *, nulls_first: bool = False) -> ir.Value:
637637
"""Create a ascending sort key from `asc` or column name.
638638
639639
Parameters

ibis/expr/types/generic.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1237,8 +1237,8 @@ def __le__(self, other: Value) -> ir.BooleanValue:
12371237
def __lt__(self, other: Value) -> ir.BooleanValue:
12381238
return _binop(ops.Less, self, other)
12391239

1240-
def asc(self, nulls_first: bool = False) -> ir.Value:
1241-
"""Sort an expression ascending.
1240+
def asc(self, *, nulls_first: bool = False) -> ir.Value:
1241+
"""Sort an expression in ascending order.
12421242
12431243
Parameters
12441244
----------
@@ -1284,8 +1284,8 @@ def asc(self, nulls_first: bool = False) -> ir.Value:
12841284
"""
12851285
return ops.SortKey(self, ascending=True, nulls_first=nulls_first).to_expr()
12861286

1287-
def desc(self, nulls_first: bool = False) -> ir.Value:
1288-
"""Sort an expression descending.
1287+
def desc(self, *, nulls_first: bool = False) -> ir.Value:
1288+
"""Sort an expression in descending order.
12891289
12901290
Parameters
12911291
----------

0 commit comments

Comments
 (0)