|
1 | 1 | from __future__ import annotations |
2 | 2 |
|
3 | | -from typing import TYPE_CHECKING, Any, TypeVar |
| 3 | +from typing import TYPE_CHECKING, Any, TypeVar, Self |
4 | 4 |
|
5 | 5 | from narwhals._compliant.expr import NativeExpr |
6 | 6 |
|
|
9 | 9 | from narwhals._sql.expr import SQLExpr |
10 | 10 | from narwhals.dtypes import Boolean |
11 | 11 |
|
| 12 | + # TODO: @mp, understand why these are here & if we need one for NativeSQLExprT |
12 | 13 | SQLExprAny = SQLExpr[Any, Any] |
13 | 14 | SQLLazyFrameAny = SQLLazyFrame[Any, Any, Any] |
14 | 15 |
|
15 | 16 | SQLExprT = TypeVar("SQLExprT", bound="SQLExprAny") |
16 | 17 | SQLExprT_contra = TypeVar("SQLExprT_contra", bound="SQLExprAny", contravariant=True) |
17 | 18 | SQLLazyFrameT = TypeVar("SQLLazyFrameT", bound="SQLLazyFrameAny") |
18 | | - |
| 19 | +NativeSQLExprT = TypeVar("NativeSQLExprT", bound="NativeSQLExpr") |
19 | 20 |
|
20 | 21 | class NativeSQLExpr(NativeExpr): |
21 | | - # TODO @mp: fix input type for all these! |
22 | | - def __gt__(self, value: float) -> Boolean: ... |
| 22 | + # both Self because we're comparing an expression with an expression? |
| 23 | + def __gt__(self, value: Self) -> Self: ... |
23 | 24 |
|
24 | | - def __lt__(self, value: float) -> Boolean: ... |
| 25 | + def __lt__(self, value: Self) -> Self: ... |
25 | 26 |
|
26 | | - def __ge__(self, value: float) -> Boolean: ... |
| 27 | + def __ge__(self, value: Self) -> Self: ... |
27 | 28 |
|
28 | | - def __le__(self, value: float) -> Boolean: ... |
| 29 | + def __le__(self, value: Self) -> Self: ... |
29 | 30 |
|
30 | | - def __eq__(self, value: float) -> Boolean: ... |
| 31 | + def __eq__(self, value: Self) -> Self: ... |
31 | 32 |
|
32 | | - def __ne__(self, value: float) -> Boolean: ... |
| 33 | + def __ne__(self, value: Self) -> Self: ... |
33 | 34 | # do we want any more of the arithmetic methods? I wasn't sure between lefthan & righthand methods.. |
34 | | - def __sub__(self, value: float) -> Any: ... |
| 35 | + def __sub__(self, value: Self) -> Self: ... |
35 | 36 |
|
36 | | - def __add__(self, value: float) -> Any: ... |
| 37 | + def __add__(self, value: Self) -> Self: ... |
37 | 38 |
|
38 | | - def __truediv__(self, value: float) -> Any: ... |
| 39 | + def __truediv__(self, value: Self) -> Self: ... |
39 | 40 |
|
40 | | - def __mul__(self, value: float) -> Any: ... |
| 41 | + def __mul__(self, value: Self) -> Self: ... |
0 commit comments