Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Remove deprecated nw.from_native(..., strict=True) #3811

Merged
merged 1 commit into from
Feb 27, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion altair/utils/schemapi.py
Original file line number Diff line number Diff line change
@@ -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)
6 changes: 3 additions & 3 deletions tests/test_transformed_data.py
Original file line number Diff line number Diff line change
@@ -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))
@@ -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
@@ -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
2 changes: 1 addition & 1 deletion tools/schemapi/schemapi.py
Original file line number Diff line number Diff line change
@@ -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)