Skip to content

Commit cc53df6

Browse files
committed
refactor(typing): Use Incomplete marker
- `filter` accepts a `list` in some cases - `group_by` will need `CompliantGroupBy` - See also #2184 (comment)
1 parent c9b57a2 commit cc53df6

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

narwhals/_compliant/dataframe.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
import polars as pl
2727
import pyarrow as pa
2828
from typing_extensions import Self
29+
from typing_extensions import TypeAlias
2930
from typing_extensions import TypeIs
3031

3132
from narwhals._compliant.expr import EagerExpr
@@ -34,6 +35,8 @@
3435
from narwhals.typing import _2DArray
3536
from narwhals.utils import Implementation
3637

38+
Incomplete: TypeAlias = Any
39+
3740
__all__ = ["CompliantDataFrame", "CompliantLazyFrame", "EagerDataFrame"]
3841

3942
T = TypeVar("T")
@@ -69,10 +72,10 @@ def collect_schema(self) -> Mapping[str, DType]: ...
6972
def drop(self, columns: Sequence[str], *, strict: bool) -> Self: ...
7073
def drop_nulls(self, subset: Sequence[str] | None) -> Self: ...
7174
def estimated_size(self, unit: SizeUnit) -> int | float: ...
72-
def filter(self, predicate: CompliantExprT_contra | Any) -> Self: ...
75+
def filter(self, predicate: CompliantExprT_contra | Incomplete) -> Self: ...
7376
def gather_every(self, n: int, offset: int) -> Self: ...
7477
def get_column(self, name: str) -> CompliantSeriesT: ...
75-
def group_by(self, *keys: str, drop_null_keys: bool) -> Any: ...
78+
def group_by(self, *keys: str, drop_null_keys: bool) -> Incomplete: ...
7679
def head(self, n: int) -> Self: ...
7780
def item(self, row: int | None, column: int | str | None) -> Any: ...
7881
def iter_columns(self) -> Iterator[CompliantSeriesT]: ...

0 commit comments

Comments
 (0)