Skip to content

Commit

Permalink
sagemathgh-36906: various fixes in quadratic_forms (ruff, pep8, error…
Browse files Browse the repository at this point in the history
… 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: sagemath#36906
Reported by: Frédéric Chapoton
Reviewer(s): David Coudert
  • Loading branch information
Release Manager committed Dec 25, 2023
2 parents 02cdc7b + 0fb342a commit 8d87590
Show file tree
Hide file tree
Showing 11 changed files with 187 additions and 193 deletions.
6 changes: 3 additions & 3 deletions build/pkgs/configure/checksums.ini
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
tarball=configure-VERSION.tar.gz
sha1=2389d2b093493c568deda190ffc326ff2b835169
md5=545e80b50deb4efa46f14d0a543ba98f
cksum=169905223
sha1=6b899b437a7d1ec59c6267e83ee2128eb85a88a8
md5=a040e38f906be0501fcb98a459c164fc
cksum=2019410146
2 changes: 1 addition & 1 deletion build/pkgs/configure/package-version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
73e52a419812253c3c3ce72bab7f1a5ddf4c0461
152f5420d0b9695eaa0413f19b7eeb19c591f8db
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 8d87590

Please sign in to comment.