Skip to content

Commit e6f67dc

Browse files
committed
CLN: Clean DirNameMixin
1 parent 04d7931 commit e6f67dc

File tree

5 files changed

+22
-12
lines changed

5 files changed

+22
-12
lines changed

pandas/core/accessor.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,7 @@
1212

1313
class DirNamesMixin:
1414
_accessors = set() # type: Set[str]
15-
_deprecations = frozenset(
16-
["asobject", "base", "data", "flags", "itemsize", "strides"]
17-
)
15+
_deprecations = frozenset()
1816

1917
def _dir_deletions(self):
2018
"""

pandas/core/arrays/categorical.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,9 @@ class Categorical(ExtensionArray, PandasObject):
331331
__array_priority__ = 1000
332332
_dtype = CategoricalDtype(ordered=False)
333333
# tolist is not actually deprecated, just suppressed in the __dir__
334-
_deprecations = PandasObject._deprecations | frozenset(["tolist", "get_values"])
334+
_deprecations = PandasObject._deprecations | frozenset(
335+
["tolist", "itemsize", "get_values"]
336+
)
335337
_typ = "categorical"
336338

337339
def __init__(

pandas/core/base.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@
5050
class PandasObject(DirNamesMixin):
5151
"""baseclass for various pandas objects"""
5252

53+
_deprecations = DirNamesMixin._deprecations | frozenset()
54+
5355
@property
5456
def _constructor(self):
5557
"""class constructor (for this class it's just `__class__`"""
@@ -653,7 +655,17 @@ class IndexOpsMixin:
653655

654656
# ndarray compatibility
655657
__array_priority__ = 1000
656-
_deprecations = frozenset(["item"])
658+
_deprecations = frozenset(
659+
[
660+
"tolist", # tolist is not deprecated, just suppressed in the __dir__
661+
"base",
662+
"data",
663+
"item",
664+
"itemsize",
665+
"flags",
666+
"strides",
667+
]
668+
)
657669

658670
def transpose(self, *args, **kwargs):
659671
"""

pandas/core/indexes/base.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@
6363
from pandas.core.dtypes.missing import array_equivalent, isna
6464

6565
from pandas.core import ops
66-
from pandas.core.accessor import CachedAccessor, DirNamesMixin
66+
from pandas.core.accessor import CachedAccessor
6767
import pandas.core.algorithms as algos
6868
from pandas.core.arrays import ExtensionArray
6969
from pandas.core.base import IndexOpsMixin, PandasObject
@@ -206,9 +206,9 @@ class Index(IndexOpsMixin, PandasObject):
206206

207207
# tolist is not actually deprecated, just suppressed in the __dir__
208208
_deprecations = (
209-
IndexOpsMixin._deprecations
210-
| DirNamesMixin._deprecations
211-
| frozenset(["tolist", "contains", "dtype_str", "get_values", "set_value"])
209+
PandasObject._deprecations
210+
| IndexOpsMixin._deprecations
211+
| frozenset(["asobject", "contains", "dtype_str", "get_values", "set_value"])
212212
)
213213

214214
# To hand over control to subclasses

pandas/core/series.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454

5555
import pandas as pd
5656
from pandas.core import algorithms, base, generic, nanops, ops
57-
from pandas.core.accessor import CachedAccessor, DirNamesMixin
57+
from pandas.core.accessor import CachedAccessor
5858
from pandas.core.arrays import ExtensionArray
5959
from pandas.core.arrays.categorical import Categorical, CategoricalAccessor
6060
from pandas.core.arrays.sparse import SparseAccessor
@@ -178,10 +178,8 @@ class Series(base.IndexOpsMixin, generic.NDFrame):
178178
_deprecations = (
179179
base.IndexOpsMixin._deprecations
180180
| generic.NDFrame._deprecations
181-
| DirNamesMixin._deprecations
182181
| frozenset(
183182
[
184-
"tolist", # tolist is not deprecated, just suppressed in the __dir__
185183
"asobject",
186184
"compress",
187185
"valid",

0 commit comments

Comments
 (0)