Skip to content

STYLE: fix pylint consider-merging-isinstance warnings #49686

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
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
12 changes: 2 additions & 10 deletions pandas/_testing/asserters.py
Original file line number Diff line number Diff line change
Expand Up @@ -571,20 +571,12 @@ def raise_assert_detail(

if isinstance(left, np.ndarray):
left = pprint_thing(left)
elif (
isinstance(left, CategoricalDtype)
or isinstance(left, PandasDtype)
or isinstance(left, StringDtype)
):
elif isinstance(left, (CategoricalDtype, PandasDtype, StringDtype)):
left = repr(left)

if isinstance(right, np.ndarray):
right = pprint_thing(right)
elif (
isinstance(right, CategoricalDtype)
or isinstance(right, PandasDtype)
or isinstance(right, StringDtype)
):
elif isinstance(right, (CategoricalDtype, PandasDtype, StringDtype)):
right = repr(right)

msg += f"""
Expand Down
2 changes: 1 addition & 1 deletion pandas/core/indexes/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -1648,7 +1648,7 @@ def _get_default_index_names(
from pandas.core.indexes.multi import MultiIndex

if names is not None:
if isinstance(names, str) or isinstance(names, int):
if isinstance(names, (int, str)):
names = [names]

if not isinstance(names, list) and names is not None:
Expand Down
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@ disable = [

# pylint type "R": refactor, for bad code smell
"comparison-with-itself",
"consider-merging-isinstance",
"consider-using-ternary",
"consider-using-with",
"cyclic-import",
Expand Down