Skip to content

Commit d988a24

Browse files
committed
refactor(typing): Add single pass_through case
1 parent ceaf9e7 commit d988a24

File tree

1 file changed

+11
-22
lines changed

1 file changed

+11
-22
lines changed

narwhals/translate.py

Lines changed: 11 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,13 @@ class EagerLazySeriesAllow(TypedDict):
158158
allow_series: Literal[True]
159159

160160

161+
class PassThroughUnknown(TypedDict):
162+
pass_through: Literal[True]
163+
eager_only: NotRequired[bool]
164+
series_only: NotRequired[bool]
165+
allow_series: NotRequired[bool | None]
166+
167+
161168
@overload
162169
def from_native(native_object: SeriesT, **kwds: Any) -> SeriesT: ...
163170

@@ -200,35 +207,17 @@ def from_native(
200207
) -> DataFrame[IntoDataFrameT] | Series[IntoSeriesT]: ...
201208

202209

203-
@overload
204-
def from_native(
205-
native_object: T,
206-
*,
207-
pass_through: Literal[True],
208-
eager_only: Literal[False] = ...,
209-
series_only: Literal[False] = ...,
210-
allow_series: None = ...,
211-
) -> T: ...
212-
213-
214-
@overload
215-
def from_native(
216-
native_object: T,
217-
*,
218-
pass_through: Literal[True],
219-
eager_only: Literal[True],
220-
series_only: Literal[False] = ...,
221-
allow_series: None = ...,
222-
) -> T: ...
223-
224-
225210
@overload
226211
def from_native(
227212
native_object: IntoDataFrameT | IntoLazyFrameT | IntoSeriesT,
228213
**kwds: Unpack[EagerLazySeriesAllow],
229214
) -> DataFrame[IntoDataFrameT] | LazyFrame[IntoLazyFrameT] | Series[IntoSeriesT]: ...
230215

231216

217+
@overload
218+
def from_native(native_object: T, **kwds: Unpack[PassThroughUnknown]) -> T: ...
219+
220+
232221
# All params passed in as variables
233222
@overload
234223
def from_native(

0 commit comments

Comments
 (0)