@@ -173,7 +173,7 @@ def __array__(
173
173
) -> np .ndarray :
174
174
raise UnexpectedDataAccess ("Tried accessing data" )
175
175
176
- def __getitem__ (self , key ) -> "ConcatenatableArray" :
176
+ def __getitem__ (self , key ) -> Self :
177
177
"""Some cases of concat require supporting expanding dims by dimensions of size 1"""
178
178
# see https://data-apis.org/array-api/2022.12/API_specification/indexing.html#multi-axis-indexing
179
179
arr = self ._array
@@ -186,7 +186,7 @@ def __getitem__(self, key) -> "ConcatenatableArray":
186
186
raise UnexpectedDataAccess ("Tried accessing data." )
187
187
return ConcatenatableArray (arr )
188
188
189
- def __eq__ (self , other : "ConcatenatableArray" ) -> "ConcatenatableArray" :
189
+ def __eq__ (self , other : Self ) -> Self : # type: ignore[override]
190
190
return ConcatenatableArray (self ._array == other ._array )
191
191
192
192
def __array_function__ (self , func , types , args , kwargs ) -> Any :
@@ -204,15 +204,15 @@ def __array_ufunc__(self, ufunc, method, *inputs, **kwargs) -> Any:
204
204
"""We have to define this in order to convince xarray that this class is a duckarray, even though we will never support ufuncs."""
205
205
return NotImplemented
206
206
207
- def astype (self , dtype : np .dtype , / , * , copy : bool = True ) -> "ConcatenatableArray" :
207
+ def astype (self , dtype : np .dtype , / , * , copy : bool = True ) -> Self :
208
208
"""Needed because xarray will call this even when it's a no-op"""
209
209
if dtype != self .dtype :
210
210
raise NotImplementedError ()
211
211
else :
212
212
return self
213
213
214
- def __and__ (self , other : Self ) -> "ConcatenatableArray" :
214
+ def __and__ (self , other : Self ) -> Self :
215
215
return type (self )(self ._array & other ._array )
216
216
217
- def __or__ (self , other : Self ) -> "ConcatenatableArray" :
217
+ def __or__ (self , other : Self ) -> Self :
218
218
return type (self )(self ._array | other ._array )
0 commit comments