|
14 | 14 | SQLLazyFrameT = TypeVar("SQLLazyFrameT", bound="SQLLazyFrameAny") |
15 | 15 |
|
16 | 16 |
|
17 | | -# it needs to inherit from SQLExpr, but getting errors if passing SQLExprT. I have not sorted out what relation |
| 17 | +# it needs to inherit from SQLExpr, but getting errors if passing SQLExprT. I have not sorted out what relation |
18 | 18 | # (covarinant, contravariant or intravariant it needs to be yet) it needs to have to its parent class |
19 | 19 | class NativeSQLExpr(SQLExprT): |
20 | 20 | # not sure how to initialise the class, I want it to have all the methods etc of SQLExprT and add its own operator |
21 | | - # methods in addition to those |
| 21 | + # methods in addition to those |
22 | 22 | def __init__(self, other: [Int | Float]) -> None: |
23 | 23 | super().__init__(other) |
24 | 24 |
|
25 | | - # I've seen lots of examples of the operator dunder methods being used, but I'm struggling with |
| 25 | + # I've seen lots of examples of the operator dunder methods being used, but I'm struggling with |
26 | 26 | # the typing. for sql, there are nice binary examples, but that's not the right method |
27 | 27 | # e.g. |
28 | 28 | def __gt__(self, other: Self) -> Self: |
29 | 29 | return self._with_binary(lambda expr, other: expr.__gt__(other), other) |
30 | | - |
| 30 | + |
31 | 31 | def __and__(self, other: Self) -> Self: |
32 | 32 | return self._with_binary(lambda expr, other: expr.__and__(other), other) |
33 | | - |
| 33 | + |
34 | 34 | # so it should probably look more like something from the polars examples, |
35 | | - # where we just apply the native method: |
| 35 | + # where we just apply the native method: |
36 | 36 | def __gt__(self, other: Any) -> Self: |
37 | 37 | return self._with_native(self.native.__gt__(extract_native(other))) |
38 | 38 |
|
39 | 39 | def __le__(self, other: Any) -> Self: |
40 | 40 | return self._with_native(self.native.__le__(extract_native(other))) |
41 | | - |
42 | | - |
43 | | - |
44 | | - |
45 | | - |
46 | | - |
47 | | - |
0 commit comments