Skip to content

Commit

Permalink
sagemathgh-39347: activate check for ruff PLW0127
Browse files Browse the repository at this point in the history
    
activate one more check in the `ruff-minimal` linter:

PLW0127 Self-assignment of variable

### 📝 Checklist

- [x] The title is concise and informative.
- [x] The description explains in detail what this PR is about.
    
URL: sagemath#39347
Reported by: Frédéric Chapoton
Reviewer(s): Kwankyu Lee
  • Loading branch information
Release Manager committed Feb 3, 2025
2 parents 053f576 + 68c0e59 commit 47eb933
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -837,14 +837,14 @@ def thwart_lemma_4_1(k, n, m, explain_construction=False):
# - (1+t,t,1+t), (1,1,1), (1+t,t,t), (1,1,2), (0,0,1), (1,0,1), (0,1,1+t),
# (0,1,1), (1,0,-t)
points = [(1+t,t,1+t), (1,1,1), (1+t,t,t), (1,1,2), (0,0,1), (1,0,1), (0,1,1+t), (0,1,1), (1,0,-t)]
points = [[K(_) for _ in t] for t in points] # triples of K^3
points = [[K(c) for c in t] for t in points] # triples of K^3
AG_2_3 = []
for x,y,z in points:
if z != 0:
x,y,z = x/z,y/z,z/z
x, y, z = x / z, y / z, K.one()
AG_2_3.append(relabel[x]+n*relabel[y])
elif y != 0:
x,y,z = x/y,y/y,z
x, y = x / y, K.one()
AG_2_3.append(q**2+relabel[x])
else:
AG_2_3.append(q**2+q)
Expand Down
4 changes: 2 additions & 2 deletions src/sage/combinat/skew_tableau.py
Original file line number Diff line number Diff line change
Expand Up @@ -1042,10 +1042,10 @@ def backward_slide(self, corner=None):
# -1, which doesn't trigger the conditional
if P_left > P_up:
new_st[i][j] = P_left
i, j = (i, j - 1)
j = j - 1
else: # if they are equal, we slide up
new_st[i][j] = P_up
i, j = (i - 1, j)
i = i - 1
# We don't need to reset the intermediate cells inside the loop
# because the conditional above will continue to overwrite it until
# the while loop terminates. We do need to reset it at the end.
Expand Down
8 changes: 4 additions & 4 deletions src/sage/interacts/library.py
Original file line number Diff line number Diff line change
Expand Up @@ -925,7 +925,7 @@ def bisection_method(title, f, interval, d, maxn):
maxn: IntSlider(value=10, description='max iterations', max=15)
"""
def _bisection_method(f, a, b, maxn, eps):
intervals = [(a,b)]
intervals = [(a, b)]
round = 1
two = float(2)
while True:
Expand All @@ -938,12 +938,12 @@ def _bisection_method(f, a, b, maxn, eps):
if abs(fc) < eps:
return c, intervals
if fa*fc < 0:
a, b = a, c
b = c
elif fc*fb < 0:
a, b = c, b
a = c
else:
raise ValueError("f must have a sign change in the interval (%s,%s)" % (a,b))
intervals.append((a,b))
intervals.append((a, b))
round += 1
return c, intervals

Expand Down
2 changes: 1 addition & 1 deletion src/tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ passenv = RUFF_OUTPUT_FORMAT
# 1 F402 [ ] Import `factor` from line 259 shadowed by loop variable
# 1 PLC0208 [*] Use a sequence type instead of a `set` when iterating over values
#
commands = ruff check --ignore E402,E721,E731,E741,E742,E743,F401,F402,F403,F405,F821,F841,I001,PLC0206,PLC0208,PLC2401,PLC3002,PLE0302,PLR0124,PLR0402,PLR0911,PLR0912,PLR0913,PLR0915,PLR1704,PLR1711,PLR1714,PLR1716,PLR1736,PLR2004,PLR5501,PLW0120,PLW0127,PLW0211,PLW0602,PLW0603,PLW0642,PLW1508,PLW1510,PLW2901,PLW3301 {posargs:{toxinidir}/sage/}
commands = ruff check --ignore E402,E721,E731,E741,E742,E743,F401,F402,F403,F405,F821,F841,I001,PLC0206,PLC0208,PLC2401,PLC3002,PLE0302,PLR0124,PLR0402,PLR0911,PLR0912,PLR0913,PLR0915,PLR1704,PLR1711,PLR1714,PLR1716,PLR1736,PLR2004,PLR5501,PLW0120,PLW0211,PLW0602,PLW0603,PLW0642,PLW1508,PLW1510,PLW2901,PLW3301 {posargs:{toxinidir}/sage/}

[flake8]
rst-roles =
Expand Down

0 comments on commit 47eb933

Please sign in to comment.