1212# See the License for the specific language governing permissions and
1313# limitations under the License.
1414
15- from typing import Optional
15+ from typing import Optional , Callable , Any
1616
1717import numpy
1818import pandas
@@ -50,6 +50,13 @@ class BaseDatetimeArray(pandas_backports.OpsMixin, _mixins.NDArrayBackedExtensio
5050 # https://github.com/pandas-dev/pandas/blob/main/pandas/core/arrays/_mixins.py
5151 _internal_fill_value = numpy .datetime64 ("NaT" )
5252
53+ _box_func : Callable [[Any ], Any ]
54+ _from_backing_data : Callable [[Any ], Any ]
55+
56+ @classmethod
57+ def _datetime (cls , value : Any ) -> Any :
58+ raise NotImplementedError
59+
5360 def __init__ (self , values , dtype = None , copy : bool = False ):
5461 if not (
5562 isinstance (values , numpy .ndarray ) and values .dtype == numpy .dtype ("<M8[ns]" )
@@ -164,17 +171,17 @@ def min(self, *, axis: Optional[int] = None, skipna: bool = True, **kwargs):
164171 values = self ._ndarray , axis = axis , mask = self .isna (), skipna = skipna
165172 )
166173 if axis is None or self .ndim == 1 :
167- return self ._box_func (result ) # type: ignore[attr-defined]
168- return self ._from_backing_data (result ) # type: ignore[attr-defined]
174+ return self ._box_func (result )
175+ return self ._from_backing_data (result )
169176
170177 def max (self , * , axis : Optional [int ] = None , skipna : bool = True , ** kwargs ):
171178 pandas_backports .numpy_validate_max ((), kwargs )
172179 result = pandas_backports .nanmax (
173180 values = self ._ndarray , axis = axis , mask = self .isna (), skipna = skipna
174181 )
175182 if axis is None or self .ndim == 1 :
176- return self ._box_func (result ) # type: ignore[attr-defined]
177- return self ._from_backing_data (result ) # type: ignore[attr-defined]
183+ return self ._box_func (result )
184+ return self ._from_backing_data (result )
178185
179186 def median (
180187 self ,
@@ -191,5 +198,5 @@ def median(
191198 )
192199 result = pandas_backports .nanmedian (self ._ndarray , axis = axis , skipna = skipna )
193200 if axis is None or self .ndim == 1 :
194- return self ._box_func (result ) # type: ignore[attr-defined]
195- return self ._from_backing_data (result ) # type: ignore[attr-defined]
201+ return self ._box_func (result )
202+ return self ._from_backing_data (result )
0 commit comments