10
10
from dataclasses import dataclass , field
11
11
from datetime import timedelta
12
12
from html import escape
13
- from typing import TYPE_CHECKING , Any , Literal , overload
13
+ from typing import TYPE_CHECKING , Any , overload
14
14
15
15
import numpy as np
16
16
import pandas as pd
@@ -1177,29 +1177,6 @@ def explicit_indexing_adapter(
1177
1177
raise TypeError (f"unexpected key type: { key } " )
1178
1178
1179
1179
1180
- class CompatIndexedTuple (tuple ):
1181
- """
1182
- A tuple subclass used to transition existing backend implementations towards the use of raw tuples
1183
- for indexing by carrying additional metadata about the type of indexing being
1184
- performed ('basic', 'vectorized', or 'outer'). This class serves as a bridge, allowing
1185
- backend arrays that currently expect this metadata to function correctly while
1186
- maintaining the outward behavior of a regular tuple.
1187
-
1188
- This class is particularly useful during the phase where the backend implementations are
1189
- not yet capable of directly accepting raw tuples without additional context about
1190
- the indexing type. It ensures that these backends can still correctly interpret and
1191
- process indexing operations by providing them with the necessary contextual information.
1192
- """
1193
-
1194
- def __new__ (cls , iterable , indexer_type : Literal ["basic" , "vectorized" , "outer" ]):
1195
- obj = super ().__new__ (cls , iterable )
1196
- obj .indexer_type = indexer_type # type: ignore[attr-defined]
1197
- return obj
1198
-
1199
- def __repr__ (self ):
1200
- return f"CompatIndexedTuple({ super ().__repr__ ()} , indexer_type='{ self .indexer_type } ')"
1201
-
1202
-
1203
1180
def apply_indexer (indexable , indexer : ExplicitIndexer ) -> Any :
1204
1181
"""Apply an indexer to an indexable object."""
1205
1182
if isinstance (indexer , VectorizedIndexer ):
@@ -1226,19 +1203,8 @@ def set_with_indexer(indexable, indexer: ExplicitIndexer, value: Any) -> None:
1226
1203
1227
1204
1228
1205
def decompose_indexer (
1229
- indexer : ExplicitIndexer | CompatIndexedTuple ,
1230
- shape : _Shape ,
1231
- indexing_support : IndexingSupport ,
1206
+ indexer : ExplicitIndexer , shape : _Shape , indexing_support : IndexingSupport
1232
1207
) -> tuple [ExplicitIndexer , ExplicitIndexer ]:
1233
- if isinstance (indexer , CompatIndexedTuple ):
1234
- # recreate the indexer object from the tuple and the type of indexing.
1235
- # This is necessary to ensure that the backend array can correctly interpret the indexing operation.
1236
- if indexer .indexer_type == "vectorized" : # type: ignore[attr-defined]
1237
- indexer = VectorizedIndexer (indexer )
1238
- elif indexer .indexer_type == "outer" : # type: ignore[attr-defined]
1239
- indexer = OuterIndexer (indexer )
1240
- else :
1241
- indexer = BasicIndexer (indexer )
1242
1208
if isinstance (indexer , VectorizedIndexer ):
1243
1209
return _decompose_vectorized_indexer (indexer , shape , indexing_support )
1244
1210
if isinstance (indexer , BasicIndexer | OuterIndexer ):
0 commit comments