Skip to content

Commit

Permalink
chore: Remove deprecated nw.from_native(..., strict=True)
Browse files Browse the repository at this point in the history
Spotted during an upstream integration test
- narwhals-dev/narwhals#2110 (comment)

IIRC, I added `strict` before it was [deprecated](https://narwhals-dev.github.io/narwhals/backcompat/#breaking-changes-carried-out-so-far) to help match an `@overload`.
Since then, the `@overload` definitions in `narwhals` have improved - meaning the default **doesn't** need to be passed in for us to get it typing correctly

# Related
- #3693
- narwhals-dev/narwhals#2110
  • Loading branch information
dangotbanned committed Feb 27, 2025
1 parent a196172 commit 1e962df
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion altair/utils/schemapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,7 @@ def _subclasses(cls: type[Any]) -> Iterator[type[Any]]:

def _from_array_like(obj: Iterable[Any], /) -> list[Any]:
try:
ser = nw.from_native(obj, strict=True, series_only=True)
ser = nw.from_native(obj, series_only=True)
return ser.to_list()
except TypeError:
return list(obj)
Expand Down
6 changes: 3 additions & 3 deletions tests/test_transformed_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ def test_primitive_chart_examples(filename, rows, cols, to_reconstruct):
chart = alt.Chart.from_dict(chart.to_dict())
df = chart.transformed_data()
assert df is not None
nw_df = nw.from_native(df, eager_only=True, strict=True)
nw_df = nw.from_native(df, eager_only=True)

assert len(nw_df) == rows
assert set(cols).issubset(set(nw_df.columns))
Expand Down Expand Up @@ -157,7 +157,7 @@ def test_compound_chart_examples(filename, all_rows, all_cols, to_reconstruct):
# is that for some charts, the original chart contained duplicated datasets
# which disappear when reconstructing the chart.

nw_dfs = (nw.from_native(d, eager_only=True, strict=True) for d in dfs)
nw_dfs = (nw.from_native(d, eager_only=True) for d in dfs)
assert len(dfs) == len(all_rows)
for df, rows, cols in zip(nw_dfs, all_rows, all_cols):
assert len(df) == rows
Expand Down Expand Up @@ -185,7 +185,7 @@ def test_transformed_data_exclude(to_reconstruct):
assert isinstance(chart, alt.LayerChart)
datasets = chart.transformed_data(exclude=["some_annotation"])

_datasets = [nw.from_native(d, eager_only=True, strict=True) for d in datasets]
_datasets = [nw.from_native(d, eager_only=True) for d in datasets]
assert len(datasets) == len(_datasets)
assert len(_datasets) == 2
assert len(_datasets[0]) == 52
Expand Down
2 changes: 1 addition & 1 deletion tools/schemapi/schemapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -492,7 +492,7 @@ def _subclasses(cls: type[Any]) -> Iterator[type[Any]]:

def _from_array_like(obj: Iterable[Any], /) -> list[Any]:
try:
ser = nw.from_native(obj, strict=True, series_only=True)
ser = nw.from_native(obj, series_only=True)
return ser.to_list()
except TypeError:
return list(obj)
Expand Down

0 comments on commit 1e962df

Please sign in to comment.