Skip to content

STY: enable PLR5501 #56895

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 1 commit into from
Jan 16, 2024
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
13 changes: 6 additions & 7 deletions pandas/tests/copy_view/test_indexing.py
Original file line number Diff line number Diff line change
Expand Up @@ -941,15 +941,14 @@ def test_column_as_series(backend, using_copy_on_write, warn_copy_on_write):

if using_copy_on_write:
s[0] = 0
elif warn_copy_on_write:
with tm.assert_cow_warning():
s[0] = 0
else:
if warn_copy_on_write:
with tm.assert_cow_warning():
warn = SettingWithCopyWarning if dtype_backend == "numpy" else None
with pd.option_context("chained_assignment", "warn"):
with tm.assert_produces_warning(warn):
s[0] = 0
else:
warn = SettingWithCopyWarning if dtype_backend == "numpy" else None
with pd.option_context("chained_assignment", "warn"):
with tm.assert_produces_warning(warn):
s[0] = 0

expected = Series([0, 2, 3], name="a")
tm.assert_series_equal(s, expected)
Expand Down
9 changes: 4 additions & 5 deletions pandas/tests/window/test_rolling.py
Original file line number Diff line number Diff line change
Expand Up @@ -1693,12 +1693,11 @@ def test_rolling_quantile_interpolation_options(quantile, interpolation, data):

if np.isnan(q1):
assert np.isnan(q2)
elif not IS64:
# Less precision on 32-bit
assert np.allclose([q1], [q2], rtol=1e-07, atol=0)
else:
if not IS64:
# Less precision on 32-bit
assert np.allclose([q1], [q2], rtol=1e-07, atol=0)
else:
assert q1 == q2
assert q1 == q2


def test_invalid_quantile_value():
Expand Down
5 changes: 2 additions & 3 deletions pandas/util/_validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -335,9 +335,8 @@ def validate_percentile(q: float | Iterable[float]) -> np.ndarray:
if q_arr.ndim == 0:
if not 0 <= q_arr <= 1:
raise ValueError(msg)
else:
if not all(0 <= qs <= 1 for qs in q_arr):
raise ValueError(msg)
elif not all(0 <= qs <= 1 for qs in q_arr):
raise ValueError(msg)
return q_arr


Expand Down
2 changes: 0 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -337,8 +337,6 @@ ignore = [
"PLR2004",
# comparison-with-itself
"PLR0124",
# Consider `elif` instead of `else` then `if` to remove indentation level
"PLR5501",
# collection-literal-concatenation
"RUF005",
# pairwise-over-zipped (>=PY310 only)
Expand Down