Skip to content

Commit da8e1ab

Browse files
author
Release Manager
committed
gh-36906: various fixes in quadratic_forms (ruff, pep8, error links, etc) this is fixing various minor details in `quadratic forms` ### 📝 Checklist - [x] The title is concise, informative, and self-explanatory. - [x] The description explains in detail what this PR is about. URL: #36906 Reported by: Frédéric Chapoton Reviewer(s): David Coudert
2 parents 68b15c8 + 0fb342a commit da8e1ab

9 files changed

+183
-189
lines changed

src/sage/quadratic_forms/binary_qf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1928,7 +1928,7 @@ def BinaryQF_reduced_representatives(D, primitive_only=False, proper=True):
19281928
if D > 0: # Indefinite
19291929
if D.is_square():
19301930
b = D.sqrt()
1931-
c = ZZ(0)
1931+
c = ZZ.zero()
19321932
# -b/2 < a <= b/2
19331933
for a in xsrange((-b/2).floor() + 1, (b/2).floor() + 1):
19341934
if not primitive_only or (gcd([a, b, c]) == 1):

src/sage/quadratic_forms/genera/genus.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1202,7 +1202,7 @@ def two_adic_symbol(A, val):
12021202
return [[s[0]+m0] + s[1:] for s in sym + two_adic_symbol(A, val)]
12031203

12041204

1205-
class Genus_Symbol_p_adic_ring():
1205+
class Genus_Symbol_p_adic_ring:
12061206
r"""
12071207
Local genus symbol over a `p`-adic ring.
12081208
@@ -2132,7 +2132,7 @@ def direct_sum(self, other):
21322132

21332133
def excess(self):
21342134
r"""
2135-
Returns the `p`-excess of the quadratic form whose Hessian
2135+
Return the `p`-excess of the quadratic form whose Hessian
21362136
matrix is the symmetric matrix `A`. When `p = 2`, the `p`-excess is
21372137
called the oddity.
21382138
@@ -2242,7 +2242,7 @@ def norm(self):
22422242
sage: G = Genus(matrix(ZZ,2,[0, 1, 1, 0]))
22432243
sage: G.local_symbol(2).norm()
22442244
2
2245-
"""
2245+
"""
22462246
if self.rank() == 0:
22472247
return ZZ(0)
22482248
p = self.prime()
@@ -2321,7 +2321,7 @@ def compartments(self):
23212321
return canonical_2_adic_compartments(symbol)
23222322

23232323

2324-
class GenusSymbol_global_ring():
2324+
class GenusSymbol_global_ring:
23252325
r"""
23262326
This represents a collection of local genus symbols (at primes)
23272327
and signature information which represent the genus of a

src/sage/quadratic_forms/qfsolve.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ def solve(self, c=0):
213213
if not c:
214214
x = qfsolve(M)
215215
if isinstance(x, Integer):
216-
raise ArithmeticError("no solution found (local obstruction at {})".format(x))
216+
raise ArithmeticError(f"no solution found (local obstruction at {x})")
217217
return x
218218

219219
# If c != 0, define a new quadratic form Q = self - c*z^2
@@ -228,7 +228,7 @@ def solve(self, c=0):
228228
x = qfsolve(N)
229229
# Raise an error if qfsolve() doesn't find a solution
230230
if isinstance(x, Integer):
231-
raise ArithmeticError("no solution found (local obstruction at {})".format(x))
231+
raise ArithmeticError(f"no solution found (local obstruction at {x})")
232232

233233
# Let z be the last term of x, and remove z from x
234234
z = x[-1]

0 commit comments

Comments
 (0)