|
36 | 36 | integer_op_not_supported,
|
37 | 37 | round_nsint64,
|
38 | 38 | )
|
39 |
| -from pandas._typing import DatetimeLikeScalar, DtypeObj |
| 39 | +from pandas._typing import DatetimeLikeScalar, Dtype, DtypeObj, NpDtype |
40 | 40 | from pandas.compat.numpy import function as nv
|
41 | 41 | from pandas.errors import AbstractMethodError, NullFrequencyError, PerformanceWarning
|
42 | 42 | from pandas.util._decorators import Appender, Substitution, cache_readonly
|
@@ -107,15 +107,15 @@ class DatetimeLikeArrayMixin(OpsMixin, NDArrayBackedExtensionArray):
|
107 | 107 | _recognized_scalars: Tuple[Type, ...]
|
108 | 108 | _data: np.ndarray
|
109 | 109 |
|
110 |
| - def __init__(self, data, dtype=None, freq=None, copy=False): |
| 110 | + def __init__(self, data, dtype: Optional[Dtype] = None, freq=None, copy=False): |
111 | 111 | raise AbstractMethodError(self)
|
112 | 112 |
|
113 | 113 | @classmethod
|
114 | 114 | def _simple_new(
|
115 | 115 | cls: Type[DatetimeLikeArrayT],
|
116 | 116 | values: np.ndarray,
|
117 | 117 | freq: Optional[BaseOffset] = None,
|
118 |
| - dtype=None, |
| 118 | + dtype: Optional[Dtype] = None, |
119 | 119 | ) -> DatetimeLikeArrayT:
|
120 | 120 | raise AbstractMethodError(cls)
|
121 | 121 |
|
@@ -265,7 +265,7 @@ def _formatter(self, boxed=False):
|
265 | 265 | # ----------------------------------------------------------------
|
266 | 266 | # Array-Like / EA-Interface Methods
|
267 | 267 |
|
268 |
| - def __array__(self, dtype=None) -> np.ndarray: |
| 268 | + def __array__(self, dtype: Optional[NpDtype] = None) -> np.ndarray: |
269 | 269 | # used for Timedelta/DatetimeArray, overwritten by PeriodArray
|
270 | 270 | if is_object_dtype(dtype):
|
271 | 271 | return np.array(list(self), dtype=object)
|
@@ -383,7 +383,7 @@ def astype(self, dtype, copy=True):
|
383 | 383 | else:
|
384 | 384 | return np.asarray(self, dtype=dtype)
|
385 | 385 |
|
386 |
| - def view(self, dtype=None): |
| 386 | + def view(self, dtype: Optional[Dtype] = None): |
387 | 387 | if dtype is None or dtype is self.dtype:
|
388 | 388 | return type(self)(self._ndarray, dtype=self.dtype)
|
389 | 389 | return self._ndarray.view(dtype=dtype)
|
|
0 commit comments