Skip to content

Commit fdc8ad0

Browse files
committed
feedback
1 parent ca4705a commit fdc8ad0

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
@@ -790,7 +792,7 @@ def infer_dtype_from_scalar(val, pandas_dtype: bool = False) -> Tuple[DtypeObj,
790792
# TODO: try to make the Any in the return annotation more specific
791793
def infer_dtype_from_array(
792794
arr, pandas_dtype: bool = False
793-
) -> Tuple[DtypeObj, AnyArrayLike]:
795+
) -> Tuple[DtypeObj, ArrayLike]:
794796
"""
795797
Infer the dtype from an array.
796798
@@ -1082,7 +1084,7 @@ def astype_nansafe(
10821084

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

0 commit comments

Comments
 (0)