6565 is_timedelta64_dtype ,
6666 needs_i8_conversion ,
6767)
68+ from pandas .core .dtypes .dtypes import ExtensionDtype
6869from pandas .core .dtypes .generic import ABCCategoricalIndex
6970from pandas .core .dtypes .missing import (
7071 isna ,
@@ -522,7 +523,7 @@ def _disallow_invalid_ops(self, values: ArrayLike, how: str):
522523 @final
523524 def _ea_wrap_cython_operation (
524525 self , kind : str , values , how : str , axis : int , min_count : int = - 1 , ** kwargs
525- ) -> Tuple [ np .ndarray , Optional [ List [ str ]]] :
526+ ) -> np .ndarray :
526527 """
527528 If we have an ExtensionArray, unwrap, call _cython_operation, and
528529 re-wrap if appropriate.
@@ -539,10 +540,7 @@ def _ea_wrap_cython_operation(
539540 )
540541 if how in ["rank" ]:
541542 # preserve float64 dtype
542-
543- # error: Incompatible return value type (got "ndarray", expected
544- # "Tuple[ndarray, Optional[List[str]]]")
545- return res_values # type: ignore[return-value]
543+ return res_values
546544
547545 res_values = res_values .astype ("i8" , copy = False )
548546 result = type (orig_values )(res_values , dtype = orig_values .dtype )
@@ -555,14 +553,11 @@ def _ea_wrap_cython_operation(
555553 kind , values , how , axis , min_count , ** kwargs
556554 )
557555 dtype = maybe_cast_result_dtype (orig_values .dtype , how )
558- if is_extension_array_dtype (dtype ):
559- # error: Item "dtype[Any]" of "Union[dtype[Any], ExtensionDtype]" has no
560- # attribute "construct_array_type"
561- cls = dtype .construct_array_type () # type: ignore[union-attr]
556+ if isinstance (dtype , ExtensionDtype ):
557+ cls = dtype .construct_array_type ()
562558 return cls ._from_sequence (res_values , dtype = dtype )
563- # error: Incompatible return value type (got "ndarray", expected
564- # "Tuple[ndarray, Optional[List[str]]]")
565- return res_values # type: ignore[return-value]
559+
560+ return res_values
566561
567562 elif is_float_dtype (values .dtype ):
568563 # FloatingArray
@@ -599,9 +594,7 @@ def _cython_operation(
599594 self ._disallow_invalid_ops (values , how )
600595
601596 if is_extension_array_dtype (values .dtype ):
602- # error: Incompatible return value type (got "Tuple[ndarray,
603- # Optional[List[str]]]", expected "ndarray")
604- return self ._ea_wrap_cython_operation ( # type: ignore[return-value]
597+ return self ._ea_wrap_cython_operation (
605598 kind , values , how , axis , min_count , ** kwargs
606599 )
607600
0 commit comments