|
3 | 3 | from typing import TYPE_CHECKING, Any, Callable, Literal, Protocol, cast |
4 | 4 |
|
5 | 5 | from narwhals._compliant.expr import LazyExpr |
6 | | -from narwhals._compliant.typing import ( |
7 | | - AliasNames, |
8 | | - EvalNames, |
9 | | - EvalSeries, |
10 | | - NativeExprT, |
11 | | - WindowFunction, |
12 | | -) |
| 6 | +from narwhals._compliant.typing import AliasNames, WindowFunction |
13 | 7 | from narwhals._compliant.window import WindowInputs |
14 | 8 | from narwhals._expression_parsing import ( |
15 | 9 | combine_alias_output_names, |
16 | 10 | combine_evaluate_output_names, |
17 | 11 | ) |
18 | | -from narwhals._sql.typing import SQLLazyFrameT, NativeSQLExprT |
| 12 | +from narwhals._sql.typing import NativeSQLExprT, SQLLazyFrameT |
19 | 13 | from narwhals._utils import Implementation, Version, not_implemented |
20 | 14 |
|
21 | 15 | if TYPE_CHECKING: |
22 | 16 | from collections.abc import Iterable, Sequence |
23 | 17 |
|
24 | 18 | from typing_extensions import Self, TypeIs |
25 | 19 |
|
26 | | - from narwhals._compliant.typing import AliasNames, WindowFunction |
| 20 | + from narwhals._compliant.typing import ( |
| 21 | + AliasNames, |
| 22 | + EvalNames, |
| 23 | + EvalSeries, |
| 24 | + NativeExprT, |
| 25 | + WindowFunction, |
| 26 | + ) |
27 | 27 | from narwhals._expression_parsing import ExprMetadata |
28 | 28 | from narwhals._sql.namespace import SQLNamespace |
29 | 29 | from narwhals.typing import NumericLiteral, PythonLiteral, RankMethod, TemporalLiteral |
30 | 30 |
|
31 | | -# am I right in thinking we need to pass NativeSQLExprT here, not NativeExprT? since NativeSQLExprT |
32 | | -# inherits from it, I can use that througout in the code and it will also have its parents functionality. |
| 31 | + |
| 32 | +# am I right in thinking we need to pass NativeSQLExprT here, not NativeExprT? since NativeSQLExprT |
| 33 | +# inherits from it, I can use that througout in the code and it will also have its parents functionality. |
33 | 34 | # though at the moment there are still problems with the class.. |
34 | | -class SQLExpr(LazyExpr[SQLLazyFrameT, NativeSQLExprT], Protocol[SQLLazyFrameT, NativeSQLExprT]): |
| 35 | +class SQLExpr( |
| 36 | + LazyExpr[SQLLazyFrameT, NativeSQLExprT], Protocol[SQLLazyFrameT, NativeSQLExprT] |
| 37 | +): |
35 | 38 | _call: EvalSeries[SQLLazyFrameT, NativeSQLExprT] |
36 | 39 | _evaluate_output_names: EvalNames[SQLLazyFrameT] |
37 | 40 | _alias_output_names: AliasNames | None |
@@ -498,13 +501,12 @@ def round(self, decimals: int) -> Self: |
498 | 501 | return self._with_elementwise( |
499 | 502 | lambda expr: self._function("round", expr, self._lit(decimals)) |
500 | 503 | ) |
501 | | - # WIP: trying new NativeSQLExprT |
| 504 | + |
| 505 | + # WIP: trying new NativeSQLExprT |
502 | 506 | def sqrt(self) -> Self: |
503 | 507 | def _sqrt(expr: NativeSQLExprT) -> NativeSQLExprT: |
504 | 508 | return self._when( |
505 | | - expr < self._lit(0), |
506 | | - self._lit(float("nan")), |
507 | | - self._function("sqrt", expr), |
| 509 | + expr < self._lit(0), self._lit(float("nan")), self._function("sqrt", expr) |
508 | 510 | ) |
509 | 511 |
|
510 | 512 | return self._with_elementwise(_sqrt) |
|
0 commit comments