diff --git a/src/sage/all_test.py b/src/sage/all_test.py index e6bce8dbe54..fba1d133593 100644 --- a/src/sage/all_test.py +++ b/src/sage/all_test.py @@ -13,8 +13,7 @@ def test_import_sage_all_in_fresh_interpreter(): proc = subprocess.run( [sys.executable, "-c", "import sage.all"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, env=env, text=True, check=False, ) diff --git a/src/sage/doctest/util.py b/src/sage/doctest/util.py index 6e5f9387e85..46975c072cb 100644 --- a/src/sage/doctest/util.py +++ b/src/sage/doctest/util.py @@ -181,7 +181,7 @@ def _proc_stat_cpu_seconds(self, path): """ try: - with open(path, "r") as statfile: + with open(path) as statfile: stats = statfile.read().split() except (FileNotFoundError, PermissionError) as e: # FileNotFoundError: bad PID, or no /proc support diff --git a/src/sage/matroids/chow_ring_ideal.py b/src/sage/matroids/chow_ring_ideal.py index b948c7c5939..e5a6336268d 100644 --- a/src/sage/matroids/chow_ring_ideal.py +++ b/src/sage/matroids/chow_ring_ideal.py @@ -1034,7 +1034,7 @@ def _latex_(self) -> str: 'I_{FY}(\\text{\\texttt{Graphic{ }matroid{ }of{ }rank{ }2{ }on{ }3{ }elements}})' """ from sage.misc.latex import latex - return 'I_{{FY}}({})'.format((latex(self._matroid))) + return 'I_{{FY}}({})'.format(latex(self._matroid)) def groebner_basis(self, algorithm='', *args, **kwargs): r""" diff --git a/src/sage/rings/lazy_species.py b/src/sage/rings/lazy_species.py index 3480d7bd0fe..0ecc1541f86 100644 --- a/src/sage/rings/lazy_species.py +++ b/src/sage/rings/lazy_species.py @@ -1173,7 +1173,7 @@ def coeff(g, i): def flat(g): # function needed to work around python's scoping rules - return itertools.chain.from_iterable((coeff(g, j) for j in itertools.count())) + return itertools.chain.from_iterable(coeff(g, j) for j in itertools.count()) args_flat1 = [lazy_list(flat(g)) for g in args] diff --git a/src/sage/rings/padics/witt_vector.py b/src/sage/rings/padics/witt_vector.py index 46b0c530e22..3c6ddc2df62 100644 --- a/src/sage/rings/padics/witt_vector.py +++ b/src/sage/rings/padics/witt_vector.py @@ -266,7 +266,7 @@ def _int_to_vector(self, k, parent): if p == 2: vec_k = ( parent(vec_k) - * parent((tuple(-1 for _ in range(self._prec)))) + * parent(tuple(-1 for _ in range(self._prec))) ).coordinates() else: vec_k = (-x for x in vec_k) diff --git a/src/sage/rings/polynomial/multi_polynomial_sequence.py b/src/sage/rings/polynomial/multi_polynomial_sequence.py index fea9fb2c2f3..07969827c5a 100644 --- a/src/sage/rings/polynomial/multi_polynomial_sequence.py +++ b/src/sage/rings/polynomial/multi_polynomial_sequence.py @@ -1313,7 +1313,7 @@ def __add__(self, right): if isinstance(right, PolynomialSequence_generic) and right.ring() == self.ring(): return PolynomialSequence(self.ring(), self.parts() + right.parts()) - elif isinstance(right, (tuple, list)) and all((x.parent() == self.ring() for x in right)): + elif isinstance(right, (tuple, list)) and all(x.parent() == self.ring() for x in right): return PolynomialSequence(self.ring(), self.parts() + (right,)) elif isinstance(right, MPolynomialIdeal) and (right.ring() is self.ring() or right.ring() == self.ring()):