diff --git a/src/sage/quadratic_forms/genera/genus.py b/src/sage/quadratic_forms/genera/genus.py index e0e12bfe7b1..a0f1100513a 100644 --- a/src/sage/quadratic_forms/genera/genus.py +++ b/src/sage/quadratic_forms/genera/genus.py @@ -38,7 +38,7 @@ lazy_import('sage.interfaces.magma', 'magma') -def genera(sig_pair, determinant, max_scale=None, even=False): +def genera(sig_pair, determinant, max_scale=None, even=False) -> list: r""" Return a list of all global genera with the given conditions. @@ -51,7 +51,7 @@ def genera(sig_pair, determinant, max_scale=None, even=False): - ``determinant`` -- integer; the sign is ignored - ``max_scale`` -- (default: ``None``) an integer; the maximum scale of a - jordan block + Jordan block - ``even`` -- boolean (default: ``False``) @@ -139,7 +139,7 @@ def _local_genera(p, rank, det_val, max_scale, even): - ``det_val`` -- valuation of the determinant at `p` - - ``max_scale`` -- integer the maximal scale of a jordan block + - ``max_scale`` -- integer the maximal scale of a Jordan block - ``even`` -- boolean; ignored if `p` is not `2` @@ -225,7 +225,7 @@ def _local_genera(p, rank, det_val, max_scale, even): def _blocks(b, even_only=False): r""" - Return all viable `2`-adic jordan blocks with rank and scale given by ``b``. + Return all viable `2`-adic Jordan blocks with rank and scale given by ``b``. This is a helper function for :meth:`_local_genera`. 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): return compartments -def canonical_2_adic_trains(genus_symbol_quintuple_list, compartments=None): +def canonical_2_adic_trains(genus_symbol_quintuple_list) -> list: r""" - Given a `2`-adic local symbol (as the underlying list of quintuples) - this returns a list of lists of indices of the - ``genus_symbol_quintuple_list`` which are in the same train. A train - is defined to be a maximal interval of Jordan components so that - at least one of each adjacent pair (allowing zero-dimensional - Jordan components) is (scaled) of type I (i.e. odd). - Note that an interval of length one respects this condition as - there is no pair in this interval. + Given a `2`-adic local symbol, return a list of lists of indices + of the ``genus_symbol_quintuple_list`` which are in the same train. + + A train is defined to be a maximal interval of Jordan components + so that at least one of each adjacent pair (allowing + zero-dimensional Jordan components) is (scaled) of type I + (i.e. odd). Note that an interval of length one respects this + condition as there is no pair in this interval. In particular, every Jordan component is part of a train. INPUT: - - ``genus_symbol_quintuple_list`` -- a quintuple of integers (with certain - restrictions). - - ``compartments`` -- this argument is deprecated + - ``genus_symbol_quintuple_list`` -- a `2`-adic local symbol as a list of + quintuples of integers (with certain restrictions). OUTPUT: list of lists of distinct integers @@ -654,12 +653,8 @@ def canonical_2_adic_trains(genus_symbol_quintuple_list, compartments=None): See [CS1999]_, pp. 381-382 for definitions and examples. """ - if compartments is not None: - from sage.misc.superseded import deprecation - deprecation(23955, "the compartments keyword has been deprecated") - # avoid a special case for the end of symbol - # if a jordan component has rank zero it is considered even. + # if a Jordan component has rank zero it is considered even. symbol = genus_symbol_quintuple_list symbol.append([symbol[-1][0]+1, 0, 1, 0, 0]) # We have just modified the input globally! # 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): trains.append(new_train) new_train = [i] else: - # there is an odd jordan block adjacent to this jordan block + # there is an odd Jordan block adjacent to this Jordan block # the train continues new_train.append(i) # the last train was never added. @@ -3318,7 +3313,7 @@ def norm(self): def _gram_from_jordan_block(p, block, discr_form=False): r""" - Return the Gram matrix of this jordan block. + Return the Gram matrix of this Jordan block. This is a helper for :meth:`discriminant_form` and :meth:`gram_matrix`. No input checks. diff --git a/src/sage/quadratic_forms/quadratic_form.py b/src/sage/quadratic_forms/quadratic_form.py index 5079f55a6a9..fb741146cfe 100644 --- a/src/sage/quadratic_forms/quadratic_form.py +++ b/src/sage/quadratic_forms/quadratic_form.py @@ -30,7 +30,7 @@ from sage.matrix.matrix_space import MatrixSpace from sage.misc.functional import denominator, is_even from sage.misc.lazy_import import lazy_import -from sage.misc.superseded import deprecated_function_alias, deprecation +from sage.misc.superseded import deprecated_function_alias from sage.modules.free_module_element import vector from sage.quadratic_forms.quadratic_form__evaluate import ( QFEvaluateMatrix, @@ -46,29 +46,6 @@ from sage.structure.sage_object import SageObject -def is_QuadraticForm(Q): - """ - Determine if the object ``Q`` is an element of the :class:`QuadraticForm` class. - - This function is deprecated. - - EXAMPLES:: - - sage: Q = QuadraticForm(ZZ, 2, [1,2,3]) - sage: from sage.quadratic_forms.quadratic_form import is_QuadraticForm - sage: is_QuadraticForm(Q) - doctest:...: DeprecationWarning: the function is_QuadraticForm is deprecated; - use isinstance(x, sage.quadratic_forms.quadratic_form.QuadraticForm) instead... - True - sage: is_QuadraticForm(2) - False - """ - deprecation(35305, - "the function is_QuadraticForm is deprecated; use " - "isinstance(x, sage.quadratic_forms.quadratic_form.QuadraticForm) instead") - return isinstance(Q, QuadraticForm) - - def quadratic_form_from_invariants(F, rk, det, P, sminus): r""" Return a rational quadratic form with given invariants. @@ -521,7 +498,7 @@ def __init__( unsafe_initialization=False, number_of_automorphisms=None, determinant=None, - ): + ) -> None: """ EXAMPLES:: @@ -721,7 +698,7 @@ def __pari__(self): """ return self.matrix().__pari__() - def _pari_init_(self): + def _pari_init_(self) -> str: """ Return a PARI-formatted Hessian matrix for Q, as string. @@ -733,7 +710,7 @@ def _pari_init_(self): """ return self.matrix()._pari_init_() - def _repr_(self): + def _repr_(self) -> str: """ Give a text representation for the quadratic form given as an upper-triangular matrix of coefficients. @@ -758,7 +735,7 @@ def _repr_(self): out_str += "]" return out_str - def _latex_(self): + def _latex_(self) -> str: """ Give a LaTeX representation for the quadratic form given as an upper-triangular matrix of coefficients. @@ -847,7 +824,7 @@ def __setitem__(self, ij, coeff): except Exception: raise RuntimeError("this coefficient cannot be coerced to an element of the base ring for the quadratic form") - def __hash__(self): + def __hash__(self) -> int: r""" TESTS:: @@ -861,7 +838,7 @@ def __hash__(self): """ return hash(self.__base_ring) ^ hash(tuple(self.__coeffs)) - def __eq__(self, right): + def __eq__(self, right) -> bool: """ Determines if two quadratic forms are equal.