Skip to content

Commit 11fec41

Browse files
committed
Revert "Add IndexingAdapter mixin class"
This reverts commit 930f24d.
1 parent afa9fb3 commit 11fec41

File tree

1 file changed

+7
-19
lines changed

1 file changed

+7
-19
lines changed

xarray/core/indexing.py

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -520,7 +520,8 @@ class ExplicitlyIndexedNDArrayMixin(NDArrayMixin, ExplicitlyIndexed):
520520
__slots__ = ()
521521

522522
def get_duck_array(self):
523-
raise NotImplementedError
523+
key = BasicIndexer((slice(None),) * self.ndim)
524+
return self[key]
524525

525526
def _oindex_get(self, indexer: OuterIndexer):
526527
raise NotImplementedError(
@@ -558,17 +559,6 @@ def vindex(self) -> IndexCallable:
558559
return IndexCallable(self._vindex_get, self._vindex_set)
559560

560561

561-
class IndexingAdapter:
562-
"""Marker class for indexing adapters.
563-
These classes translate between Xarray's indexing semantics and the underlying array's
564-
indexing semantics.
565-
"""
566-
567-
def get_duck_array(self):
568-
key = BasicIndexer((slice(None),) * self.ndim)
569-
return self[key]
570-
571-
572562
class ImplicitToExplicitIndexingAdapter(NDArrayMixin):
573563
"""Wrap an array, converting tuples into the indicated explicit indexer."""
574564

@@ -1537,7 +1527,7 @@ def is_fancy_indexer(indexer: Any) -> bool:
15371527
return True
15381528

15391529

1540-
class NumpyIndexingAdapter(IndexingAdapter, ExplicitlyIndexedNDArrayMixin):
1530+
class NumpyIndexingAdapter(ExplicitlyIndexedNDArrayMixin):
15411531
"""Wrap a NumPy array to use explicit indexing."""
15421532

15431533
__slots__ = ("array",)
@@ -1616,7 +1606,7 @@ def __init__(self, array):
16161606
self.array = array
16171607

16181608

1619-
class ArrayApiIndexingAdapter(IndexingAdapter, ExplicitlyIndexedNDArrayMixin):
1609+
class ArrayApiIndexingAdapter(ExplicitlyIndexedNDArrayMixin):
16201610
"""Wrap an array API array to use explicit indexing."""
16211611

16221612
__slots__ = ("array",)
@@ -1681,7 +1671,7 @@ def _assert_not_chunked_indexer(idxr: tuple[Any, ...]) -> None:
16811671
)
16821672

16831673

1684-
class DaskIndexingAdapter(IndexingAdapter, ExplicitlyIndexedNDArrayMixin):
1674+
class DaskIndexingAdapter(ExplicitlyIndexedNDArrayMixin):
16851675
"""Wrap a dask array to support explicit indexing."""
16861676

16871677
__slots__ = ("array",)
@@ -1757,7 +1747,7 @@ def transpose(self, order):
17571747
return self.array.transpose(order)
17581748

17591749

1760-
class PandasIndexingAdapter(IndexingAdapter, ExplicitlyIndexedNDArrayMixin):
1750+
class PandasIndexingAdapter(ExplicitlyIndexedNDArrayMixin):
17611751
"""Wrap a pandas.Index to preserve dtypes and handle explicit indexing."""
17621752

17631753
__slots__ = ("_dtype", "array")
@@ -2078,9 +2068,7 @@ def copy(self, deep: bool = True) -> Self:
20782068
return type(self)(array, self._dtype, self.level)
20792069

20802070

2081-
class CoordinateTransformIndexingAdapter(
2082-
IndexingAdapter, ExplicitlyIndexedNDArrayMixin
2083-
):
2071+
class CoordinateTransformIndexingAdapter(ExplicitlyIndexedNDArrayMixin):
20842072
"""Wrap a CoordinateTransform as a lazy coordinate array.
20852073
20862074
Supports explicit indexing (both outer and vectorized).

0 commit comments

Comments
 (0)