Skip to content

STY: Enable some passing rules #57200

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 11 commits into from
Feb 2, 2024
Merged

Conversation

mroeschke
Copy link
Member

No description provided.

@mroeschke mroeschke added the Code Style Code style, linting, code_checks label Feb 1, 2024
@mroeschke mroeschke added this to the 3.0 milestone Feb 2, 2024
Copy link
Member

@lithomas1 lithomas1 left a comment

Choose a reason for hiding this comment

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

Generally LGTM, small comment.

@@ -55,15 +55,15 @@ def test_array_scalar_like_equivalence(data, all_arithmetic_operators):
scalar_array = pd.array([scalar] * len(data), dtype=data.dtype)

# TODO also add len-1 array (np.array([scalar], dtype=data.dtype.numpy_dtype))
for scalar in [scalar, data.dtype.type(scalar)]:
for val in [scalar, data.dtype.type(scalar)]:
Copy link
Member

Choose a reason for hiding this comment

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

What rule is this?

Not sure I like this change (or if its worth the churn).

Copy link
Member Author

Choose a reason for hiding this comment

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

https://docs.astral.sh/ruff/rules/loop-variable-overrides-iterator/

I think this could be useful generally. In the file above (pandas/io/json/_normalize.py), if v needed to be used after looping it would no longer be the original object it would be an object element

Copy link
Member

Choose a reason for hiding this comment

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

My bad, wasn't paying too close attention.

I guess a more descriptive name would be nicer, but I'm fine with it as it is.

Copy link
Member

@datapythonista datapythonista left a comment

Choose a reason for hiding this comment

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

lgtm, thanks @mroeschke

@mroeschke mroeschke merged commit 7736d4b into pandas-dev:main Feb 2, 2024
@mroeschke mroeschke deleted the sty/more_ruff branch February 2, 2024 17:43
pmhatre1 pushed a commit to pmhatre1/pandas-pmhatre1 that referenced this pull request May 7, 2024
* Enable B006

* Enable B011

* Enable B019

* Enable B020

* Enable B020

* Enable PYI and othe rule

* Enable PLC1901

* Use values instead of items

* Use union

* Ignore one case
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Code Style Code style, linting, code_checks
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants