Skip to content

Commit 9432af7

Browse files
committed
fix and activate some checks in ruff-minimal
1 parent c9dd1e8 commit 9432af7

File tree

13 files changed

+24
-25
lines changed

13 files changed

+24
-25
lines changed

src/sage/combinat/matrices/latin.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1212,7 +1212,8 @@ def disjoint_mate_dlxcpp_rows_and_map(self, allow_subtrade):
12121212

12131213
dlx_rows.append([c_OFFSET, r_OFFSET, xy_OFFSET])
12141214

1215-
max_column_nr = max(max_column_nr, max(c_OFFSET, r_OFFSET, xy_OFFSET))
1215+
max_column_nr = max(max_column_nr, c_OFFSET,
1216+
r_OFFSET, xy_OFFSET)
12161217

12171218
# We will have missed some columns. We
12181219
# have to add 'dummy' rows so that the C++ DLX solver will find

src/sage/doctest/control.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1351,12 +1351,12 @@ def run_val_gdb(self, testing=False):
13511351
opt = self.options
13521352

13531353
if opt.gdb:
1354-
cmd = f'''exec gdb --eval-command="run" --args '''
1354+
cmd = '''exec gdb --eval-command="run" --args '''
13551355
flags = ""
13561356
if opt.logfile:
13571357
sage_cmd += f" --logfile {shlex.quote(opt.logfile)}"
13581358
elif opt.lldb:
1359-
cmd = f'''exec lldb --one-line "process launch" --one-line "cont" -- '''
1359+
cmd = '''exec lldb --one-line "process launch" --one-line "cont" -- '''
13601360
flags = ""
13611361
else:
13621362
if opt.logfile is None:

src/sage/functions/airy.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ def _evalf_(self, x, **kwargs):
241241
from sage.rings.real_mpfr import RR
242242
from sage.rings.cc import CC
243243
from sage.functions.other import real, imag
244-
from scipy.special import airy as airy
244+
from scipy.special import airy
245245
if x in RR:
246246
y = airy(real(x))[0]
247247
if parent is None:
@@ -341,7 +341,7 @@ def _evalf_(self, x, **kwargs):
341341
from sage.rings.real_mpfr import RR
342342
from sage.rings.cc import CC
343343
from sage.functions.other import real, imag
344-
from scipy.special import airy as airy
344+
from scipy.special import airy
345345
if x in RR:
346346
y = airy(real(x))[1]
347347
if parent is None:
@@ -680,7 +680,7 @@ def _evalf_(self, x, **kwargs):
680680
from sage.rings.real_mpfr import RR
681681
from sage.rings.cc import CC
682682
from sage.functions.other import real, imag
683-
from scipy.special import airy as airy
683+
from scipy.special import airy
684684
if x in RR:
685685
y = airy(real(x))[2]
686686
if parent is None:
@@ -782,7 +782,7 @@ def _evalf_(self, x, **kwargs):
782782
from sage.rings.real_mpfr import RR
783783
from sage.rings.cc import CC
784784
from sage.functions.other import real, imag
785-
from scipy.special import airy as airy
785+
from scipy.special import airy
786786
if x in RR:
787787
y = airy(real(x))[3]
788788
if parent is None:

src/sage/functions/log.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
- Tomas Kalvoda (2015-04-01): Add :meth:`exp_polar()` (:issue:`18085`)
99
"""
1010

11-
from sage.misc.functional import log as log
11+
from sage.misc.functional import log
1212
from sage.misc.lazy_import import lazy_import
1313
from sage.rings.integer import Integer
1414
from sage.rings.integer_ring import ZZ

src/sage/graphs/generators/random.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1709,7 +1709,7 @@ def RandomKTree(n, k, seed=None):
17091709

17101710
# A graph with treewidth 0 has no edges
17111711
if k == 0:
1712-
g = Graph(n, name=f"Random 0-tree")
1712+
g = Graph(n, name="Random 0-tree")
17131713
return g
17141714

17151715
if n < k + 1:
@@ -1803,7 +1803,7 @@ def RandomPartialKTree(n, k, x, seed=None):
18031803

18041804
# A graph with treewidth 0 has no edges
18051805
if k == 0:
1806-
g = Graph(n, name=f"Random partial 0-tree")
1806+
g = Graph(n, name="Random partial 0-tree")
18071807
return g
18081808

18091809
if n < k + 1:

src/sage/misc/package_dir.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -603,7 +603,7 @@ def handle_file(root, file):
603603
else:
604604
handle_file(*os.path.split(path))
605605

606-
print(f"sage --fixdistributions: checking consistency")
606+
print("sage --fixdistributions: checking consistency")
607607

608608
for package in ordinary_packages:
609609
if len(package_distributions_per_directives[package]) > 1:

src/sage/modules/with_basis/representation.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1895,7 +1895,7 @@ def __init__(self, rep, degree, **options):
18951895
R = rep.base_ring()
18961896
dim = rep.dimension()
18971897
if degree not in ZZ or degree < 0:
1898-
raise ValueError(f"the degree must be a nonnegative integer")
1898+
raise ValueError("the degree must be a nonnegative integer")
18991899
self._symalg = PolynomialRing(R, 'e', dim)
19001900
self._basis_order = list(rep.basis().keys())
19011901
G = self._symalg.gens()

src/sage/quadratic_forms/quadratic_form__ternary_Tornaria.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,8 +129,7 @@ def adjoint(self):
129129
[ * 19 4 ]
130130
[ * * 8 ]
131131
"""
132-
from sage.quadratic_forms.quadratic_form import QuadraticForm as QuadraticForm
133-
132+
from sage.quadratic_forms.quadratic_form import QuadraticForm
134133
if is_odd(self.dim()):
135134
return QuadraticForm(self.matrix().adjoint_classical() * 2)
136135
return QuadraticForm(self.matrix().adjoint_classical())

src/sage/schemes/curves/projective_curve.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2300,7 +2300,7 @@ def __init__(self, A, f):
23002300
self._open_affine_index = i
23012301
break
23022302
else:
2303-
assert "no projective curve defined"
2303+
raise ValueError("no projective curve defined")
23042304

23052305
def function_field(self):
23062306
"""

src/sage/schemes/elliptic_curves/ell_curve_isogeny.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3319,12 +3319,13 @@ def dual(self):
33193319

33203320
else:
33213321
# trac 7096
3322-
# this should take care of the case when the isogeny is not normalized.
3322+
# this should take care of the case when the isogeny is
3323+
# not normalized.
33233324
u = self.scaling_factor()
33243325
E2 = E2pr.change_weierstrass_model(u/F(d), 0, 0, 0)
33253326

33263327
phi_hat = EllipticCurveIsogeny(E1, None, E2, d)
3327-
# assert phi_hat.scaling_factor() == 1
3328+
# assert phi_hat.scaling_factor() == 1
33283329

33293330
for pre_iso in self._codomain.isomorphisms(E1):
33303331
for post_iso in E2.isomorphisms(self._domain):
@@ -3335,7 +3336,7 @@ def dual(self):
33353336
continue
33363337
break
33373338
else:
3338-
assert "bug in dual()"
3339+
raise RuntimeError("bug in dual()")
33393340

33403341
phi_hat._set_pre_isomorphism(pre_iso)
33413342
phi_hat._set_post_isomorphism(post_iso)

0 commit comments

Comments
 (0)