Skip to content

Commit c13346c

Browse files
author
Release Manager
committed
gh-40664: remove deprecations in quadratic forms These were deprecated in #23955 and #35305. ### 📝 Checklist - [x] The title is concise and informative. - [x] The description explains in detail what this PR is about. - [x] I have linked a relevant issue or discussion. URL: #40664 Reported by: Frédéric Chapoton Reviewer(s): David Coudert
2 parents 8f23059 + e0cb9cc commit c13346c

File tree

2 files changed

+25
-53
lines changed

2 files changed

+25
-53
lines changed

src/sage/quadratic_forms/genera/genus.py

Lines changed: 18 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
lazy_import('sage.interfaces.magma', 'magma')
3939

4040

41-
def genera(sig_pair, determinant, max_scale=None, even=False):
41+
def genera(sig_pair, determinant, max_scale=None, even=False) -> list:
4242
r"""
4343
Return a list of all global genera with the given conditions.
4444
@@ -51,7 +51,7 @@ def genera(sig_pair, determinant, max_scale=None, even=False):
5151
- ``determinant`` -- integer; the sign is ignored
5252
5353
- ``max_scale`` -- (default: ``None``) an integer; the maximum scale of a
54-
jordan block
54+
Jordan block
5555
5656
- ``even`` -- boolean (default: ``False``)
5757
@@ -139,7 +139,7 @@ def _local_genera(p, rank, det_val, max_scale, even):
139139
140140
- ``det_val`` -- valuation of the determinant at `p`
141141
142-
- ``max_scale`` -- integer the maximal scale of a jordan block
142+
- ``max_scale`` -- integer the maximal scale of a Jordan block
143143
144144
- ``even`` -- boolean; ignored if `p` is not `2`
145145
@@ -225,7 +225,7 @@ def _local_genera(p, rank, det_val, max_scale, even):
225225

226226
def _blocks(b, even_only=False):
227227
r"""
228-
Return all viable `2`-adic jordan blocks with rank and scale given by ``b``.
228+
Return all viable `2`-adic Jordan blocks with rank and scale given by ``b``.
229229
230230
This is a helper function for :meth:`_local_genera`.
231231
It is based on the existence conditions for a modular `2`-adic genus symbol.
@@ -589,23 +589,22 @@ def canonical_2_adic_compartments(genus_symbol_quintuple_list):
589589
return compartments
590590

591591

592-
def canonical_2_adic_trains(genus_symbol_quintuple_list, compartments=None):
592+
def canonical_2_adic_trains(genus_symbol_quintuple_list) -> list:
593593
r"""
594-
Given a `2`-adic local symbol (as the underlying list of quintuples)
595-
this returns a list of lists of indices of the
596-
``genus_symbol_quintuple_list`` which are in the same train. A train
597-
is defined to be a maximal interval of Jordan components so that
598-
at least one of each adjacent pair (allowing zero-dimensional
599-
Jordan components) is (scaled) of type I (i.e. odd).
600-
Note that an interval of length one respects this condition as
601-
there is no pair in this interval.
594+
Given a `2`-adic local symbol, return a list of lists of indices
595+
of the ``genus_symbol_quintuple_list`` which are in the same train.
596+
597+
A train is defined to be a maximal interval of Jordan components
598+
so that at least one of each adjacent pair (allowing
599+
zero-dimensional Jordan components) is (scaled) of type I
600+
(i.e. odd). Note that an interval of length one respects this
601+
condition as there is no pair in this interval.
602602
In particular, every Jordan component is part of a train.
603603
604604
INPUT:
605605
606-
- ``genus_symbol_quintuple_list`` -- a quintuple of integers (with certain
607-
restrictions).
608-
- ``compartments`` -- this argument is deprecated
606+
- ``genus_symbol_quintuple_list`` -- a `2`-adic local symbol as a list of
607+
quintuples of integers (with certain restrictions).
609608
610609
OUTPUT: list of lists of distinct integers
611610
@@ -654,12 +653,8 @@ def canonical_2_adic_trains(genus_symbol_quintuple_list, compartments=None):
654653
655654
See [CS1999]_, pp. 381-382 for definitions and examples.
656655
"""
657-
if compartments is not None:
658-
from sage.misc.superseded import deprecation
659-
deprecation(23955, "the compartments keyword has been deprecated")
660-
661656
# avoid a special case for the end of symbol
662-
# if a jordan component has rank zero it is considered even.
657+
# if a Jordan component has rank zero it is considered even.
663658
symbol = genus_symbol_quintuple_list
664659
symbol.append([symbol[-1][0]+1, 0, 1, 0, 0]) # We have just modified the input globally!
665660
# Hence, we have to remove the last entry of symbol at the end.
@@ -680,7 +675,7 @@ def canonical_2_adic_trains(genus_symbol_quintuple_list, compartments=None):
680675
trains.append(new_train)
681676
new_train = [i]
682677
else:
683-
# there is an odd jordan block adjacent to this jordan block
678+
# there is an odd Jordan block adjacent to this Jordan block
684679
# the train continues
685680
new_train.append(i)
686681
# the last train was never added.
@@ -3318,7 +3313,7 @@ def norm(self):
33183313

