-
-
Notifications
You must be signed in to change notification settings - Fork 18.6k
CLN: Clean DirNameMixin._deprecated #28957
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
from datetime import datetime | ||
import operator | ||
from textwrap import dedent | ||
from typing import Union | ||
from typing import FrozenSet, Union | ||
import warnings | ||
|
||
import numpy as np | ||
|
@@ -63,7 +63,7 @@ | |
from pandas.core.dtypes.missing import array_equivalent, isna | ||
|
||
from pandas.core import ops | ||
from pandas.core.accessor import CachedAccessor, DirNamesMixin | ||
from pandas.core.accessor import CachedAccessor | ||
import pandas.core.algorithms as algos | ||
from pandas.core.arrays import ExtensionArray | ||
from pandas.core.base import IndexOpsMixin, PandasObject | ||
|
@@ -206,10 +206,10 @@ class Index(IndexOpsMixin, PandasObject): | |
|
||
# tolist is not actually deprecated, just suppressed in the __dir__ | ||
_deprecations = ( | ||
IndexOpsMixin._deprecations | ||
| DirNamesMixin._deprecations | ||
| frozenset(["tolist", "contains", "dtype_str", "get_values", "set_value"]) | ||
) | ||
PandasObject._deprecations | ||
| IndexOpsMixin._deprecations | ||
| frozenset(["asobject", "contains", "dtype_str", "get_values", "set_value"]) | ||
) # type: FrozenSet[str] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same comment here There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I added the type hints after complaints from mypy. I agree it's strange it doesn't infer and I'll see if something can be done to make it infer. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think should be able to infer as long as you construct with values. Empty construction complains because it is not known then what types of value the object should hold. Not sure if FrozenSet would act differently but that’s how builtins work There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same here. A frozenset that only contains strings, could conceivably have non-strings, and I think that's what mypy complains about. |
||
|
||
# To hand over control to subclasses | ||
_join_precedence = 1 | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You might not need this annotation; I think mypy should be able to infer
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tried again, and mypy complains without the annotation. My guess is that it cannot be sure that the added set should only contain strings.