Skip to content

Commit 4119163

Browse files
author
Release Manager
committed
gh-41158: some fixes from ruff UP warnings
about UP022, UP015 and UP034 https://docs.astral.sh/ruff/rules/#pyupgrade-up ### 📝 Checklist - [x] The title is concise and informative. - [x] The description explains in detail what this PR is about. URL: #41158 Reported by: Frédéric Chapoton Reviewer(s):
2 parents 039e8bf + ad04953 commit 4119163

File tree

8 files changed

+9
-10
lines changed

8 files changed

+9
-10
lines changed

build/pkgs/configure/checksums.ini

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
tarball=configure-VERSION.tar.gz
2-
sha1=bbfd190cd366d0bed772cadb601acd7a3f5c7818
3-
sha256=04e7bf4e58d098b5fa05680078d2e0770d694eb0e66ce840001077547df9b2c8
2+
sha1=656f2bec653e996cc712c3c61d8619f020654e45
3+
sha256=8cc6d50852f3b64cee946172dfa6b71bdee2a0cb0144e713f9597b16687b9afa
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
7dc22dee03fdbea52fdb80bc7aad20b8cf214b72
1+
2e90de2df36ec6ff272ca4377c41c431f3ae8f1a

src/sage/all_test.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@ def test_import_sage_all_in_fresh_interpreter():
1313

1414
proc = subprocess.run(
1515
[sys.executable, "-c", "import sage.all"],
16-
stdout=subprocess.PIPE,
17-
stderr=subprocess.PIPE,
16+
capture_output=True,
1817
env=env,
1918
text=True, check=False,
2019
)

src/sage/doctest/util.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ def _proc_stat_cpu_seconds(self, path):
181181
182182
"""
183183
try:
184-
with open(path, "r") as statfile:
184+
with open(path) as statfile:
185185
stats = statfile.read().split()
186186
except (FileNotFoundError, PermissionError) as e:
187187
# FileNotFoundError: bad PID, or no /proc support

src/sage/matroids/chow_ring_ideal.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1034,7 +1034,7 @@ def _latex_(self) -> str:
10341034
'I_{FY}(\\text{\\texttt{Graphic{ }matroid{ }of{ }rank{ }2{ }on{ }3{ }elements}})'
10351035
"""
10361036
from sage.misc.latex import latex
1037-
return 'I_{{FY}}({})'.format((latex(self._matroid)))
1037+
return 'I_{{FY}}({})'.format(latex(self._matroid))
10381038

10391039
def groebner_basis(self, algorithm='', *args, **kwargs):
10401040
r"""

src/sage/rings/lazy_species.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1173,7 +1173,7 @@ def coeff(g, i):
11731173

11741174
def flat(g):
11751175
# function needed to work around python's scoping rules
1176-
return itertools.chain.from_iterable((coeff(g, j) for j in itertools.count()))
1176+
return itertools.chain.from_iterable(coeff(g, j) for j in itertools.count())
11771177

11781178
args_flat1 = [lazy_list(flat(g)) for g in args]
11791179

src/sage/rings/padics/witt_vector.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ def _int_to_vector(self, k, parent):
266266
if p == 2:
267267
vec_k = (
268268
parent(vec_k)
269-
* parent((tuple(-1 for _ in range(self._prec))))
269+
* parent(tuple(-1 for _ in range(self._prec)))
270270
).coordinates()
271271
else:
272272
vec_k = (-x for x in vec_k)

src/sage/rings/polynomial/multi_polynomial_sequence.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1313,7 +1313,7 @@ def __add__(self, right):
13131313
if isinstance(right, PolynomialSequence_generic) and right.ring() == self.ring():
13141314
return PolynomialSequence(self.ring(), self.parts() + right.parts())
13151315

1316-
elif isinstance(right, (tuple, list)) and all((x.parent() == self.ring() for x in right)):
1316+
elif isinstance(right, (tuple, list)) and all(x.parent() == self.ring() for x in right):
13171317
return PolynomialSequence(self.ring(), self.parts() + (right,))
13181318

13191319
elif isinstance(right, MPolynomialIdeal) and (right.ring() is self.ring() or right.ring() == self.ring()):

0 commit comments

Comments
 (0)