Skip to content

CLN: remove ABCDateOffset #33958

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 4, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions pandas/core/dtypes/dtypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,11 @@

from pandas._libs.interval import Interval
from pandas._libs.tslibs import NaT, Period, Timestamp, timezones
from pandas._libs.tslibs.offsets import BaseOffset
from pandas._typing import DtypeObj, Ordered

from pandas.core.dtypes.base import ExtensionDtype
from pandas.core.dtypes.generic import ABCCategoricalIndex, ABCDateOffset, ABCIndexClass
from pandas.core.dtypes.generic import ABCCategoricalIndex, ABCIndexClass
from pandas.core.dtypes.inference import is_bool, is_list_like

if TYPE_CHECKING:
Expand Down Expand Up @@ -893,7 +894,7 @@ def __new__(cls, freq=None):
u._freq = None
return u

if not isinstance(freq, ABCDateOffset):
if not isinstance(freq, BaseOffset):
freq = cls._parse_dtype_strict(freq)

try:
Expand Down Expand Up @@ -935,7 +936,7 @@ def construct_from_string(cls, string: str_type) -> "PeriodDtype":
if (
isinstance(string, str)
and (string.startswith("period[") or string.startswith("Period["))
or isinstance(string, ABCDateOffset)
or isinstance(string, BaseOffset)
):
# do not parse string like U as period[U]
# avoid tuple to be regarded as freq
Expand Down
1 change: 0 additions & 1 deletion pandas/core/dtypes/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ def _check(cls, inst) -> bool:
"ABCTimedeltaArray", "_typ", ("timedeltaarray")
)
ABCPeriodArray = create_pandas_abc_type("ABCPeriodArray", "_typ", ("periodarray",))
ABCDateOffset = create_pandas_abc_type("ABCDateOffset", "_typ", ("dateoffset",))
ABCExtensionArray = create_pandas_abc_type(
"ABCExtensionArray",
"_typ",
Expand Down
5 changes: 3 additions & 2 deletions pandas/core/window/rolling.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
)
from pandas.core.dtypes.generic import (
ABCDataFrame,
ABCDateOffset,
ABCDatetimeIndex,
ABCPeriodIndex,
ABCSeries,
Expand Down Expand Up @@ -57,6 +56,8 @@
)
from pandas.core.window.numba_ import generate_numba_apply_func

from pandas.tseries.offsets import DateOffset


class _Window(PandasObject, ShallowMixin, SelectionMixin):
_attributes: List[str] = [
Expand Down Expand Up @@ -1838,7 +1839,7 @@ def validate(self):

# we allow rolling on a datetimelike index
if (self.obj.empty or self.is_datetimelike) and isinstance(
self.window, (str, ABCDateOffset, timedelta)
self.window, (str, DateOffset, timedelta)
):

self._validate_monotonic()
Expand Down
4 changes: 0 additions & 4 deletions pandas/tests/dtypes/test_generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,6 @@ def test_abc_types(self):
assert isinstance(self.sparse_array, gt.ABCSparseArray)
assert isinstance(self.categorical, gt.ABCCategorical)

assert isinstance(pd.DateOffset(), gt.ABCDateOffset)
assert isinstance(pd.Period("2012", freq="A-DEC").freq, gt.ABCDateOffset)
assert not isinstance(pd.Period("2012", freq="A-DEC"), gt.ABCDateOffset)

assert isinstance(self.datetime_array, gt.ABCDatetimeArray)
assert not isinstance(self.datetime_index, gt.ABCDatetimeArray)

Expand Down