@@ -342,10 +342,8 @@ def maybe_cast_result_dtype(dtype: DtypeObj, how: str) -> DtypeObj:
342
342
return dtype
343
343
344
344
345
- # TODO: annotate obj, return type
346
- # both ArrayLike but not necessarily the same => need a Union (xref GH36100)
347
345
def maybe_cast_to_extension_array (
348
- cls : Type ["ExtensionArray" ], obj , dtype : Optional [ExtensionDtype ] = None
346
+ cls : Type ["ExtensionArray" ], obj : ArrayLike , dtype : Optional [ExtensionDtype ] = None
349
347
) -> ArrayLike :
350
348
"""
351
349
Call to `_from_sequence` that returns the object unchanged on Exception.
@@ -489,7 +487,7 @@ def maybe_casted_values(
489
487
490
488
# if we have the codes, extract the values with a mask
491
489
if codes is not None :
492
- mask = codes == - 1
490
+ mask : np . ndarray = codes == - 1
493
491
494
492
# we can have situations where the whole mask is -1,
495
493
# meaning there is nothing found in codes, so make all nan's
@@ -1742,7 +1740,7 @@ def construct_1d_ndarray_preserving_na(
1742
1740
return subarr
1743
1741
1744
1742
1745
- def maybe_cast_to_integer_array (arr , dtype : Union [ str , np . dtype ] , copy : bool = False ):
1743
+ def maybe_cast_to_integer_array (arr , dtype : Dtype , copy : bool = False ):
1746
1744
"""
1747
1745
Takes any dtype and returns the casted version, raising for when data is
1748
1746
incompatible with integer/unsigned integer dtypes.
0 commit comments