Skip to content

Updated ruff pre-commit version and modified few lines according to it. #54639

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 5 commits into from
Aug 21, 2023
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
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ repos:
hooks:
- id: black
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.0.284
rev: v0.0.285
hooks:
- id: ruff
args: [--exit-non-zero-on-fix]
Expand Down
2 changes: 1 addition & 1 deletion pandas/core/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ def is_bool_indexer(key: Any) -> bool:
elif isinstance(key, list):
# check if np.array(key).dtype would be bool
if len(key) > 0:
if type(key) is not list:
if type(key) is not list: # noqa: E721
# GH#42461 cython will raise TypeError if we pass a subclass
key = list(key)
return lib.is_bool_list(key)
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 @@ -7528,7 +7528,7 @@ def ensure_index(index_like: Axes, copy: bool = False) -> Index:
index_like = list(index_like)

if isinstance(index_like, list):
if type(index_like) is not list:
if type(index_like) is not list: # noqa: E721
# must check for exactly list here because of strict type
# check in clean_index_list
index_like = list(index_like)
Expand Down
2 changes: 1 addition & 1 deletion pandas/core/internals/construction.py
Original file line number Diff line number Diff line change
Expand Up @@ -903,7 +903,7 @@ def _list_of_dict_to_arrays(

# assure that they are of the base dict class and not of derived
# classes
data = [d if type(d) is dict else dict(d) for d in data]
data = [d if type(d) is dict else dict(d) for d in data] # noqa: E721
Copy link
Member

@twoertwein twoertwein Aug 19, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of ignoring the issue, maybe try [d if isinstance(d, dict) ...]?

edit: The comment suggests that it needs to be a dict and not a subclass

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@twoertwein yes, sir. So, I guess there is nothing I need to change?


content = lib.dicts_to_array(data, list(columns))
return content, columns
Expand Down