33193314
def _gram_from_jordan_block(p, block, discr_form=False):
33203315
r"""
3321-
Return the Gram matrix of this jordan block.
3316+
Return the Gram matrix of this Jordan block.
33223317
33233318
This is a helper for :meth:`discriminant_form` and :meth:`gram_matrix`.
33243319
No input checks.

src/sage/quadratic_forms/quadratic_form.py

Lines changed: 7 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
from sage.matrix.matrix_space import MatrixSpace
3131
from sage.misc.functional import denominator, is_even
3232
from sage.misc.lazy_import import lazy_import
33-
from sage.misc.superseded import deprecated_function_alias, deprecation
33+
from sage.misc.superseded import deprecated_function_alias
3434
from sage.modules.free_module_element import vector
3535
from sage.quadratic_forms.quadratic_form__evaluate import (
3636
QFEvaluateMatrix,
@@ -46,29 +46,6 @@
4646
from sage.structure.sage_object import SageObject
4747

4848

49-
def is_QuadraticForm(Q):
50-
"""
51-
Determine if the object ``Q`` is an element of the :class:`QuadraticForm` class.
52-
53-
This function is deprecated.
54-
55-
EXAMPLES::
56-
57-
sage: Q = QuadraticForm(ZZ, 2, [1,2,3])
58-
sage: from sage.quadratic_forms.quadratic_form import is_QuadraticForm
59-
sage: is_QuadraticForm(Q)
60-
doctest:...: DeprecationWarning: the function is_QuadraticForm is deprecated;
61-
use isinstance(x, sage.quadratic_forms.quadratic_form.QuadraticForm) instead...
62-
True
63-
sage: is_QuadraticForm(2)
64-
False
65-
"""
66-
deprecation(35305,
67-
"the function is_QuadraticForm is deprecated; use "
68-
"isinstance(x, sage.quadratic_forms.quadratic_form.QuadraticForm) instead")
69-
return isinstance(Q, QuadraticForm)
70-
71-
7249
def quadratic_form_from_invariants(F, rk, det, P, sminus):
7350
r"""
7451
Return a rational quadratic form with given invariants.
@@ -521,7 +498,7 @@ def __init__(
521498
unsafe_initialization=False,
522499
number_of_automorphisms=None,
523500
determinant=None,
524-
):
501+
) -> None:
525502
"""
526503
EXAMPLES::
527504
@@ -721,7 +698,7 @@ def __pari__(self):
721698
"""
722699
return self.matrix().__pari__()
723700

724-
def _pari_init_(self):
701+
def _pari_init_(self) -> str:
725702
"""
726703
Return a PARI-formatted Hessian matrix for Q, as string.
727704
@@ -733,7 +710,7 @@ def _pari_init_(self):
733710
"""
734711
return self.matrix()._pari_init_()
735712

736-
def _repr_(self):
713+
def _repr_(self) -> str:
737714
"""
738715
Give a text representation for the quadratic form given as an upper-triangular matrix of coefficients.
739716
@@ -758,7 +735,7 @@ def _repr_(self):
758735
out_str += "]"
759736
return out_str
760737

761-
def _latex_(self):
738+
def _latex_(self) -> str:
762739
"""
763740
Give a LaTeX representation for the quadratic form given as an upper-triangular matrix of coefficients.
764741
@@ -847,7 +824,7 @@ def __setitem__(self, ij, coeff):
847824
except Exception:
848825
raise RuntimeError("this coefficient cannot be coerced to an element of the base ring for the quadratic form")
849826

850-
def __hash__(self):
827+
def __hash__(self) -> int:
851828
r"""
852829
TESTS::
853830
@@ -861,7 +838,7 @@ def __hash__(self):
861838
"""
862839
return hash(self.__base_ring) ^ hash(tuple(self.__coeffs))
863840

864-
def __eq__(self, right):
841+
def __eq__(self, right) -> bool:
865842
"""
866843
Determines if two quadratic forms are equal.
867844

0 commit comments

Comments
 (0)