Skip to content

Commit

Permalink
circular imports
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcoGorelli committed Mar 21, 2024
1 parent b568080 commit 9ab3d4d
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions narwhals/translate.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
from typing import TYPE_CHECKING
from typing import Any

from narwhals.dataframe import DataFrame
from narwhals.dataframe import LazyFrame
from narwhals.dependencies import get_cudf
from narwhals.dependencies import get_modin
from narwhals.dependencies import get_pandas
Expand Down Expand Up @@ -33,6 +31,9 @@ def to_native(obj: BaseFrame | Series) -> Any:


def from_native(df: Any) -> BaseFrame:
from narwhals.dataframe import DataFrame
from narwhals.dataframe import LazyFrame

if (pl := get_polars()) is not None and isinstance(df, pl.DataFrame):
return DataFrame(df)
elif (pl := get_polars()) is not None and isinstance(df, pl.LazyFrame):
Expand Down

0 comments on commit 9ab3d4d

Please sign in to comment.