Skip to content

Commit

Permalink
fix(typing): Backport from_native overload fixes to v1
Browse files Browse the repository at this point in the history
Aligns with narwhals-dev#1935, without using `IntoSeriesT` as `v1.Series` is not generic https://narwhals-dev.github.io/narwhals/backcompat/#breaking-changes-carried-out-so-far
  • Loading branch information
dangotbanned committed Feb 6, 2025
1 parent c2384b8 commit 513aee3
Showing 1 changed file with 15 additions and 14 deletions.
29 changes: 15 additions & 14 deletions narwhals/stable/v1/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
from narwhals.translate import to_py_scalar
from narwhals.typing import IntoDataFrameT
from narwhals.typing import IntoFrameT
from narwhals.typing import IntoSeriesT
from narwhals.typing import IntoSeriesT as IntoSeriesT # noqa: PLC0414
from narwhals.utils import Implementation
from narwhals.utils import Version
from narwhals.utils import find_stacklevel
Expand All @@ -90,6 +90,7 @@
from narwhals.dtypes import DType
from narwhals.functions import ArrowStreamExportable
from narwhals.typing import IntoExpr
from narwhals.typing import IntoFrame
from narwhals.typing import IntoSeries

T = TypeVar("T")
Expand Down Expand Up @@ -1124,7 +1125,7 @@ def _stableify(

@overload
def from_native(
native_object: IntoDataFrameT | IntoSeriesT,
native_object: IntoDataFrameT | IntoSeries,
*,
strict: Literal[False],
eager_only: Literal[False] = ...,
Expand All @@ -1136,7 +1137,7 @@ def from_native(

@overload
def from_native(
native_object: IntoDataFrameT | IntoSeriesT,
native_object: IntoDataFrameT | IntoSeries,
*,
strict: Literal[False],
eager_only: Literal[True],
Expand Down Expand Up @@ -1196,7 +1197,7 @@ def from_native(

@overload
def from_native(
native_object: IntoFrameT | IntoSeriesT,
native_object: IntoFrameT | IntoSeries,
*,
strict: Literal[False],
eager_only: Literal[False] = ...,
Expand All @@ -1208,7 +1209,7 @@ def from_native(

@overload
def from_native(
native_object: IntoSeriesT,
native_object: IntoSeries,
*,
strict: Literal[False],
eager_only: Literal[False] = ...,
Expand Down Expand Up @@ -1268,7 +1269,7 @@ def from_native(

@overload
def from_native(
native_object: IntoFrameT | IntoSeriesT,
native_object: IntoFrame | IntoSeries,
*,
strict: Literal[True] = ...,
eager_only: Literal[False] = ...,
Expand All @@ -1280,7 +1281,7 @@ def from_native(

@overload
def from_native(
native_object: IntoSeriesT | Any, # remain `Any` for downstream compatibility
native_object: IntoSeries | Any, # remain `Any` for downstream compatibility
*,
strict: Literal[True] = ...,
eager_only: Literal[False] = ...,
Expand All @@ -1304,7 +1305,7 @@ def from_native(

@overload
def from_native(
native_object: IntoDataFrameT | IntoSeriesT,
native_object: IntoDataFrameT | IntoSeries,
*,
pass_through: Literal[True],
eager_only: Literal[False] = ...,
Expand All @@ -1316,7 +1317,7 @@ def from_native(

@overload
def from_native(
native_object: IntoDataFrameT | IntoSeriesT,
native_object: IntoDataFrameT | IntoSeries,
*,
pass_through: Literal[True],
eager_only: Literal[True],
Expand Down Expand Up @@ -1376,7 +1377,7 @@ def from_native(

@overload
def from_native(
native_object: IntoFrameT | IntoSeriesT,
native_object: IntoFrameT | IntoSeries,
*,
pass_through: Literal[True],
eager_only: Literal[False] = ...,
Expand All @@ -1388,7 +1389,7 @@ def from_native(

@overload
def from_native(
native_object: IntoSeriesT,
native_object: IntoSeries,
*,
pass_through: Literal[True],
eager_only: Literal[False] = ...,
Expand Down Expand Up @@ -1448,7 +1449,7 @@ def from_native(

@overload
def from_native(
native_object: IntoFrameT | IntoSeriesT,
native_object: IntoFrame | IntoSeries,
*,
pass_through: Literal[False] = ...,
eager_only: Literal[False] = ...,
Expand All @@ -1460,7 +1461,7 @@ def from_native(

@overload
def from_native(
native_object: IntoSeriesT,
native_object: IntoSeries,
*,
pass_through: Literal[False] = ...,
eager_only: Literal[False] = ...,
Expand Down Expand Up @@ -1496,7 +1497,7 @@ def from_native(


def from_native(
native_object: IntoFrameT | IntoSeries | T,
native_object: IntoFrameT | IntoFrame | IntoSeries | T,
*,
strict: bool | None = None,
pass_through: bool | None = None,
Expand Down

0 comments on commit 513aee3

Please sign in to comment.