|
1 | 1 | from __future__ import annotations |
2 | 2 |
|
3 | | -from typing import TYPE_CHECKING, Any, Protocol, TypeVar, Union |
| 3 | +from typing import TYPE_CHECKING, Any, TypeVar, Union |
4 | 4 |
|
5 | 5 | if TYPE_CHECKING: |
6 | | - import sys |
7 | | - from collections.abc import Iterable, Sized |
| 6 | + from typing_extensions import TypeAlias |
8 | 7 |
|
9 | | - from narwhals.stable.v2 import DataFrame, LazyFrame |
10 | | - |
11 | | - if sys.version_info >= (3, 10): |
12 | | - from typing import TypeAlias |
13 | | - else: |
14 | | - from typing_extensions import TypeAlias |
15 | | - |
16 | | - from narwhals.stable.v2 import Expr, Series |
17 | | - |
18 | | - # All dataframes supported by Narwhals have a |
19 | | - # `columns` property. Their similarities don't extend |
20 | | - # _that_ much further unfortunately... |
21 | | - class NativeFrame(Protocol): |
22 | | - @property |
23 | | - def columns(self) -> Any: ... |
24 | | - |
25 | | - def join(self, *args: Any, **kwargs: Any) -> Any: ... |
26 | | - |
27 | | - class NativeDataFrame(Sized, NativeFrame, Protocol): ... |
28 | | - |
29 | | - class NativeLazyFrame(NativeFrame, Protocol): |
30 | | - def explain(self, *args: Any, **kwargs: Any) -> Any: ... |
31 | | - |
32 | | - class NativeSeries(Sized, Iterable[Any], Protocol): |
33 | | - def filter(self, *args: Any, **kwargs: Any) -> Any: ... |
| 8 | + from narwhals._native import NativeDataFrame, NativeLazyFrame, NativeSeries |
| 9 | + from narwhals.stable.v2 import DataFrame, Expr, LazyFrame, Series |
34 | 10 |
|
35 | 11 |
|
36 | 12 | IntoExpr: TypeAlias = Union["Expr", str, "Series[Any]"] |
|
0 commit comments