Skip to content

Commit

Permalink
sagemathgh-37246: minor details in modular
Browse files Browse the repository at this point in the history
namely

- use ruff to fix some containement tests

- add links to some error codes in the doc

- plus some http to https

### 📝 Checklist

- [x] The title is concise, informative, and self-explanatory.
- [x] The description explains in detail what this PR is about.

URL: sagemath#37246
Reported by: Frédéric Chapoton
Reviewer(s): Matthias Köppe
  • Loading branch information
Release Manager committed Feb 7, 2024
2 parents 3ebbb45 + 59396b2 commit ce6cac2
Show file tree
Hide file tree
Showing 21 changed files with 41 additions and 41 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=84c8bfc8a84399d50eac5f0e75672da0e36216ae
md5=1171b0a7cd69002c426fb7b48e9026e4
cksum=2998629640
sha1=78de6a778317233043c5f4984008c144e770ff3f
md5=88e59b7a4e39814a82cca5e0f7936701
cksum=2784860047
2 changes: 1 addition & 1 deletion build/pkgs/configure/package-version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
128d437fcc7f3917b314662fdee34aeaab968b67
2612f8aad95eac36efba96d182ee3036d66d6595
2 changes: 1 addition & 1 deletion src/sage/modular/arithgroup/arithgroup_generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -571,7 +571,7 @@ def is_subgroup(self, right):

w = self.gens()
for g in w:
if not (g in right):
if g not in right:
return False
return True

Expand Down
4 changes: 2 additions & 2 deletions src/sage/modular/arithgroup/arithgroup_perm.py
Original file line number Diff line number Diff line change
Expand Up @@ -816,7 +816,7 @@ def relabel(self, inplace=True):
"""
if hasattr(self,'_canonical_label_group'):
if inplace:
if not (self is self._canonical_label_group):
if self is not self._canonical_label_group:
self.__dict__ = self._canonical_label_group.__dict__
self._canonical_label_group = self
else:
Expand Down Expand Up @@ -1811,7 +1811,7 @@ def cusp_widths(self,exp=False):
c1 = min(L.orbit(inv(c0)))
cusps.remove(c1)
if exp:
if not len(c) in widths:
if len(c) not in widths:
widths[len(c)] = 0
widths[len(c)] += 1
else:
Expand Down
4 changes: 2 additions & 2 deletions src/sage/modular/arithgroup/congroup_gammaH.py
Original file line number Diff line number Diff line change
Expand Up @@ -1045,7 +1045,7 @@ def is_subgroup(self, other):
# difficult case
t = other._list_of_elements_in_H()
for x in self._generators_for_H():
if not (x in t):
if x not in t:
return False
return True

Expand Down Expand Up @@ -1402,7 +1402,7 @@ def _list_subgroup(N, gens):
raise ValueError("gen (=%s) is not in (Z/%sZ)^*" % (g, N))
gk = int(g) % N
sbgrp = [gk]
while not (gk in H):
while gk not in H:
gk = (gk * g) % N
sbgrp.append(gk)
H = {(x * h) % N for x in sbgrp for h in H}
Expand Down
2 changes: 1 addition & 1 deletion src/sage/modular/btquotients/btquotient.py
Original file line number Diff line number Diff line change
Expand Up @@ -695,7 +695,7 @@ def edge_between_vertices(self, v1, v2, normalized=False):
- 2x2 integer matrix, representing the edge from ``v1`` to
``v2``. If ``v1`` and ``v2`` are not at distance `1`, raise
a ``ValueError``.
a :class:`ValueError`.
EXAMPLES::
Expand Down
2 changes: 1 addition & 1 deletion src/sage/modular/hecke/ambient_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ def degeneracy_map(self, codomain, t=1):
"level (=%s) and t (=%s) must be a divisor of the quotient") % (self.level(), level, t))

eps = self.character()
if not (eps is None) and level % eps.conductor() != 0:
if eps is not None and level % eps.conductor() != 0:
raise ArithmeticError("the conductor of the character of this space "
"(=%s) must be divisible by the level (=%s)" % (eps.conductor(), level))

Expand Down
8 changes: 4 additions & 4 deletions src/sage/modular/hecke/module.py
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,7 @@ def rank(self):
r"""
Return the rank of this module over its base ring.
This raises a ``NotImplementedError``, since this is an
This raises a :class:`NotImplementedError`, since this is an
abstract base class.
EXAMPLES::
Expand All @@ -473,7 +473,7 @@ def submodule(self, X):
Return the submodule of ``self`` corresponding to ``X``.
As this is an abstract base class, this raises a
``NotImplementedError``.
:class:`NotImplementedError`.
EXAMPLES::
Expand Down Expand Up @@ -739,7 +739,7 @@ def ambient_hecke_module(self):
r"""
Return the ambient module associated to this module.
As this is an abstract base class, raise ``NotImplementedError``.
As this is an abstract base class, raise :class:`NotImplementedError`.
EXAMPLES::
Expand Down Expand Up @@ -1501,7 +1501,7 @@ def is_simple(self):
Return ``True`` if this space is simple as a module for the
corresponding Hecke algebra.
Raises ``NotImplementedError``, as this is an abstract base
This raises :class:`NotImplementedError`, as this is an abstract base
class.
EXAMPLES::
Expand Down
4 changes: 2 additions & 2 deletions src/sage/modular/hecke/submodule.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ def __init__(self, ambient, submodule, dual_free_module=None, check=True):
module.HeckeModule_free_module.__init__(self, ambient.base_ring(),
ambient.level(),
ambient.weight())
if not (dual_free_module is None):
if dual_free_module is not None:
if not is_FreeModule(dual_free_module):
raise TypeError("dual_free_module must be a free module")
if dual_free_module.rank() != submodule.rank():
Expand Down Expand Up @@ -960,7 +960,7 @@ def submodule_from_nonembedded_module(self, V, Vdual=None, check=True):
# so fast, and their are asymptotically fast algorithms.
A = M_V * M_E
V = A.row_space()
if not (Vdual is None):
if Vdual is not None:
E = self.dual_free_module()
M_Vdual = Vdual.matrix()
M_E = E.matrix()
Expand Down
2 changes: 1 addition & 1 deletion src/sage/modular/local_comp/smoothchar.py
Original file line number Diff line number Diff line change
Expand Up @@ -802,7 +802,7 @@ def _test_unitgens(self, **options):
g = I.small_residue(g)
else: # I is an ideal of ZZ
g = g % (I.gen())
if not (g - 1 in I):
if g - 1 not in I:
T.fail("For generator g=%s, g^%s = %s, which is not 1 mod I" % (gens[i], exps[i], g))
I = self.prime() if self.number_field() == QQ else self.ideal(1)
T.assertEqual(gens[-1].valuation(I), 1)
Expand Down
2 changes: 1 addition & 1 deletion src/sage/modular/modform/constructor.py
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ def ModularForms(group=1,

if use_cache and key in _cache:
M = _cache[key]()
if not (M is None):
if M is not None:
M.set_precision(prec)
return M

Expand Down
4 changes: 2 additions & 2 deletions src/sage/modular/modform/space.py
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ def has_character(self):
sage: CuspForms(DirichletGroup(11).0,3).has_character()
True
"""
return not self.character() is None
return self.character() is not None

