|
2 | 2 |
|
3 | 3 | from typing import TYPE_CHECKING |
4 | 4 | from typing import Any |
| 5 | +from typing import Container |
| 6 | +from typing import Iterable |
| 7 | +from typing import Literal |
5 | 8 | from typing import Protocol |
6 | 9 |
|
| 10 | +from narwhals._compliant.typing import CompliantExprT |
7 | 11 | from narwhals._compliant.typing import CompliantFrameT |
8 | | -from narwhals._compliant.typing import CompliantSeriesOrNativeExprT_co |
9 | 12 | from narwhals._compliant.typing import EagerDataFrameT |
10 | 13 | from narwhals._compliant.typing import EagerExprT |
11 | 14 | from narwhals._compliant.typing import EagerSeriesT_co |
12 | 15 | from narwhals.utils import deprecated |
13 | 16 |
|
14 | 17 | if TYPE_CHECKING: |
15 | | - from narwhals._compliant.expr import CompliantExpr |
16 | 18 | from narwhals._compliant.selectors import CompliantSelectorNamespace |
17 | 19 | from narwhals.dtypes import DType |
18 | 20 |
|
19 | 21 | __all__ = ["CompliantNamespace", "EagerNamespace"] |
20 | 22 |
|
21 | 23 |
|
22 | | -class CompliantNamespace(Protocol[CompliantFrameT, CompliantSeriesOrNativeExprT_co]): |
23 | | - def col( |
24 | | - self, *column_names: str |
25 | | - ) -> CompliantExpr[CompliantFrameT, CompliantSeriesOrNativeExprT_co]: ... |
26 | | - def lit( |
27 | | - self, value: Any, dtype: DType | None |
28 | | - ) -> CompliantExpr[CompliantFrameT, CompliantSeriesOrNativeExprT_co]: ... |
| 24 | +class CompliantNamespace(Protocol[CompliantFrameT, CompliantExprT]): |
| 25 | + def col(self, *column_names: str) -> CompliantExprT: ... |
| 26 | + def lit(self, value: Any, dtype: DType | None) -> CompliantExprT: ... |
| 27 | + def exclude(self, excluded_names: Container[str]) -> CompliantExprT: ... |
| 28 | + def nth(self, *column_indices: int) -> CompliantExprT: ... |
| 29 | + def len(self) -> CompliantExprT: ... |
| 30 | + def all(self) -> CompliantExprT: ... |
| 31 | + def all_horizontal(self, *exprs: CompliantExprT) -> CompliantExprT: ... |
| 32 | + def any_horizontal(self, *exprs: CompliantExprT) -> CompliantExprT: ... |
| 33 | + def sum_horizontal(self, *exprs: CompliantExprT) -> CompliantExprT: ... |
| 34 | + def mean_horizontal(self, *exprs: CompliantExprT) -> CompliantExprT: ... |
| 35 | + def min_horizontal(self, *exprs: CompliantExprT) -> CompliantExprT: ... |
| 36 | + def max_horizontal(self, *exprs: CompliantExprT) -> CompliantExprT: ... |
| 37 | + def concat( |
| 38 | + self, |
| 39 | + items: Iterable[CompliantFrameT], |
| 40 | + *, |
| 41 | + how: Literal["horizontal", "vertical", "diagonal"], |
| 42 | + ) -> CompliantFrameT: ... |
| 43 | + def when(self, predicate: CompliantExprT) -> Any: ... |
| 44 | + def concat_str( |
| 45 | + self, |
| 46 | + *exprs: CompliantExprT, |
| 47 | + separator: str, |
| 48 | + ignore_nulls: bool, |
| 49 | + ) -> CompliantExprT: ... |
29 | 50 | @property |
30 | 51 | def selectors(self) -> CompliantSelectorNamespace[Any, Any]: ... |
| 52 | + @property |
| 53 | + def _expr(self) -> type[CompliantExprT]: ... |
31 | 54 |
|
32 | 55 |
|
33 | 56 | class EagerNamespace( |
34 | | - CompliantNamespace[EagerDataFrameT, EagerSeriesT_co], |
| 57 | + CompliantNamespace[EagerDataFrameT, EagerExprT], |
35 | 58 | Protocol[EagerDataFrameT, EagerSeriesT_co, EagerExprT], |
36 | 59 | ): |
37 | 60 | @property |
|
0 commit comments