File tree 4 files changed +11
-9
lines changed
4 files changed +11
-9
lines changed Original file line number Diff line number Diff line change 19
19
20
20
21
21
def extract_native (obj : Any , implementation : str ) -> Any :
22
- from narwhals .expression import PandasExpr
23
22
from narwhals .series import Series
24
23
25
24
# if isinstance(obj, NarwhalsExpr):
Original file line number Diff line number Diff line change 1
1
from __future__ import annotations
2
2
3
- from typing import Any , TYPE_CHECKING
4
- from typing import Iterable , Callable
3
+ from typing import TYPE_CHECKING
4
+ from typing import Any
5
+ from typing import Callable
6
+ from typing import Iterable
5
7
6
8
if TYPE_CHECKING :
7
- from narwhals .polars import Expr
8
9
from narwhals .pandas_like .expr import PandasExpr
10
+ from narwhals .polars import Expr
9
11
10
12
11
13
def extract_native (expr : Expr , other : Any ) -> Any :
Original file line number Diff line number Diff line change @@ -97,13 +97,14 @@ def parse_into_exprs(
97
97
98
98
99
99
def parse_into_expr (implementation : str , into_expr : IntoExpr ) -> PandasExpr :
100
- from narwhals .expression import PandasExpr
100
+ from narwhals .expression import Expr
101
+ from narwhals .pandas_like .expr import PandasExpr
101
102
from narwhals .pandas_like .namespace import Namespace
102
103
from narwhals .pandas_like .series import PandasSeries
103
104
104
105
plx = Namespace (implementation = implementation )
105
106
106
- if isinstance (into_expr , PandasExpr ):
107
+ if isinstance (into_expr , Expr ):
107
108
return into_expr ._call (plx )
108
109
if isinstance (into_expr , str ):
109
110
return plx .col (into_expr )
Original file line number Diff line number Diff line change 26
26
27
27
28
28
def extract_native (obj : Any ) -> Any :
29
- from narwhals .expression import PandasExpr
29
+ from narwhals .expression import Expr
30
30
31
- if isinstance (obj , PandasExpr ):
31
+ if isinstance (obj , Expr ):
32
32
return obj ._call (pl )
33
- if isinstance (obj , PandasExpr ):
33
+ if isinstance (obj , PolarsExpr ):
34
34
return obj ._expr
35
35
if isinstance (obj , DType ):
36
36
return obj ._dtype
You can’t perform that action at this time.
0 commit comments