Skip to content

Commit

Permalink
refactor(typing): lie more explicitly
Browse files Browse the repository at this point in the history
  • Loading branch information
dangotbanned committed Feb 8, 2025
1 parent a2181c6 commit 3bcebc1
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions narwhals/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from typing import TYPE_CHECKING
from typing import Iterable
from typing import Mapping
from typing import cast

from narwhals.utils import Implementation
from narwhals.utils import Version
Expand Down Expand Up @@ -205,6 +206,6 @@ def to_polars(self: Self) -> pl.Schema:
(name, narwhals_to_native_dtype(dtype, self._version))
for name, dtype in self.items()
)
if parse_version(pl.__version__) < (1, 0, 0): # pragma: no cover
return dict(schema) # type: ignore[return-value]
return pl.Schema(schema)
if parse_version(pl.__version__) >= (1, 0, 0): # pragma: no cover
return pl.Schema(schema)
return cast("pl.Schema", dict(schema))

0 comments on commit 3bcebc1

Please sign in to comment.