Skip to content

Commit

Permalink
Support ruff 0.5.0 in CI (#7009)
Browse files Browse the repository at this point in the history
* Revert "Fix CI by temporarily pinning ruff < 0.5.0"

This reverts commit dd63143.

* Use is for type comparison

* Use isinstance for instance check

* Replace is with equality comparison
  • Loading branch information
albertvillanova authored Jun 28, 2024
1 parent 70e7355 commit a16477d
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@
TESTS_REQUIRE.extend(VISION_REQUIRE)
TESTS_REQUIRE.extend(AUDIO_REQUIRE)

QUALITY_REQUIRE = ["ruff>=0.3.0,<0.5.0"]
QUALITY_REQUIRE = ["ruff>=0.3.0"]

DOCS_REQUIRE = [
# Might need to add doc-builder and some specific deps in the future
Expand Down
2 changes: 1 addition & 1 deletion src/datasets/features/features.py
Original file line number Diff line number Diff line change
Expand Up @@ -841,7 +841,7 @@ def __array__(self, dtype=None):
https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.api.extensions.ExtensionArray.html#pandas.api.extensions.ExtensionArray
"""
if dtype == object:
if dtype == np.dtype(object):
out = np.empty(len(self._data), dtype=object)
for i in range(len(self._data)):
out[i] = self._data[i]
Expand Down
2 changes: 1 addition & 1 deletion tests/features/test_array_xd.py
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ def test_table_to_pandas(dtype, dummy_value):
features = datasets.Features({"foo": datasets.Array2D(dtype=dtype, shape=(2, 2))})
dataset = datasets.Dataset.from_dict({"foo": [[[dummy_value] * 2] * 2]}, features=features)
df = dataset._data.to_pandas()
assert type(df.foo.dtype) == PandasArrayExtensionDtype
assert isinstance(df.foo.dtype, PandasArrayExtensionDtype)
arr = df.foo.to_numpy()
np.testing.assert_equal(arr, np.array([[[dummy_value] * 2] * 2], dtype=np.dtype(dtype)))

Expand Down

0 comments on commit a16477d

Please sign in to comment.