Skip to content

Commit

Permalink
use overload
Browse files Browse the repository at this point in the history
  • Loading branch information
FBruzzesi committed Aug 25, 2024
1 parent 84ba6c2 commit f60793e
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions narwhals/stable/v1.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@
from narwhals.typing import IntoExpr

T = TypeVar("T")
FrameT = TypeVar("FrameT", "DataFrame[Any]", "LazyFrame[Any]")


class DataFrame(NwDataFrame[IntoDataFrameT]):
Expand Down Expand Up @@ -1338,11 +1337,27 @@ def mean_horizontal(*exprs: IntoExpr | Iterable[IntoExpr]) -> Expr:
return _stableify(nw.mean_horizontal(*exprs))


@overload
def concat(
items: Iterable[NwDataFrame[Any]],
*,
how: Literal["horizontal", "vertical"] = "vertical",
) -> DataFrame[Any]: ...


@overload
def concat(
items: Iterable[NwLazyFrame[Any]],
*,
how: Literal["horizontal", "vertical"] = "vertical",
) -> LazyFrame[Any]: ...


def concat(
items: Iterable[FrameT],
items: Iterable[NwDataFrame[Any] | NwLazyFrame[Any]],
*,
how: Literal["horizontal", "vertical"] = "vertical",
) -> FrameT:
) -> DataFrame[Any] | LazyFrame[Any]:
return _stableify(nw.concat(items, how=how)) # type: ignore[no-any-return]


Expand Down

0 comments on commit f60793e

Please sign in to comment.