3131_index_doc_kwargs = dict (ibase ._index_doc_kwargs )
3232
3333
34- def ea_passthrough (name ):
34+ def ea_passthrough (array_method ):
3535 """
3636 Make an alias for a method of the underlying ExtensionArray.
3737
3838 Parameters
3939 ----------
40- name : str
40+ array_method : method on an Array class
4141
4242 Returns
4343 -------
4444 method
4545 """
46+
4647 def method (self , * args , ** kwargs ):
47- return getattr (self ._eadata , name )( * args , ** kwargs )
48+ return array_method (self ._data , * args , ** kwargs )
4849
49- method .__name__ = name
50- # TODO: docstrings
50+ method .__name__ = array_method . __name__
51+ method . __doc__ = array_method . __doc__
5152 return method
5253
5354
@@ -67,9 +68,10 @@ class DatetimeIndexOpsMixin(ExtensionOpsMixin):
6768 _resolution = cache_readonly (DatetimeLikeArrayMixin ._resolution .fget )
6869 resolution = cache_readonly (DatetimeLikeArrayMixin .resolution .fget )
6970
70- _box_values = ea_passthrough ("_box_values" )
71- _maybe_mask_results = ea_passthrough ("_maybe_mask_results" )
72- __iter__ = ea_passthrough ("__iter__" )
71+ _box_values = ea_passthrough (DatetimeLikeArrayMixin ._box_values )
72+ _maybe_mask_results = ea_passthrough (
73+ DatetimeLikeArrayMixin ._maybe_mask_results )
74+ __iter__ = ea_passthrough (DatetimeLikeArrayMixin .__iter__ )
7375
7476 @property
7577 def _eadata (self ):
@@ -275,9 +277,6 @@ def sort_values(self, return_indexer=False, ascending=True):
275277 if not ascending :
276278 sorted_values = sorted_values [::- 1 ]
277279
278- sorted_values = self ._maybe_box_as_values (sorted_values ,
279- ** attribs )
280-
281280 return self ._simple_new (sorted_values , ** attribs )
282281
283282 @Appender (_index_shared_docs ['take' ] % _index_doc_kwargs )
@@ -613,14 +612,6 @@ def _concat_same_dtype(self, to_concat, name):
613612 new_data = type (self ._values )._concat_same_type (to_concat ).asi8
614613 return self ._simple_new (new_data , ** attribs )
615614
616- def _maybe_box_as_values (self , values , ** attribs ):
617- # TODO(DatetimeArray): remove
618- # This is a temporary shim while PeriodArray is an ExtensoinArray,
619- # but others are not. When everyone is an ExtensionArray, this can
620- # be removed. Currently used in
621- # - sort_values
622- return values
623-
624615 @Appender (_index_shared_docs ['astype' ])
625616 def astype (self , dtype , copy = True ):
626617 if is_dtype_equal (self .dtype , dtype ) and copy is False :
0 commit comments