31
31
_index_doc_kwargs = dict (ibase ._index_doc_kwargs )
32
32
33
33
34
- def ea_passthrough (name ):
34
+ def ea_passthrough (array_method ):
35
35
"""
36
36
Make an alias for a method of the underlying ExtensionArray.
37
37
38
38
Parameters
39
39
----------
40
- name : str
40
+ array_method : method on an Array class
41
41
42
42
Returns
43
43
-------
44
44
method
45
45
"""
46
+
46
47
def method (self , * args , ** kwargs ):
47
- return getattr (self ._eadata , name )( * args , ** kwargs )
48
+ return array_method (self ._data , * args , ** kwargs )
48
49
49
- method .__name__ = name
50
- # TODO: docstrings
50
+ method .__name__ = array_method . __name__
51
+ method . __doc__ = array_method . __doc__
51
52
return method
52
53
53
54
@@ -67,9 +68,10 @@ class DatetimeIndexOpsMixin(ExtensionOpsMixin):
67
68
_resolution = cache_readonly (DatetimeLikeArrayMixin ._resolution .fget )
68
69
resolution = cache_readonly (DatetimeLikeArrayMixin .resolution .fget )
69
70
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__ )
73
75
74
76
@property
75
77
def _eadata (self ):
@@ -275,9 +277,6 @@ def sort_values(self, return_indexer=False, ascending=True):
275
277
if not ascending :
276
278
sorted_values = sorted_values [::- 1 ]
277
279
278
- sorted_values = self ._maybe_box_as_values (sorted_values ,
279
- ** attribs )
280
-
281
280
return self ._simple_new (sorted_values , ** attribs )
282
281
283
282
@Appender (_index_shared_docs ['take' ] % _index_doc_kwargs )
@@ -613,14 +612,6 @@ def _concat_same_dtype(self, to_concat, name):
613
612
new_data = type (self ._values )._concat_same_type (to_concat ).asi8
614
613
return self ._simple_new (new_data , ** attribs )
615
614
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
-
624
615
@Appender (_index_shared_docs ['astype' ])
625
616
def astype (self , dtype , copy = True ):
626
617
if is_dtype_equal (self .dtype , dtype ) and copy is False :
0 commit comments