4646 from narwhals .typing import IntoDataFrameT
4747 from narwhals .typing import IntoFrame
4848 from narwhals .typing import IntoFrameT
49+ from narwhals .typing import IntoLazyFrameT
4950 from narwhals .typing import IntoSeries
5051 from narwhals .typing import IntoSeriesT
5152
@@ -194,13 +195,13 @@ def from_native(
194195
195196@overload
196197def from_native (
197- native_object : IntoFrameT | IntoSeriesT ,
198+ native_object : IntoFrameT | IntoLazyFrameT | IntoSeriesT ,
198199 * ,
199200 pass_through : Literal [True ],
200201 eager_only : Literal [False ] = ...,
201202 series_only : Literal [False ] = ...,
202203 allow_series : Literal [True ],
203- ) -> DataFrame [IntoFrameT ] | LazyFrame [IntoFrameT ] | Series [IntoSeriesT ]: ...
204+ ) -> DataFrame [IntoFrameT ] | LazyFrame [IntoLazyFrameT ] | Series [IntoSeriesT ]: ...
204205
205206
206207@overload
@@ -214,6 +215,21 @@ def from_native(
214215) -> Series [IntoSeriesT ]: ...
215216
216217
218+ # NOTE: Seems like `mypy` is giving a false positive
219+ # Following this advice will introduce overlapping overloads?
220+ # > note: Flipping the order of overloads will fix this error
221+ @overload
222+ def from_native ( # type: ignore[overload-overlap]
223+ native_object : IntoLazyFrameT ,
224+ * ,
225+ pass_through : Literal [False ] = ...,
226+ eager_only : Literal [False ] = ...,
227+ series_only : Literal [False ] = ...,
228+ allow_series : None = ...,
229+ ) -> LazyFrame [IntoLazyFrameT ]: ...
230+
231+
232+ # NOTE: `pl.LazyFrame` originally matched here
217233@overload
218234def from_native (
219235 native_object : IntoDataFrameT ,
@@ -260,13 +276,13 @@ def from_native(
260276
261277@overload
262278def from_native (
263- native_object : IntoFrameT ,
279+ native_object : IntoFrameT | IntoLazyFrameT ,
264280 * ,
265281 pass_through : Literal [False ] = ...,
266282 eager_only : Literal [False ] = ...,
267283 series_only : Literal [False ] = ...,
268284 allow_series : None = ...,
269- ) -> DataFrame [IntoFrameT ] | LazyFrame [IntoFrameT ]: ...
285+ ) -> DataFrame [IntoFrameT ] | LazyFrame [IntoLazyFrameT ]: ...
270286
271287
272288# All params passed in as variables
@@ -282,14 +298,14 @@ def from_native(
282298
283299
284300def from_native (
285- native_object : IntoFrameT | IntoSeriesT | IntoFrame | IntoSeries | T ,
301+ native_object : IntoLazyFrameT | IntoFrameT | IntoSeriesT | IntoFrame | IntoSeries | T ,
286302 * ,
287303 strict : bool | None = None ,
288304 pass_through : bool | None = None ,
289305 eager_only : bool = False ,
290306 series_only : bool = False ,
291307 allow_series : bool | None = None ,
292- ) -> LazyFrame [IntoFrameT ] | DataFrame [IntoFrameT ] | Series [IntoSeriesT ] | T :
308+ ) -> LazyFrame [IntoLazyFrameT ] | DataFrame [IntoFrameT ] | Series [IntoSeriesT ] | T :
293309 """Convert `native_object` to Narwhals Dataframe, Lazyframe, or Series.
294310
295311 Arguments:
0 commit comments