|
25 | 25 | import polars as pl
|
26 | 26 | import pyarrow as pa
|
27 | 27 | import rich.table
|
| 28 | + from typing_extensions import Self |
28 | 29 |
|
29 | 30 | import ibis.expr.schema as sch
|
30 | 31 | import ibis.expr.types as ir
|
@@ -428,7 +429,7 @@ def typeof(self) -> ir.StringValue:
|
428 | 429 | """
|
429 | 430 | return ops.TypeOf(self).to_expr()
|
430 | 431 |
|
431 |
| - def fill_null(self, fill_value: Scalar, /) -> Value: |
| 432 | + def fill_null(self, fill_value: Scalar, /) -> Self: |
432 | 433 | """Replace `NULL`s with the given value. Does NOT affect `NaN` and `inf` values.
|
433 | 434 |
|
434 | 435 | This only replaces genuine `NULL` values, it does NOT affect
|
@@ -491,11 +492,11 @@ def fill_null(self, fill_value: Scalar, /) -> Value:
|
491 | 492 | return ops.Coalesce((self, fill_value)).to_expr()
|
492 | 493 |
|
493 | 494 | @deprecated(as_of="9.1", instead="use fill_null instead")
|
494 |
| - def fillna(self, fill_value: Scalar, /) -> Value: |
| 495 | + def fillna(self, fill_value: Scalar, /) -> Self: |
495 | 496 | """DEPRECATED: use `fill_null` instead, which acts exactly the same."""
|
496 | 497 | return self.fill_null(fill_value)
|
497 | 498 |
|
498 |
| - def nullif(self, null_if_expr: Value, /) -> Value: |
| 499 | + def nullif(self, null_if_expr: Value, /) -> Self: |
499 | 500 | """Set values to null if they equal the values `null_if_expr`.
|
500 | 501 |
|
501 | 502 | Commonly used to avoid divide-by-zero problems by replacing zero with
|
@@ -758,7 +759,7 @@ def substitute(
|
758 | 759 | value: Value | dict,
|
759 | 760 | replacement: Value | None = None,
|
760 | 761 | else_: Value | None = None,
|
761 |
| - ): |
| 762 | + ) -> Value: |
762 | 763 | """Replace values given in `values` with `replacement`.
|
763 | 764 |
|
764 | 765 | This is similar to the pandas `replace` method.
|
@@ -838,7 +839,7 @@ def over(
|
838 | 839 | range=None,
|
839 | 840 | group_by=None,
|
840 | 841 | order_by=None,
|
841 |
| - ) -> Value: |
| 842 | + ) -> Self: |
842 | 843 | """Construct a window expression.
|
843 | 844 |
|
844 | 845 | Parameters
|
@@ -1261,7 +1262,7 @@ def __le__(self, other: Value) -> ir.BooleanValue:
|
1261 | 1262 | def __lt__(self, other: Value) -> ir.BooleanValue:
|
1262 | 1263 | return _binop(ops.Less, self, other)
|
1263 | 1264 |
|
1264 |
| - def asc(self, *, nulls_first: bool = False) -> ir.Value: |
| 1265 | + def asc(self, *, nulls_first: bool = False) -> Self: |
1265 | 1266 | """Sort an expression in ascending order.
|
1266 | 1267 |
|
1267 | 1268 | Parameters
|
@@ -1308,7 +1309,7 @@ def asc(self, *, nulls_first: bool = False) -> ir.Value:
|
1308 | 1309 | """
|
1309 | 1310 | return ops.SortKey(self, ascending=True, nulls_first=nulls_first).to_expr()
|
1310 | 1311 |
|
1311 |
| - def desc(self, *, nulls_first: bool = False) -> ir.Value: |
| 1312 | + def desc(self, *, nulls_first: bool = False) -> Self: |
1312 | 1313 | """Sort an expression in descending order.
|
1313 | 1314 |
|
1314 | 1315 | Parameters
|
|
0 commit comments