diff --git a/.vscode/settings.json b/.vscode/settings.json index 77dcb2ce188..b3079a7c4ee 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -27,7 +27,7 @@ "python.linting.enabled": true, // The following pycodestyle arguments are the same as the pycodestyle-minimal // tox environnment, see the file SAGE_ROOT/src/tox.ini - "python.linting.pycodestyleArgs": ["--select= E111,E21,E222,E227,E25,E271,E303,E306,E401,E502,E701,E702,E703,E71,E72,W291,W293,W391,W605"], + "python.linting.pycodestyleArgs": ["--select= E111,E21,E222,E227,E25,E271,E303,E305,E306,E401,E502,E701,E702,E703,E71,E72,W291,W293,W391,W605"], "cSpell.words": [ "furo", "Conda", diff --git a/src/sage/algebras/lie_algebras/examples.py b/src/sage/algebras/lie_algebras/examples.py index 89ad4362e5e..2c6c23297f9 100644 --- a/src/sage/algebras/lie_algebras/examples.py +++ b/src/sage/algebras/lie_algebras/examples.py @@ -309,6 +309,7 @@ def regular_vector_fields(R): from sage.algebras.lie_algebras.virasoro import LieAlgebraRegularVectorFields return LieAlgebraRegularVectorFields(R) + witt = regular_vector_fields def pwitt(R, p): diff --git a/src/sage/combinat/designs/bibd.py b/src/sage/combinat/designs/bibd.py index e484070c4e8..ed44883be25 100644 --- a/src/sage/combinat/designs/bibd.py +++ b/src/sage/combinat/designs/bibd.py @@ -1048,6 +1048,7 @@ def _PBD_4_5_8_9_12_closure(B): BB.append(X) return BB + table_7_1 = { 0:{'t':-4,'u':16,'s':2}, 1:{'t':-4,'u':17,'s':2}, @@ -1652,4 +1653,5 @@ def arc(self, s=2, solver=None, verbose=0, *, integrality_tolerance=1e-3): values = p.get_values(b, convert=bool, tolerance=integrality_tolerance) return [self._points[i] for (i,j) in values.items() if j] + BIBD = BalancedIncompleteBlockDesign diff --git a/src/sage/combinat/designs/database.py b/src/sage/combinat/designs/database.py index ebefb6bc669..5302771756c 100644 --- a/src/sage/combinat/designs/database.py +++ b/src/sage/combinat/designs/database.py @@ -296,6 +296,7 @@ def MOLS_18_3(): # # This dictionary is used by designs.mutually_orthogonal_latin_squares(k,n). + MOLS_constructions = { 10 : (2, MOLS_10_2), 12 : (5, MOLS_12_5), @@ -2021,6 +2022,7 @@ def OA_10_1620(): # # This dictionary is used by designs.orthogonal_array(k,n). + OA_constructions = { 18 : (7 , OA_7_18), 40 : (9 , OA_9_40), @@ -2455,6 +2457,7 @@ def QDM_57_9_1_1_8(): # } # } + QDM: dict[tuple[int, int], dict] = {} for ((n,k,lmbda,mu,u),f) in [((19,6,1,1,1), QDM_19_6_1_1_1), ((21,5,1,1,1), QDM_21_5_1_1_1), @@ -4018,6 +4021,7 @@ def DM_993_32_1(): G = AdditiveCyclic(993) return G, M + DM = { (12 ,1) : (6 ,DM_12_6_1), (21 ,1) : (6 ,DM_21_6_1), @@ -4686,6 +4690,7 @@ def BIBD_56_11_2(): D = IncidenceStructure(libgap.Orbit(G, B, libgap.OnSets)) return D._blocks + # Index of the BIBD constructions # # Associates to triple (v,k,lambda) a function that return a diff --git a/src/sage/combinat/designs/difference_family.py b/src/sage/combinat/designs/difference_family.py index 382240627ab..6745985adec 100644 --- a/src/sage/combinat/designs/difference_family.py +++ b/src/sage/combinat/designs/difference_family.py @@ -3606,6 +3606,7 @@ def difference_family(v, k, l=1, existence=False, explain_construction=False, ch return G, D + from sage.misc.rest_index_of_methods import gen_rest_table_index import sys __doc__ = __doc__.format(INDEX_OF_FUNCTIONS=gen_rest_table_index(sys.modules[__name__])) diff --git a/src/sage/combinat/designs/ext_rep.py b/src/sage/combinat/designs/ext_rep.py index cc2f13687a0..0f5bdf339fa 100644 --- a/src/sage/combinat/designs/ext_rep.py +++ b/src/sage/combinat/designs/ext_rep.py @@ -565,6 +565,7 @@ def open_extrep_url(url): else: return f.read() + pattern_integer = re.compile(r'\d+$') pattern_decimal = re.compile(r'-?\d+\.\d+$') pattern_rational = re.compile(r'-?\d+/\d+$') diff --git a/src/sage/geometry/hyperplane_arrangement/library.py b/src/sage/geometry/hyperplane_arrangement/library.py index 83c4f80c325..63a94ce3fb3 100644 --- a/src/sage/geometry/hyperplane_arrangement/library.py +++ b/src/sage/geometry/hyperplane_arrangement/library.py @@ -722,4 +722,5 @@ def Shi(self, data, K=QQ, names=None, m=1): A.characteristic_polynomial.set_cache(charpoly) return A + hyperplane_arrangements = HyperplaneArrangementLibrary() diff --git a/src/sage/groups/abelian_gps/abelian_group.py b/src/sage/groups/abelian_gps/abelian_group.py index ac21449c631..a72ad3e180c 100644 --- a/src/sage/groups/abelian_gps/abelian_group.py +++ b/src/sage/groups/abelian_gps/abelian_group.py @@ -1893,5 +1893,6 @@ def gen(self, n): """ return self._gens[n] + # We allow subclasses to override this, analogous to Element AbelianGroup_class.Subgroup = AbelianGroup_subgroup diff --git a/src/sage/groups/matrix_gps/morphism.py b/src/sage/groups/matrix_gps/morphism.py index 9805161d016..e2fc2e0fd59 100644 --- a/src/sage/groups/matrix_gps/morphism.py +++ b/src/sage/groups/matrix_gps/morphism.py @@ -42,6 +42,7 @@ def to_libgap(x): from sage.libs.gap.libgap import libgap return libgap(x) + lazy_import('sage.groups.libgap_morphism', 'GroupMorphism_libgap', 'MatrixGroupMorphism_im_gens', deprecation=25444) diff --git a/src/sage/groups/perm_gps/cubegroup.py b/src/sage/groups/perm_gps/cubegroup.py index c2900907919..128d3beb480 100644 --- a/src/sage/groups/perm_gps/cubegroup.py +++ b/src/sage/groups/perm_gps/cubegroup.py @@ -296,6 +296,7 @@ def create_poly(face, color): #################################################### + singmaster_indices = { 1: "ulb", 2: "ub", @@ -1181,6 +1182,7 @@ def cubie_faces(): return cubies + cubie_face_list = cubie_faces() diff --git a/src/sage/groups/perm_gps/permgroup.py b/src/sage/groups/perm_gps/permgroup.py index 8e716427db0..130c0960361 100644 --- a/src/sage/groups/perm_gps/permgroup.py +++ b/src/sage/groups/perm_gps/permgroup.py @@ -5157,6 +5157,7 @@ def is_normal(self, other=None): other = self.ambient_group() return PermutationGroup_generic.is_normal(self, other) + # Allow for subclasses to use a different subgroup class PermutationGroup_generic.Subgroup = PermutationGroup_subgroup @@ -5265,5 +5266,6 @@ def orbits(self): """ return self._orbits + from sage.misc.rest_index_of_methods import gen_rest_table_index __doc__ = __doc__.format(METHODS_OF_PermutationGroup_generic=gen_rest_table_index(PermutationGroup_generic)) diff --git a/src/sage/libs/pari/__init__.py b/src/sage/libs/pari/__init__.py index ba4c5ad0efd..95b93560892 100644 --- a/src/sage/libs/pari/__init__.py +++ b/src/sage/libs/pari/__init__.py @@ -202,4 +202,5 @@ def _get_pari_instance(): return P + pari = _get_pari_instance() diff --git a/src/sage/matrix/matrix_polynomial_dense.pyx b/src/sage/matrix/matrix_polynomial_dense.pyx index e8b4d4d9176..10d9a9248b6 100644 --- a/src/sage/matrix/matrix_polynomial_dense.pyx +++ b/src/sage/matrix/matrix_polynomial_dense.pyx @@ -1670,8 +1670,8 @@ cdef class Matrix_polynomial_dense(Matrix_generic_dense): # the row-wise case (resp. column-wise case), it will be convenient to # have leading position ncols (resp. nrows) for these zero vectors pos_zero_vec = self.ncols() if row_wise else self.nrows() - leading_positions = [pos if pos>=0 else pos_zero_vec + 1 \ - for pos in leading_positions] + leading_positions = [pos if pos >= 0 else pos_zero_vec + 1 + for pos in leading_positions] # leading positions should not have duplicates, which is equivalent to: # once sorted, it doesn't contain a pair of equal successive entries if not ordered: diff --git a/src/sage/modular/arithgroup/congroup_gamma0.py b/src/sage/modular/arithgroup/congroup_gamma0.py index 5bc0a6e4b3a..e960ce477d3 100644 --- a/src/sage/modular/arithgroup/congroup_gamma0.py +++ b/src/sage/modular/arithgroup/congroup_gamma0.py @@ -39,6 +39,7 @@ def is_Gamma0(x): """ return isinstance(x, Gamma0_class) + _gamma0_cache = {} def Gamma0_constructor(N): """ diff --git a/src/sage/modular/modform/constructor.py b/src/sage/modular/modform/constructor.py index c30a28354ca..023f9a380d2 100644 --- a/src/sage/modular/modform/constructor.py +++ b/src/sage/modular/modform/constructor.py @@ -134,6 +134,7 @@ def canonical_parameters(group, level, weight, base_ring): # forms spaces. return level, group, weight, base_ring + _cache = {} def ModularForms_clear_cache(): diff --git a/src/sage/modular/pollack_stevens/distributions.py b/src/sage/modular/pollack_stevens/distributions.py index 55a5ec72663..274cdfa87a4 100644 --- a/src/sage/modular/pollack_stevens/distributions.py +++ b/src/sage/modular/pollack_stevens/distributions.py @@ -224,6 +224,7 @@ def create_object(self, version, key): """ return Symk_class(*key) + OverconvergentDistributions = OverconvergentDistributions_factory('OverconvergentDistributions') Symk = Symk_factory('Symk') diff --git a/src/sage/modular/pollack_stevens/fund_domain.py b/src/sage/modular/pollack_stevens/fund_domain.py index 3e25c950b30..4bd2638d5a6 100644 --- a/src/sage/modular/pollack_stevens/fund_domain.py +++ b/src/sage/modular/pollack_stevens/fund_domain.py @@ -56,6 +56,7 @@ def M2Z(x): x.set_immutable() return x + Id = M2Z([1, 0, 0, 1]) sig = M2Z([0, 1, -1, 0]) tau = M2Z([0, -1, 1, -1]) diff --git a/src/sage/modular/pollack_stevens/sigma0.py b/src/sage/modular/pollack_stevens/sigma0.py index ab8e24959cd..bd203ec8600 100644 --- a/src/sage/modular/pollack_stevens/sigma0.py +++ b/src/sage/modular/pollack_stevens/sigma0.py @@ -162,6 +162,7 @@ def create_object(self, version, key): """ return Sigma0_class(*key) + Sigma0 = Sigma0_factory('sage.modular.pollack_stevens.sigma0.Sigma0') diff --git a/src/sage/modular/pollack_stevens/space.py b/src/sage/modular/pollack_stevens/space.py index 43e396b03c8..88b7be6d2cd 100644 --- a/src/sage/modular/pollack_stevens/space.py +++ b/src/sage/modular/pollack_stevens/space.py @@ -189,6 +189,7 @@ def create_object(self, version, key): """ return PollackStevensModularSymbolspace(*key) + PollackStevensModularSymbols = PollackStevensModularSymbols_factory('PollackStevensModularSymbols') diff --git a/src/sage/modules/fg_pid/fgp_morphism.py b/src/sage/modules/fg_pid/fgp_morphism.py index 71b43dcdc1a..809bb439f0c 100644 --- a/src/sage/modules/fg_pid/fgp_morphism.py +++ b/src/sage/modules/fg_pid/fgp_morphism.py @@ -453,6 +453,7 @@ def lift(self, x): assert self(y) == x, "bug in phi.lift()" return y + from sage.categories.homset import Homset import sage.misc.weak_dict diff --git a/src/sage/plot/plot3d/plot3d.py b/src/sage/plot/plot3d/plot3d.py index 41a1ad5de53..2d2bfb9e34d 100644 --- a/src/sage/plot/plot3d/plot3d.py +++ b/src/sage/plot/plot3d/plot3d.py @@ -953,6 +953,7 @@ def smooth_triangle(self, a, b, c, da, db, dc, color=None): """ return [a,b,c] + from . import parametric_plot3d def plot3d(f, urange, vrange, adaptive=False, transformation=None, **kwds): """ diff --git a/src/sage/schemes/elliptic_curves/cm.py b/src/sage/schemes/elliptic_curves/cm.py index ddfc6bb1d3c..09a6b63f402 100644 --- a/src/sage/schemes/elliptic_curves/cm.py +++ b/src/sage/schemes/elliptic_curves/cm.py @@ -535,6 +535,7 @@ def cm_orders(h, proof=None): # quadratic field with class number h, and n is the number of such # fields. These are all *unconditional* (not dependent on GRH). + watkins_table = {1: (163, 9), 2: (427, 18), 3: (907, 16), 4: (1555, 54), 5: (2683, 25), 6: (3763, 51), 7: (5923, 31), 8: (6307, 131), 9: (10627, 34), 10: (13843, 87), 11: (15667, 41), 12: (17803, 206), 13: (20563, 37), 14: @@ -717,6 +718,7 @@ class number `h` is also the largest discriminant, but this is not # initialise it with h=1 only; other values will be added by calls to # discriminants_with_bounded_class_number(). + hDf_dict = {ZZ(1): [(ZZ(D), ZZ(h)) for D,h in [(-3, 1), (-3, 2), (-3, 3), (-4, 1), (-4, 2), (-7, 1), (-7, 2), (-8, 1), (-11, 1), (-19, 1), (-43, 1), (-67, 1), (-163, 1)]]} diff --git a/src/sage/schemes/elliptic_curves/ell_curve_isogeny.py b/src/sage/schemes/elliptic_curves/ell_curve_isogeny.py index 5c3f4c58d14..383cc8e4fd7 100644 --- a/src/sage/schemes/elliptic_curves/ell_curve_isogeny.py +++ b/src/sage/schemes/elliptic_curves/ell_curve_isogeny.py @@ -171,6 +171,7 @@ def _isogeny_determine_algorithm(E, kernel): raise ValueError("invalid parameters to EllipticCurveIsogeny constructor") + from sage.misc.superseded import deprecated_function_alias isogeny_determine_algorithm = deprecated_function_alias(33619, _isogeny_determine_algorithm) @@ -3451,6 +3452,7 @@ def compute_isogeny_stark(E1, E2, ell): qn /= qn.leading_coefficient() return qn + from sage.misc.superseded import deprecated_function_alias compute_isogeny_starks = deprecated_function_alias(34871, compute_isogeny_stark) diff --git a/src/sage/schemes/elliptic_curves/ell_finite_field.py b/src/sage/schemes/elliptic_curves/ell_finite_field.py index af71b5a72f1..52115c51c7d 100644 --- a/src/sage/schemes/elliptic_curves/ell_finite_field.py +++ b/src/sage/schemes/elliptic_curves/ell_finite_field.py @@ -2127,6 +2127,7 @@ def curves_with_j_0_char3(K): # dict to hold precomputed coefficient vectors of supersingular j values (excluding 0, 1728): + supersingular_j_polynomials = {} def fill_ss_j_dict(): diff --git a/src/sage_docbuild/__main__.py b/src/sage_docbuild/__main__.py index d7984c7fc0f..77919ec4000 100644 --- a/src/sage_docbuild/__main__.py +++ b/src/sage_docbuild/__main__.py @@ -498,5 +498,6 @@ def excepthook(*exc_info): builder = getattr(get_builder(name), typ) builder() + if __name__ == '__main__': sys.exit(main()) diff --git a/src/sage_docbuild/conf.py b/src/sage_docbuild/conf.py index d488a6a13a4..0df2760c035 100644 --- a/src/sage_docbuild/conf.py +++ b/src/sage_docbuild/conf.py @@ -691,6 +691,7 @@ def add_page_context(app, pagename, templatename, context, doctree): context['reference_root'] = os.path.join(relpath, 'index.html') context['refsub'] = True + dangling_debug = False def debug_inf(app, message): @@ -816,6 +817,7 @@ def find_sage_dangling_links(app, env, node, contnode): newnode.append(contnode) return newnode + # lists of basic Python class which are documented as functions base_class_as_func = [ 'bool', 'complex', 'dict', 'file', 'float', @@ -842,6 +844,7 @@ def nitpick_patch_config(app): app.config.values['nitpicky'] = (False, 'sage') app.config.values['nitpick_ignore'] = ([], 'sage') + skip_picklability_check_modules = [ #'sage.misc.test_nested_class', # for test only 'sage.misc.latex', diff --git a/src/sage_docbuild/ext/sage_autodoc.py b/src/sage_docbuild/ext/sage_autodoc.py index e89b8fc9ba4..5b7db9efbbc 100644 --- a/src/sage_docbuild/ext/sage_autodoc.py +++ b/src/sage_docbuild/ext/sage_autodoc.py @@ -73,6 +73,7 @@ def getdoc(obj, *args, **kwargs): return sage_getdoc_original(obj) # ------------------------------------------------------------------ + if TYPE_CHECKING: from sphinx.ext.autodoc.directive import DocumenterBridge diff --git a/src/sage_setup/autogen/interpreters/storage.py b/src/sage_setup/autogen/interpreters/storage.py index d9e0e60273f..291398fd9d9 100644 --- a/src/sage_setup/autogen/interpreters/storage.py +++ b/src/sage_setup/autogen/interpreters/storage.py @@ -440,6 +440,7 @@ class StorageTypeSimple(StorageTypeAssignable): """ pass + ty_int = StorageTypeSimple('int') ty_double = StorageTypeSimple('double') @@ -461,6 +462,7 @@ def assign_c_from_py(self, c, py): """ return je("{{ c }} = CDE_to_dz({{ py }})", c=c, py=py) + ty_double_complex = StorageTypeDoubleComplex('double_complex') @@ -650,6 +652,7 @@ def cython_clear(self, loc): """ return je("Py_CLEAR({{ loc }})", loc=loc) + ty_python = StorageTypePython() @@ -846,6 +849,7 @@ def assign_c_from_py(self, c, py): mpfr_set({{ c }}, rn.value, MPFR_RNDN)"""), myself=self, c=c, py=py) + ty_mpfr = StorageTypeMPFR() class StorageTypeMPC(StorageTypeAutoReference): @@ -948,4 +952,5 @@ def assign_c_from_py(self, c, py): cn{{ myself.id }} = self.domain({{ py }}) mpc_set_fr_fr({{ c }}, cn.__re, cn.__im, MPC_RNDNN)""", myself=self, c=c, py=py) + ty_mpc = StorageTypeMPC() diff --git a/src/tox.ini b/src/tox.ini index 8d2ef29439d..5021d0aa691 100644 --- a/src/tox.ini +++ b/src/tox.ini @@ -109,6 +109,7 @@ description = # E111: indentation is not a multiple of four # E211: whitespace before '(' # E271: multiple spaces after keyword + # E305: expected 2 blank lines after class or function definition, found 1 # E306: expected 1 blank line before a nested definition, found 0 # E401: multiple imports on one line # E502 the backslash is redundant between brackets @@ -126,8 +127,8 @@ description = # W605: invalid escape sequence ‘x’ # See https://pycodestyle.pycqa.org/en/latest/intro.html#error-codes deps = pycodestyle -commands = pycodestyle --select E111,E21,E222,E227,E25,E271,E303,E306,E401,E502,E701,E702,E703,E71,E72,W291,W293,W391,W605 {posargs:{toxinidir}/sage/} - pycodestyle --select E111,E271,E301,E306,E401,E703,E712,E713,E714,E72,W29,W391,W605, --filename *.pyx {posargs:{toxinidir}/sage/} +commands = pycodestyle --select E111,E21,E222,E227,E25,E271,E303,E305,E306,E401,E502,E701,E702,E703,E71,E72,W291,W293,W391,W605 {posargs:{toxinidir}/sage/} + pycodestyle --select E111,E271,E301,E306,E401,E502,E703,E712,E713,E714,E72,W29,W391,W605, --filename *.pyx {posargs:{toxinidir}/sage/} [pycodestyle] max-line-length = 160