Skip to content

Commit 034616c

Browse files
committed
feedback
1 parent d0ac2d7 commit 034616c

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

pandas/core/dtypes/cast.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,8 @@
8080
notna,
8181
)
8282

83+
from pandas.core.indexes.datetimes import DatetimeIndex
84+
8385
if TYPE_CHECKING:
8486
from pandas import Series
8587
from pandas.core.arrays import ExtensionArray
@@ -186,7 +188,7 @@ def maybe_downcast_to_dtype(result, dtype: Dtype):
186188
return result
187189

188190

189-
def maybe_downcast_numeric(result, dtype: Dtype, do_round: bool = False):
191+
def maybe_downcast_numeric(result, dtype: DtypeObj, do_round: bool = False):
190192
"""
191193
Subset of maybe_downcast_to_dtype restricted to numeric dtypes.
192194
@@ -330,8 +332,8 @@ def maybe_cast_result_dtype(dtype: DtypeObj, how: str) -> DtypeObj:
330332

331333

332334
def maybe_cast_to_extension_array(
333-
cls: Type["ExtensionArray"], obj, dtype: Dtype = None
334-
):
335+
cls: Type["ExtensionArray"], obj: ArrayLike, dtype: Optional[ExtensionDtype] = None
336+
) -> ArrayLike:
335337
"""
336338
Call to `_from_sequence` that returns the object unchanged on Exception.
337339
@@ -793,7 +795,7 @@ def infer_dtype_from_scalar(val, pandas_dtype: bool = False) -> Tuple[DtypeObj,
793795
# TODO: try to make the Any in the return annotation more specific
794796
def infer_dtype_from_array(
795797
arr, pandas_dtype: bool = False
796-
) -> Tuple[DtypeObj, AnyArrayLike]:
798+
) -> Tuple[DtypeObj, ArrayLike]:
797799
"""
798800
Infer the dtype from an array.
799801
@@ -1085,7 +1087,7 @@ def astype_nansafe(
10851087

10861088
def maybe_convert_objects(
10871089
values: np.ndarray, convert_numeric: bool = True
1088-
) -> Union[np.ndarray, ABCDatetimeIndex]:
1090+
) -> Union[np.ndarray, DatetimeIndex]:
10891091
"""
10901092
If we have an object dtype array, try to coerce dates and/or numbers.
10911093

0 commit comments

Comments
 (0)