Skip to content

Commit d49bb68

Browse files
authored
CLN: remove DatetimelikeDelegateMixin (pandas-dev#31480)
1 parent 1dce67c commit d49bb68

File tree

1 file changed

+1
-42
lines changed

1 file changed

+1
-42
lines changed

pandas/core/indexes/datetimelike.py

+1-42
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
"""
22
Base and utility classes for tseries type pandas objects.
33
"""
4-
import operator
5-
from typing import Any, List, Optional, Set, Union
4+
from typing import Any, List, Optional, Union
65

76
import numpy as np
87

@@ -30,7 +29,6 @@
3029
from pandas.core.dtypes.missing import is_valid_nat_for_dtype, isna
3130

3231
from pandas.core import algorithms
33-
from pandas.core.accessor import PandasDelegate
3432
from pandas.core.arrays import DatetimeArray, PeriodArray, TimedeltaArray
3533
from pandas.core.arrays.datetimelike import DatetimeLikeArrayMixin
3634
from pandas.core.base import _shared_docs
@@ -932,42 +930,3 @@ def insert(self, loc, item):
932930
raise TypeError(
933931
f"cannot insert {type(self).__name__} with incompatible label"
934932
)
935-
936-
937-
class DatetimelikeDelegateMixin(PandasDelegate):
938-
"""
939-
Delegation mechanism, specific for Datetime, Timedelta, and Period types.
940-
941-
Functionality is delegated from the Index class to an Array class. A
942-
few things can be customized
943-
944-
* _delegated_methods, delegated_properties : List
945-
The list of property / method names being delagated.
946-
* raw_methods : Set
947-
The set of methods whose results should should *not* be
948-
boxed in an index, after being returned from the array
949-
* raw_properties : Set
950-
The set of properties whose results should should *not* be
951-
boxed in an index, after being returned from the array
952-
"""
953-
954-
# raw_methods : dispatch methods that shouldn't be boxed in an Index
955-
_raw_methods: Set[str] = set()
956-
# raw_properties : dispatch properties that shouldn't be boxed in an Index
957-
_raw_properties: Set[str] = set()
958-
_data: Union[DatetimeArray, TimedeltaArray, PeriodArray]
959-
960-
def _delegate_property_get(self, name, *args, **kwargs):
961-
result = getattr(self._data, name)
962-
if name not in self._raw_properties:
963-
result = Index(result, name=self.name)
964-
return result
965-
966-
def _delegate_property_set(self, name: str, value, *args, **kwargs):
967-
setattr(self._data, name, value)
968-
969-
def _delegate_method(self, name, *args, **kwargs):
970-
result = operator.methodcaller(name, *args, **kwargs)(self._data)
971-
if name not in self._raw_methods:
972-
result = Index(result, name=self.name)
973-
return result

0 commit comments

Comments
 (0)