Skip to content

Commit c368a60

Browse files
committed
docs(typing): Explain is_eager_expr
Really hate this as a solution and keep trying to get `mypy` to let me do something else
1 parent 8ec9cd9 commit c368a60

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

narwhals/_compliant/dataframe.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ def _iter_columns(self) -> Iterator[Any]: ...
6161

6262
class EagerDataFrame(CompliantDataFrame[EagerSeriesT_co], Protocol[EagerSeriesT_co]):
6363
def _maybe_evaluate_expr(
64-
self, expr: EagerExpr[EagerDataFrame[EagerSeriesT_co], EagerSeriesT_co] | T, /
64+
self, expr: EagerExpr[Self, EagerSeriesT_co] | T, /
6565
) -> EagerSeriesT_co | T:
6666
if is_eager_expr(expr):
6767
result: Sequence[EagerSeriesT_co] = expr(self)
@@ -75,7 +75,8 @@ def _maybe_evaluate_expr(
7575
return expr
7676

7777

78-
# NOTE: DON'T CHANGE THIS EITHER
78+
# NOTE: `mypy` is requiring the gymnastics here and is very fragile
79+
# DON'T CHANGE THIS or `EagerDataFrame._maybe_evaluate_expr`
7980
def is_eager_expr(
8081
obj: EagerExpr[Any, EagerSeriesT] | Any,
8182
) -> TypeIs[EagerExpr[Any, EagerSeriesT]]:

0 commit comments

Comments
 (0)