Skip to content
forked from pydata/xarray

Commit

Permalink
Revert "Handle Indexing Adapter classes explicitly."
Browse files Browse the repository at this point in the history
This reverts commit 46d98ec.
  • Loading branch information
dcherian committed Jan 18, 2023
1 parent 46d98ec commit b19a24b
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions xarray/core/indexing.py
Original file line number Diff line number Diff line change
Expand Up @@ -528,8 +528,7 @@ def shape(self) -> tuple[int, ...]:
def get_duck_array(self):
array = as_indexable(self.array)
array = array[self.key]
if not isinstance(self.array, IndexingAdapter):
array = array.get_duck_array()
array = array.get_duck_array()
return array

def transpose(self, order):
Expand Down Expand Up @@ -1239,11 +1238,7 @@ def is_fancy_indexer(indexer: Any) -> bool:
return True


class IndexingAdapter:
pass


class NumpyIndexingAdapter(ExplicitlyIndexedNDArrayMixin, IndexingAdapter):
class NumpyIndexingAdapter(ExplicitlyIndexedNDArrayMixin):
"""Wrap a NumPy array to use explicit indexing."""

__slots__ = ("array",)
Expand Down Expand Up @@ -1309,7 +1304,7 @@ def __init__(self, array):
self.array = array


class ArrayApiIndexingAdapter(ExplicitlyIndexedNDArrayMixin, IndexingAdapter):
class ArrayApiIndexingAdapter(ExplicitlyIndexedNDArrayMixin):
"""Wrap an array API array to use explicit indexing."""

__slots__ = ("array",)
Expand Down Expand Up @@ -1352,7 +1347,7 @@ def transpose(self, order):
return xp.permute_dims(self.array, order)


class DaskIndexingAdapter(ExplicitlyIndexedNDArrayMixin, IndexingAdapter):
class DaskIndexingAdapter(ExplicitlyIndexedNDArrayMixin):
"""Wrap a dask array to support explicit indexing."""

__slots__ = ("array",)
Expand Down Expand Up @@ -1428,7 +1423,7 @@ def transpose(self, order):
return self.array.transpose(order)


class PandasIndexingAdapter(ExplicitlyIndexedNDArrayMixin, IndexingAdapter):
class PandasIndexingAdapter(ExplicitlyIndexedNDArrayMixin):
"""Wrap a pandas.Index to preserve dtypes and handle explicit indexing."""

__slots__ = ("array", "_dtype")
Expand Down

0 comments on commit b19a24b

Please sign in to comment.