Skip to content

Commit

Permalink
various fixes in quadratic_forms (ruff, pep8, error links, etc)
Browse files Browse the repository at this point in the history
  • Loading branch information
fchapoton committed Dec 17, 2023
1 parent e2e0f8d commit 0fb342a
Show file tree
Hide file tree
Showing 9 changed files with 183 additions and 189 deletions.
2 changes: 1 addition & 1 deletion src/sage/quadratic_forms/binary_qf.py
Original file line number Diff line number Diff line change
Expand Up @@ -1928,7 +1928,7 @@ def BinaryQF_reduced_representatives(D, primitive_only=False, proper=True):
if D > 0: # Indefinite
if D.is_square():
b = D.sqrt()
c = ZZ(0)
c = ZZ.zero()
# -b/2 < a <= b/2
for a in xsrange((-b/2).floor() + 1, (b/2).floor() + 1):
if not primitive_only or (gcd([a, b, c]) == 1):
Expand Down
8 changes: 4 additions & 4 deletions src/sage/quadratic_forms/genera/genus.py
Original file line number Diff line number Diff line change
Expand Up @@ -1202,7 +1202,7 @@ def two_adic_symbol(A, val):
return [[s[0]+m0] + s[1:] for s in sym + two_adic_symbol(A, val)]


class Genus_Symbol_p_adic_ring():
class Genus_Symbol_p_adic_ring:
r"""
Local genus symbol over a `p`-adic ring.
Expand Down Expand Up @@ -2132,7 +2132,7 @@ def direct_sum(self, other):

def excess(self):
r"""
Returns the `p`-excess of the quadratic form whose Hessian
Return the `p`-excess of the quadratic form whose Hessian
matrix is the symmetric matrix `A`. When `p = 2`, the `p`-excess is
called the oddity.
Expand Down Expand Up @@ -2242,7 +2242,7 @@ def norm(self):
sage: G = Genus(matrix(ZZ,2,[0, 1, 1, 0]))
sage: G.local_symbol(2).norm()
2
"""
"""
if self.rank() == 0:
return ZZ(0)
p = self.prime()
Expand Down Expand Up @@ -2321,7 +2321,7 @@ def compartments(self):
return canonical_2_adic_compartments(symbol)


class GenusSymbol_global_ring():
class GenusSymbol_global_ring:
r"""
This represents a collection of local genus symbols (at primes)
and signature information which represent the genus of a
Expand Down
4 changes: 2 additions & 2 deletions src/sage/quadratic_forms/qfsolve.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ def solve(self, c=0):
if not c:
x = qfsolve(M)
if isinstance(x, Integer):
raise ArithmeticError("no solution found (local obstruction at {})".format(x))
raise ArithmeticError(f"no solution found (local obstruction at {x})")
return x

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

# Let z be the last term of x, and remove z from x
z = x[-1]
Expand Down
Loading

0 comments on commit 0fb342a

Please sign in to comment.