def is_ambient(self):
"""
Expand Down Expand Up @@ -1929,6 +1929,6 @@ def contains_each(V, B):
False
"""
for b in B:
if not (b in V):
if b not in V:
return False
return True
2 changes: 1 addition & 1 deletion src/sage/modular/modsym/apply.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Monomial expansion of `(aX + bY)^i (cX + dY)^{j-i}`
#
# Distributed under the terms of the GNU General Public License (GPL)
#
# http://www.gnu.org/licenses/
# https://www.gnu.org/licenses/
#
##########################################################################

Expand Down
2 changes: 1 addition & 1 deletion src/sage/modular/modsym/element.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def set_modsym_print_mode(mode="manin"):
sage: set_modsym_print_mode()
"""
mode = str(mode).lower()
if not (mode in ['manin', 'modular', 'vector']):
if mode not in ['manin', 'modular', 'vector']:
raise ValueError("mode must be one of 'manin', 'modular', or 'vector'")
global _print_mode
_print_mode = mode
Expand Down
2 changes: 1 addition & 1 deletion src/sage/modular/modsym/ghlist.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#
# The full text of the GPL is available at:
#
# http://www.gnu.org/licenses/
# https://www.gnu.org/licenses/
###########################################################################
from sage.structure.richcmp import richcmp_method, richcmp
from sage.structure.sage_object import SageObject
Expand Down
4 changes: 2 additions & 2 deletions src/sage/modular/modsym/hecke_operator.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#
# Distributed under the terms of the GNU General Public License (GPL)
#
# http://www.gnu.org/licenses/
# https://www.gnu.org/licenses/
#
##########################################################################

Expand All @@ -23,7 +23,7 @@ def apply_sparse(self, x):
"""
Return the image of ``x`` under ``self``.
If ``x`` is not in ``self.domain()``, raise a ``TypeError``.
If ``x`` is not in ``self.domain()``, raise a :class:`TypeError`.
EXAMPLES::
Expand Down
2 changes: 1 addition & 1 deletion src/sage/modular/overconvergent/genus0.py
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ def OverconvergentModularForms(prime, weight, radius, base_ring=QQ, prec=20, cha
if key in __ocmfdict:
w = __ocmfdict[key]
M = w()
if not (M is None):
if M is not None:
return M
M = OverconvergentModularFormsSpace(*key)
__ocmfdict[key] = weakref.ref(M)
Expand Down
6 changes: 3 additions & 3 deletions src/sage/modular/pollack_stevens/distributions.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,14 @@
(1 + O(11^5), 2 + O(11^4), 3 + O(11^3), 4 + O(11^2), 5 + O(11))
"""
#*****************************************************************************
# ****************************************************************************
# Copyright (C) 2012 Robert Pollack <rpollack@math.bu.edu>
#
# Distributed under the terms of the GNU General Public License (GPL)
# as published by the Free Software Foundation; either version 2 of
# the License, or (at your option) any later version.
# http://www.gnu.org/licenses/
#*****************************************************************************
# https://www.gnu.org/licenses/
# ****************************************************************************

from sage.misc.lazy_import import lazy_import
from sage.modules.module import Module
Expand Down
6 changes: 3 additions & 3 deletions src/sage/modular/pollack_stevens/fund_domain.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@
- Robert Pollack, Jonathan Hanke (2012): initial version
"""
#*****************************************************************************
# ****************************************************************************
# Copyright (C) 2012 Robert Pollack <rpollack@math.bu.edu>
# Jonathan Hanke <jonhanke@gmail.com>
#
# Distributed under the terms of the GNU General Public License (GPL)
# as published by the Free Software Foundation; either version 2 of
# the License, or (at your option) any later version.
# http://www.gnu.org/licenses/
#*****************************************************************************
# https://www.gnu.org/licenses/
# ****************************************************************************

from sage.matrix.matrix_space import MatrixSpace
from sage.modular.modsym.all import P1List
Expand Down
6 changes: 3 additions & 3 deletions src/sage/modular/pollack_stevens/manin_map.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,14 @@
1
"""

#*****************************************************************************
# ****************************************************************************
# Copyright (C) 2012 Robert Pollack <rpollack@math.bu.edu>
#
# Distributed under the terms of the GNU General Public License (GPL)
# as published by the Free Software Foundation; either version 2 of
# the License, or (at your option) any later version.
# http://www.gnu.org/licenses/
#*****************************************************************************
# https://www.gnu.org/licenses/
# ****************************************************************************

from sage.rings.continued_fraction import convergents
from .sigma0 import Sigma0
Expand Down
10 changes: 5 additions & 5 deletions src/sage/modular/pollack_stevens/space.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,14 @@
sage: phi.parent()
Space of modular symbols for Congruence Subgroup Gamma0(37) with sign 0 and values in Sym^0 Q^2
"""
#*****************************************************************************
# ****************************************************************************
# Copyright (C) 2012 Robert Pollack <rpollack@math.bu.edu>
#
# Distributed under the terms of the GNU General Public License (GPL)
# as published by the Free Software Foundation; either version 2 of
# the License, or (at your option) any later version.
# http://www.gnu.org/licenses/
#*****************************************************************************
# https://www.gnu.org/licenses/
# ****************************************************************************
from sage.modules.module import Module
from sage.modular.dirichlet import DirichletCharacter
from sage.modular.arithgroup.all import Gamma0
Expand All @@ -76,7 +76,7 @@

from .distributions import OverconvergentDistributions, Symk
from .modsym import (PSModularSymbolElement, PSModularSymbolElement_symk,
PSModularSymbolElement_dist, PSModSymAction)
PSModularSymbolElement_dist, PSModSymAction)
from .manin_map import ManinMap
from .sigma0 import Sigma0, Sigma0Element

Expand Down Expand Up @@ -887,7 +887,7 @@ def ps_modsym_from_elliptic_curve(E, sign=0, implementation='eclib'):
sage: symb.values()
[-1/6, 1/3, 1/2, 1/6, -1/6, 1/3, -1/3, -1/2, -1/6, 1/6, 0, -1/6, -1/6]
"""
if not (E.base_ring() is QQ):
if E.base_ring() is not QQ:
raise ValueError("The elliptic curve must be defined over the "
"rationals.")
sign = Integer(sign)
Expand Down

0 comments on commit ce6cac2

Please sign in to comment.