From 479e01fe087282af62be340355240a9d2ec9c823 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Chapoton?= Date: Mon, 28 Aug 2023 18:17:59 +0200 Subject: [PATCH 1/4] fix E305 in rings/ --- src/sage/rings/finite_rings/finite_field_prime_modn.py | 1 + src/sage/rings/function_field/constructor.py | 3 +++ src/sage/rings/function_field/valuation.py | 1 + src/sage/rings/infinity.py | 10 +++++++--- src/sage/rings/monomials.py | 2 ++ src/sage/rings/number_field/galois_group.py | 1 + src/sage/rings/number_field/number_field_rel.py | 1 + src/sage/rings/padics/factory.py | 4 ++++ src/sage/rings/padics/padic_valuation.py | 2 ++ src/sage/rings/pari_ring.py | 1 + src/sage/rings/polynomial/multi_polynomial_ideal.py | 5 ++++- src/sage/rings/polynomial/multi_polynomial_sequence.py | 1 + .../rings/polynomial/polynomial_element_generic.py | 1 + src/sage/rings/polynomial/polynomial_quotient_ring.py | 4 +++- src/sage/rings/rational_field.py | 7 +++++-- .../rings/semirings/non_negative_integer_semiring.py | 1 + src/sage/rings/tate_algebra.py | 1 + 17 files changed, 39 insertions(+), 7 deletions(-) diff --git a/src/sage/rings/finite_rings/finite_field_prime_modn.py b/src/sage/rings/finite_rings/finite_field_prime_modn.py index 8bb35604697..95c1803abf4 100644 --- a/src/sage/rings/finite_rings/finite_field_prime_modn.py +++ b/src/sage/rings/finite_rings/finite_field_prime_modn.py @@ -340,6 +340,7 @@ def degree(self): """ return Integer(1) + register_unpickle_override( 'sage.rings.finite_field_prime_modn', 'FiniteField_prime_modn', FiniteField_prime_modn) diff --git a/src/sage/rings/function_field/constructor.py b/src/sage/rings/function_field/constructor.py index 8e5ecd281ee..31156bc9c6f 100644 --- a/src/sage/rings/function_field/constructor.py +++ b/src/sage/rings/function_field/constructor.py @@ -111,8 +111,10 @@ def create_object(self, version, key,**extra_args): from .function_field_rational import RationalFunctionField return RationalFunctionField(key[0], names=key[1]) + FunctionField=FunctionFieldFactory("sage.rings.function_field.constructor.FunctionField") + class FunctionFieldExtensionFactory(UniqueFactory): """ Create a function field defined as an extension of another @@ -210,5 +212,6 @@ def create_object(self,version,key,**extra_args): return function_field_polymod.FunctionField_char_zero(f, names) return function_field_polymod.FunctionField_polymod(f, names) + FunctionFieldExtension = FunctionFieldExtensionFactory( "sage.rings.function_field.constructor.FunctionFieldExtension") diff --git a/src/sage/rings/function_field/valuation.py b/src/sage/rings/function_field/valuation.py index 5567c4db1ce..3f504868e4c 100644 --- a/src/sage/rings/function_field/valuation.py +++ b/src/sage/rings/function_field/valuation.py @@ -454,6 +454,7 @@ def create_object(self, version, key, **extra_args): raise NotImplementedError("valuation on %r from %r on %r" % (domain, valuation, valuation.domain())) + FunctionFieldValuation = FunctionFieldValuationFactory("sage.rings.function_field.valuation.FunctionFieldValuation") diff --git a/src/sage/rings/infinity.py b/src/sage/rings/infinity.py index d4cbe9372bb..e084e6099b7 100644 --- a/src/sage/rings/infinity.py +++ b/src/sage/rings/infinity.py @@ -757,6 +757,7 @@ def _coerce_map_from_(self, R): """ return isinstance(R, Ring) or R in (int, float, complex) + UnsignedInfinityRing = UnsignedInfinityRing_class() @@ -966,10 +967,12 @@ def _richcmp_(self, other, op): return rich_to_bool(op, 1) return rich_to_bool(op, 0) + unsigned_infinity = UnsignedInfinityRing.gen(0) less_than_infinity = UnsignedInfinityRing.less_than_infinity() -def is_Infinite(x): + +def is_Infinite(x) -> bool: """ This is a type check for infinity elements. @@ -1082,7 +1085,7 @@ def gens(self): """ return [self.gen(0), self.gen(1)] - def is_zero(self): + def is_zero(self) -> bool: """ The Infinity Ring is not zero @@ -1093,7 +1096,7 @@ def is_zero(self): """ return False - def is_commutative(self): + def is_commutative(self) -> bool: """ The Infinity Ring is commutative @@ -1746,6 +1749,7 @@ def _gap_init_(self): """ return 'infinity' + InfinityRing = InfinityRing_class() infinity = InfinityRing.gen(0) Infinity = infinity diff --git a/src/sage/rings/monomials.py b/src/sage/rings/monomials.py index 0beb25a1044..f0c1f92162f 100644 --- a/src/sage/rings/monomials.py +++ b/src/sage/rings/monomials.py @@ -34,8 +34,10 @@ def _monomials(gens, R, n, i): z *= gens[i] return v + from sage.structure.sequence import Sequence + def monomials(v, n): """ Given two lists ``v`` and ``n``, of exactly the same length, diff --git a/src/sage/rings/number_field/galois_group.py b/src/sage/rings/number_field/galois_group.py index 748122fe924..07b58b7b2a2 100644 --- a/src/sage/rings/number_field/galois_group.py +++ b/src/sage/rings/number_field/galois_group.py @@ -1292,6 +1292,7 @@ def ramification_degree(self, P): w = [(self(g) - g).valuation(P) for g in gens] return min(w) + GaloisGroup_v2.Element = GaloisGroupElement GaloisGroup_v2.Subgroup = GaloisGroup_subgroup GaloisGroup_subgroup.Element = GaloisGroupElement diff --git a/src/sage/rings/number_field/number_field_rel.py b/src/sage/rings/number_field/number_field_rel.py index 143191e05f1..2e2989d413f 100644 --- a/src/sage/rings/number_field/number_field_rel.py +++ b/src/sage/rings/number_field/number_field_rel.py @@ -2731,4 +2731,5 @@ def NumberField_relative_v1(base_field, poly, name, latex_name, canonical_embedd return NumberField(poly.change_ring(base_field), name, check=False, embedding=canonical_embedding, latex_name=latex_name) + NumberField_extension_v1 = NumberField_relative_v1 # historical reasons only diff --git a/src/sage/rings/padics/factory.py b/src/sage/rings/padics/factory.py index 2004f295d20..e001b9e5086 100644 --- a/src/sage/rings/padics/factory.py +++ b/src/sage/rings/padics/factory.py @@ -815,6 +815,7 @@ def create_object(self, version, key): else: raise ValueError("unexpected type") + Qp = Qp_class("Qp") @@ -2027,6 +2028,7 @@ def create_object(self, version, key): else: raise ValueError("unexpected type") + Zp = Zp_class("Zp") @@ -3431,8 +3433,10 @@ def create_object(self, version, key, approx_modulus=None, shift_seed=None): 'max_ram_terms': print_max_ram_terms, 'max_unram_terms': print_max_unram_terms, 'max_terse_terms': print_max_terse_terms, 'show_prec': show_prec}, shift_seed, names, implementation) + ExtensionFactory = pAdicExtension = pAdicExtension_class("pAdicExtension") + ###################################################### # Helper functions for the Extension Factory ###################################################### diff --git a/src/sage/rings/padics/padic_valuation.py b/src/sage/rings/padics/padic_valuation.py index 0c0883dfa96..dbd8830a4d4 100644 --- a/src/sage/rings/padics/padic_valuation.py +++ b/src/sage/rings/padics/padic_valuation.py @@ -416,8 +416,10 @@ def create_object(self, version, key, **extra_args): raise NotImplementedError return parent.__make_element_class__(pAdicFromLimitValuation)(parent, v, G.change_ring(R.base_ring()), approximants) + pAdicValuation = PadicValuationFactory("sage.rings.padics.padic_valuation.pAdicValuation") + class pAdicValuation_base(DiscreteValuation): r""" Abstract base class for `p`-adic valuations. diff --git a/src/sage/rings/pari_ring.py b/src/sage/rings/pari_ring.py index c46fceed07b..98b42c2634a 100644 --- a/src/sage/rings/pari_ring.py +++ b/src/sage/rings/pari_ring.py @@ -230,4 +230,5 @@ def zeta(self): """ return self(-1) + _inst = PariRing() diff --git a/src/sage/rings/polynomial/multi_polynomial_ideal.py b/src/sage/rings/polynomial/multi_polynomial_ideal.py index 6e0265cad53..28d93c1aa6c 100644 --- a/src/sage/rings/polynomial/multi_polynomial_ideal.py +++ b/src/sage/rings/polynomial/multi_polynomial_ideal.py @@ -303,9 +303,11 @@ def __call__(self, *args, **kwds): raise ValueError("Coefficient ring must be a field for function '%s'."%(self.f.__name__)) return self.f(self._instance, *args, **kwds) + require_field = RequireField -def is_MPolynomialIdeal(x): + +def is_MPolynomialIdeal(x) -> bool: """ Return ``True`` if the provided argument ``x`` is an ideal in a multivariate polynomial ring. @@ -335,6 +337,7 @@ def is_MPolynomialIdeal(x): """ return isinstance(x, MPolynomialIdeal) + class MPolynomialIdeal_magma_repr: def _magma_init_(self, magma): """ diff --git a/src/sage/rings/polynomial/multi_polynomial_sequence.py b/src/sage/rings/polynomial/multi_polynomial_sequence.py index 22c92ba44d6..1cfabbeda6e 100644 --- a/src/sage/rings/polynomial/multi_polynomial_sequence.py +++ b/src/sage/rings/polynomial/multi_polynomial_sequence.py @@ -1673,6 +1673,7 @@ def weil_restriction(self): J += FieldIdeal(J.ring()) return PolynomialSequence(J) + from sage.misc.persist import register_unpickle_override register_unpickle_override("sage.crypto.mq.mpolynomialsystem","MPolynomialSystem_generic", PolynomialSequence_generic) register_unpickle_override("sage.crypto.mq.mpolynomialsystem","MPolynomialRoundSystem_generic", PolynomialSequence_generic) diff --git a/src/sage/rings/polynomial/polynomial_element_generic.py b/src/sage/rings/polynomial/polynomial_element_generic.py index 77b9a7d8c92..f7b4ba226b9 100644 --- a/src/sage/rings/polynomial/polynomial_element_generic.py +++ b/src/sage/rings/polynomial/polynomial_element_generic.py @@ -1607,6 +1607,7 @@ class Polynomial_generic_dense_cdvf(Polynomial_generic_dense_cdv, Polynomial_gen class Polynomial_generic_sparse_cdvf(Polynomial_generic_sparse_cdv, Polynomial_generic_cdvf): pass + ############################################################################ # XXX: Ensures that the generic polynomials implemented in Sage via PARI # # until at least until 4.5.0 unpickle correctly as polynomials implemented # diff --git a/src/sage/rings/polynomial/polynomial_quotient_ring.py b/src/sage/rings/polynomial/polynomial_quotient_ring.py index 07d5e0cb837..2a6a155b5ae 100644 --- a/src/sage/rings/polynomial/polynomial_quotient_ring.py +++ b/src/sage/rings/polynomial/polynomial_quotient_ring.py @@ -53,12 +53,14 @@ from sage.rings.quotient_ring import QuotientRing_generic from sage.structure.category_object import normalize_names +from sage.structure.coerce_maps import DefaultConvertMap_unique from sage.structure.factory import UniqueFactory from sage.rings.polynomial.infinite_polynomial_ring import GenDictWithBasering from sage.structure.richcmp import richcmp + class PolynomialQuotientRingFactory(UniqueFactory): r""" Create a quotient of a polynomial ring. @@ -2167,7 +2169,7 @@ def _test_isomorphic_ring(self, **options): tester.assertIn(y, ring) tester.assertEqual(from_isomorphic_ring(y), x) -from sage.structure.coerce_maps import DefaultConvertMap_unique + class PolynomialQuotientRing_coercion(DefaultConvertMap_unique): r""" A coercion map from a :class:`PolynomialQuotientRing` to a diff --git a/src/sage/rings/rational_field.py b/src/sage/rings/rational_field.py index cbd5a4ba483..642f95dc232 100644 --- a/src/sage/rings/rational_field.py +++ b/src/sage/rings/rational_field.py @@ -1673,10 +1673,12 @@ def valuation(self, p): from sage.rings.padics.padic_valuation import pAdicValuation return pAdicValuation(self, p) + QQ = RationalField() Q = QQ -def is_RationalField(x): + +def is_RationalField(x) -> bool: """ Check to see if ``x`` is the rational field. @@ -1690,7 +1692,8 @@ def is_RationalField(x): """ return isinstance(x, RationalField) -def frac(n,d): + +def frac(n, d): """ Return the fraction ``n/d``. diff --git a/src/sage/rings/semirings/non_negative_integer_semiring.py b/src/sage/rings/semirings/non_negative_integer_semiring.py index c041f18f99f..9d91e9cf777 100644 --- a/src/sage/rings/semirings/non_negative_integer_semiring.py +++ b/src/sage/rings/semirings/non_negative_integer_semiring.py @@ -101,4 +101,5 @@ def _latex_(self): """ return '\\Bold{N}' + NN = NonNegativeIntegerSemiring() diff --git a/src/sage/rings/tate_algebra.py b/src/sage/rings/tate_algebra.py index d1371b431f7..993f1a95aa1 100644 --- a/src/sage/rings/tate_algebra.py +++ b/src/sage/rings/tate_algebra.py @@ -329,6 +329,7 @@ def create_object(self, version, key): (base, prec, log_radii, names, order) = key return TateAlgebra_generic(base, prec, log_radii, names, order) + TateAlgebra = TateAlgebraFactory("TateAlgebra") From 9e9413928aeed6a058eb4d42cd4b0c2dbd32eccd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Chapoton?= Date: Mon, 28 Aug 2023 18:19:14 +0200 Subject: [PATCH 2/4] fix E305 in interfaces --- src/sage/interfaces/axiom.py | 2 ++ src/sage/interfaces/frobby.py | 1 + src/sage/interfaces/gap.py | 1 + src/sage/interfaces/genus2reduction.py | 1 + src/sage/interfaces/gnuplot.py | 1 + src/sage/interfaces/lisp.py | 2 ++ src/sage/interfaces/macaulay2.py | 1 + src/sage/interfaces/magma.py | 1 + src/sage/interfaces/matlab.py | 1 + src/sage/interfaces/maxima_lib.py | 3 +++ src/sage/interfaces/mupad.py | 1 + src/sage/interfaces/mwrank.py | 1 + src/sage/interfaces/octave.py | 1 + src/sage/interfaces/qepcad.py | 1 + src/sage/interfaces/r.py | 2 ++ src/sage/interfaces/scilab.py | 1 + src/sage/interfaces/singular.py | 1 + src/sage/interfaces/tachyon.py | 1 + 18 files changed, 23 insertions(+) diff --git a/src/sage/interfaces/axiom.py b/src/sage/interfaces/axiom.py index fe4637a7b19..83f9cb95817 100644 --- a/src/sage/interfaces/axiom.py +++ b/src/sage/interfaces/axiom.py @@ -916,6 +916,7 @@ def __init__(self, object, name): name = name[:-2] + "!" FunctionElement.__init__(self, object, name) + AxiomFunctionElement = PanAxiomFunctionElement @@ -936,6 +937,7 @@ def __init__(self, parent, name): name = name[:-2] + "!" ExpectFunction.__init__(self, parent, name) + AxiomExpectFunction = PanAxiomExpectFunction diff --git a/src/sage/interfaces/frobby.py b/src/sage/interfaces/frobby.py index 17c7f06f05f..ed6f5431dc3 100644 --- a/src/sage/interfaces/frobby.py +++ b/src/sage/interfaces/frobby.py @@ -466,5 +466,6 @@ def _monomial_to_string(self, monomial): strings = [str(exponents[var]) for var in range(len(exponents))] return ' '.join(strings) + '\n' + # This singleton instance is what should be used outside this file. frobby = Frobby() diff --git a/src/sage/interfaces/gap.py b/src/sage/interfaces/gap.py index 44900d525c8..951a36807b6 100644 --- a/src/sage/interfaces/gap.py +++ b/src/sage/interfaces/gap.py @@ -1767,6 +1767,7 @@ def intmod_gap_to_sage(x): ############# + gap = Gap() def reduce_load_GAP(): diff --git a/src/sage/interfaces/genus2reduction.py b/src/sage/interfaces/genus2reduction.py index 6fa64b68cca..0a03059f9b0 100644 --- a/src/sage/interfaces/genus2reduction.py +++ b/src/sage/interfaces/genus2reduction.py @@ -457,6 +457,7 @@ def __call__(self, Q, P): def __reduce__(self): return _reduce_load_genus2reduction, tuple([]) + # An instance genus2reduction = Genus2reduction() diff --git a/src/sage/interfaces/gnuplot.py b/src/sage/interfaces/gnuplot.py index b423866fd15..025a8155212 100644 --- a/src/sage/interfaces/gnuplot.py +++ b/src/sage/interfaces/gnuplot.py @@ -187,6 +187,7 @@ def interact(self, cmd): def console(self): gnuplot_console() + # An instance gnuplot = Gnuplot() diff --git a/src/sage/interfaces/lisp.py b/src/sage/interfaces/lisp.py index c4d8542a5ed..5c28b82bf88 100644 --- a/src/sage/interfaces/lisp.py +++ b/src/sage/interfaces/lisp.py @@ -537,6 +537,7 @@ def is_LispElement(x): return isinstance(x, LispElement) + # An instance lisp = Lisp() @@ -550,6 +551,7 @@ def reduce_load_Lisp(): """ return lisp + import os def lisp_console(): """ diff --git a/src/sage/interfaces/macaulay2.py b/src/sage/interfaces/macaulay2.py index 58ec79a48ee..956ca018838 100644 --- a/src/sage/interfaces/macaulay2.py +++ b/src/sage/interfaces/macaulay2.py @@ -1854,6 +1854,7 @@ def is_Macaulay2Element(x): return isinstance(x, Macaulay2Element) + # An instance macaulay2 = Macaulay2() diff --git a/src/sage/interfaces/magma.py b/src/sage/interfaces/magma.py index 4ff6477107f..09f809ef4d0 100644 --- a/src/sage/interfaces/magma.py +++ b/src/sage/interfaces/magma.py @@ -2753,6 +2753,7 @@ def ideal(self, gens): ########################################################################### + magma = Magma() diff --git a/src/sage/interfaces/matlab.py b/src/sage/interfaces/matlab.py index a2678b4dbcc..24c40a3647c 100644 --- a/src/sage/interfaces/matlab.py +++ b/src/sage/interfaces/matlab.py @@ -356,6 +356,7 @@ def set(self, i, j, x): z = P(x) P.eval('{0}({1},{2}) = {3}'.format(self.name(), i, j, z.name())) + # An instance matlab = Matlab() diff --git a/src/sage/interfaces/maxima_lib.py b/src/sage/interfaces/maxima_lib.py index cd1be891872..c8f9d574763 100644 --- a/src/sage/interfaces/maxima_lib.py +++ b/src/sage/interfaces/maxima_lib.py @@ -305,6 +305,7 @@ def max_to_string(s): """ return maxprint(s).python()[1:-1] + my_mread=ecl_eval(""" (defun my-mread (cmd) (caddr (mread (make-string-input-stream cmd)))) @@ -1278,6 +1279,7 @@ def sage_rat(x,y): """ return x/y + mplus=EclObject("MPLUS") mtimes=EclObject("MTIMES") rat=EclObject("RAT") @@ -1683,6 +1685,7 @@ def sr_to_max(expr): except TypeError: return maxima(expr).ecl() + # This goes from EclObject to SR from sage.symbolic.expression import symbol_table max_to_pynac_table = symbol_table['maxima'] diff --git a/src/sage/interfaces/mupad.py b/src/sage/interfaces/mupad.py index 8a101ab0995..d5115f297d3 100644 --- a/src/sage/interfaces/mupad.py +++ b/src/sage/interfaces/mupad.py @@ -638,6 +638,7 @@ def __len__(self): """ return mupad.nops(self) + # An instance mupad = Mupad() diff --git a/src/sage/interfaces/mwrank.py b/src/sage/interfaces/mwrank.py index ae65d0ffea0..fca82e687ec 100644 --- a/src/sage/interfaces/mwrank.py +++ b/src/sage/interfaces/mwrank.py @@ -67,6 +67,7 @@ def Mwrank(options="", server=None, server_tmpdir=None): instances[options] = weakref.ref(X) return X + import re # regex matching '[a1,a2,a3,a4,a6]', no spaces, each ai a possibly signed integer AINVS_LIST_RE = re.compile(r'\[[+-]?(\d+)(,[+-]?\d+){4}]') diff --git a/src/sage/interfaces/octave.py b/src/sage/interfaces/octave.py index f8f426c67e6..cf4f828151c 100644 --- a/src/sage/interfaces/octave.py +++ b/src/sage/interfaces/octave.py @@ -808,6 +808,7 @@ def _sage_(self): else: raise NotImplementedError('octave type is not recognized') + # An instance octave = Octave() diff --git a/src/sage/interfaces/qepcad.py b/src/sage/interfaces/qepcad.py index f54c8e181d7..8322aa361d0 100644 --- a/src/sage/interfaces/qepcad.py +++ b/src/sage/interfaces/qepcad.py @@ -662,6 +662,7 @@ def _qepcad_cmd(memcells=None): memcells_arg = '' return "env qe=%s qepcad %s"%(SAGE_LOCAL, memcells_arg) + _command_info_cache = None diff --git a/src/sage/interfaces/r.py b/src/sage/interfaces/r.py index 7d18f1e467e..acf984ddba9 100644 --- a/src/sage/interfaces/r.py +++ b/src/sage/interfaces/r.py @@ -2030,6 +2030,7 @@ def is_RElement(x): return isinstance(x, RElement) + # An instance of R r = R() @@ -2045,6 +2046,7 @@ def reduce_load_R(): """ return r + import os def r_console(): """ diff --git a/src/sage/interfaces/scilab.py b/src/sage/interfaces/scilab.py index 75ab263a53e..2e00b08372a 100644 --- a/src/sage/interfaces/scilab.py +++ b/src/sage/interfaces/scilab.py @@ -511,6 +511,7 @@ def set(self, i, j, x): z = P(x) P.eval('%s(%s,%s) = %s'%(self.name(), i, j, z.name())) + # An instance scilab = Scilab() diff --git a/src/sage/interfaces/singular.py b/src/sage/interfaces/singular.py index 4b5c76e2bfa..614d3649a8b 100644 --- a/src/sage/interfaces/singular.py +++ b/src/sage/interfaces/singular.py @@ -2420,6 +2420,7 @@ def get_docstring(name): ################################## + singular = Singular() def reduce_load_Singular(): diff --git a/src/sage/interfaces/tachyon.py b/src/sage/interfaces/tachyon.py index 6dd359d9e36..6053d2519e4 100644 --- a/src/sage/interfaces/tachyon.py +++ b/src/sage/interfaces/tachyon.py @@ -891,4 +891,5 @@ def help(self, use_pager=True): """ deprecation(34066, "type 'sage.interfaces.tachyon?' for help") + tachyon_rt = TachyonRT() From bc6126173779556c32e0eb03336f063f24e2432f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Chapoton?= Date: Mon, 28 Aug 2023 18:33:39 +0200 Subject: [PATCH 3/4] fixing many E305 in py files --- src/sage/algebras/free_algebra.py | 1 + src/sage/algebras/group_algebra.py | 1 + src/sage/categories/cartesian_product.py | 1 + src/sage/categories/category_with_axiom.py | 1 + src/sage/categories/examples/algebras_with_basis.py | 1 + .../examples/commutative_additive_semigroups.py | 1 + src/sage/categories/examples/cw_complexes.py | 1 + .../examples/filtered_algebras_with_basis.py | 1 + .../examples/filtered_modules_with_basis.py | 1 + .../finite_dimensional_algebras_with_basis.py | 1 + .../finite_dimensional_lie_algebras_with_basis.py | 1 + src/sage/categories/examples/finite_monoids.py | 1 + src/sage/categories/examples/finite_semigroups.py | 1 + .../graded_connected_hopf_algebras_with_basis.py | 1 + .../categories/examples/graded_modules_with_basis.py | 1 + src/sage/categories/examples/graphs.py | 1 + .../categories/examples/infinite_enumerated_sets.py | 1 + src/sage/categories/examples/lie_algebras.py | 1 + .../categories/examples/lie_algebras_with_basis.py | 1 + src/sage/categories/examples/manifolds.py | 1 + src/sage/categories/examples/monoids.py | 1 + src/sage/categories/realizations.py | 1 + src/sage/categories/sets_cat.py | 1 + src/sage/categories/with_realizations.py | 1 + src/sage/coding/databases.py | 1 + src/sage/coding/goppa_code.py | 1 + src/sage/coding/linear_rank_metric.py | 1 + src/sage/coding/parity_check_code.py | 1 + src/sage/coding/punctured_code.py | 1 + src/sage/coding/subfield_subcode.py | 1 + src/sage/crypto/sboxes.py | 1 + src/sage/databases/findstat.py | 1 + src/sage/doctest/external.py | 1 + src/sage/functions/gamma.py | 8 ++++++++ src/sage/functions/other.py | 12 ++++++++++++ src/sage/geometry/lattice_polytope.py | 2 ++ src/sage/groups/galois_group.py | 1 + src/sage/groups/group_exp.py | 1 + src/sage/logic/propcalc.py | 1 + src/sage/manifolds/manifold.py | 1 + src/sage/manifolds/utilities.py | 1 + src/sage/misc/call.py | 1 + src/sage/misc/explain_pickle.py | 3 +++ src/sage/misc/rest_index_of_methods.py | 1 + src/sage/misc/sh.py | 1 + src/sage/misc/test_nested_class.py | 1 + src/sage/misc/viewer.py | 1 + src/sage/modules/free_module.py | 3 +++ src/sage/modules/vector_symbolic_dense.py | 1 + src/sage/modules/vector_symbolic_sparse.py | 1 + src/sage/monoids/string_monoid.py | 5 +++++ src/sage/sandpiles/examples.py | 1 + src/sage/structure/sequence.py | 2 ++ src/sage/structure/set_factories_example.py | 1 + src/sage/structure/test_factory.py | 1 + src/sage/tests/functools_partial_src.py | 1 + 56 files changed, 84 insertions(+) diff --git a/src/sage/algebras/free_algebra.py b/src/sage/algebras/free_algebra.py index 52e7471d1bf..bcfb0e3a62e 100644 --- a/src/sage/algebras/free_algebra.py +++ b/src/sage/algebras/free_algebra.py @@ -331,6 +331,7 @@ def create_object(self, version, key): return FreeAlgebra_letterplace(key[1], degrees=key[0]) return FreeAlgebra_generic(key[0], len(key[1]), key[1]) + FreeAlgebra = FreeAlgebraFactory('FreeAlgebra') diff --git a/src/sage/algebras/group_algebra.py b/src/sage/algebras/group_algebra.py index c639106b239..e16b0c08a21 100644 --- a/src/sage/algebras/group_algebra.py +++ b/src/sage/algebras/group_algebra.py @@ -223,5 +223,6 @@ def _coerce_map_from_(self, S): return SetMorphism(S.Hom(self, category=self.category() | S.category()), lambda x: self.sum_of_terms( (hom_G(g), hom_K(c)) for g,c in x )) + from sage.misc.persist import register_unpickle_override register_unpickle_override('sage.algebras.group_algebras', 'GroupAlgebra', GroupAlgebra_class) diff --git a/src/sage/categories/cartesian_product.py b/src/sage/categories/cartesian_product.py index 39e9a316b9a..27a5147b629 100644 --- a/src/sage/categories/cartesian_product.py +++ b/src/sage/categories/cartesian_product.py @@ -271,6 +271,7 @@ def base_ring(self): """ return self.base_category().base_ring() + # Moved to avoid circular imports lazy_import('sage.categories.sets_cat', 'cartesian_product') """ diff --git a/src/sage/categories/category_with_axiom.py b/src/sage/categories/category_with_axiom.py index c14d468246e..5227792e725 100644 --- a/src/sage/categories/category_with_axiom.py +++ b/src/sage/categories/category_with_axiom.py @@ -2524,6 +2524,7 @@ def __init__(self, base_category): class CategoryWithAxiom_singleton(Category_singleton, CategoryWithAxiom):#, Category_singleton, FastHashable_class): pass + """ The following workaround is needed until any :class:`CategoryWithAxiom` of a :class:`Category_over_base_ring` becomes automatically a diff --git a/src/sage/categories/examples/algebras_with_basis.py b/src/sage/categories/examples/algebras_with_basis.py index 04511128301..e1d9350d18c 100644 --- a/src/sage/categories/examples/algebras_with_basis.py +++ b/src/sage/categories/examples/algebras_with_basis.py @@ -97,4 +97,5 @@ def algebra_generators(self): # for the specifying the order of the elements in the family #return Family(self._alphabet, lambda a: self.term(self.basis().keys()(a))) + Example = FreeAlgebra diff --git a/src/sage/categories/examples/commutative_additive_semigroups.py b/src/sage/categories/examples/commutative_additive_semigroups.py index fdda759869a..95fb6da0c79 100644 --- a/src/sage/categories/examples/commutative_additive_semigroups.py +++ b/src/sage/categories/examples/commutative_additive_semigroups.py @@ -194,4 +194,5 @@ def __hash__(self): """ return hash(tuple(self.value.items())) + Example = FreeCommutativeAdditiveSemigroup diff --git a/src/sage/categories/examples/cw_complexes.py b/src/sage/categories/examples/cw_complexes.py index 8422fc0a418..0fefb254c20 100644 --- a/src/sage/categories/examples/cw_complexes.py +++ b/src/sage/categories/examples/cw_complexes.py @@ -158,4 +158,5 @@ def dimension(self): """ return self._dim + Example = Surface diff --git a/src/sage/categories/examples/filtered_algebras_with_basis.py b/src/sage/categories/examples/filtered_algebras_with_basis.py index 5a83c54d1fd..57d106e4555 100644 --- a/src/sage/categories/examples/filtered_algebras_with_basis.py +++ b/src/sage/categories/examples/filtered_algebras_with_basis.py @@ -198,4 +198,5 @@ def product_on_basis(self, s, t): cur = cur * self.monomial(self._indices.gen(a)) return cur + Example = PBWBasisCrossProduct diff --git a/src/sage/categories/examples/filtered_modules_with_basis.py b/src/sage/categories/examples/filtered_modules_with_basis.py index 35edb3314dc..a76726099bc 100644 --- a/src/sage/categories/examples/filtered_modules_with_basis.py +++ b/src/sage/categories/examples/filtered_modules_with_basis.py @@ -149,4 +149,5 @@ def _repr_term(self, t): """ return 'P' + t._repr_() + Example = FilteredPartitionModule diff --git a/src/sage/categories/examples/finite_dimensional_algebras_with_basis.py b/src/sage/categories/examples/finite_dimensional_algebras_with_basis.py index 0406e23c6e8..de06ca7ab54 100644 --- a/src/sage/categories/examples/finite_dimensional_algebras_with_basis.py +++ b/src/sage/categories/examples/finite_dimensional_algebras_with_basis.py @@ -143,4 +143,5 @@ def _repr_term(self, p): """ return str(p) + Example = KroneckerQuiverPathAlgebra diff --git a/src/sage/categories/examples/finite_dimensional_lie_algebras_with_basis.py b/src/sage/categories/examples/finite_dimensional_lie_algebras_with_basis.py index 58e613a6d45..9f221f1432e 100644 --- a/src/sage/categories/examples/finite_dimensional_lie_algebras_with_basis.py +++ b/src/sage/categories/examples/finite_dimensional_lie_algebras_with_basis.py @@ -404,4 +404,5 @@ def monomial_coefficients(self, copy=True): """ return self.value.monomial_coefficients(copy) + Example = AbelianLieAlgebra diff --git a/src/sage/categories/examples/finite_monoids.py b/src/sage/categories/examples/finite_monoids.py index 4d3e8fa7029..9ec09313a82 100644 --- a/src/sage/categories/examples/finite_monoids.py +++ b/src/sage/categories/examples/finite_monoids.py @@ -146,4 +146,5 @@ def an_element(self): class Element (ElementWrapper): wrapped_class = Integer + Example = IntegerModMonoid diff --git a/src/sage/categories/examples/finite_semigroups.py b/src/sage/categories/examples/finite_semigroups.py index 60766b5d9d0..2e54d2130f4 100644 --- a/src/sage/categories/examples/finite_semigroups.py +++ b/src/sage/categories/examples/finite_semigroups.py @@ -187,4 +187,5 @@ class Element (ElementWrapper): wrapped_class = str __lt__ = ElementWrapper._lt_by_value + Example = LeftRegularBand diff --git a/src/sage/categories/examples/graded_connected_hopf_algebras_with_basis.py b/src/sage/categories/examples/graded_connected_hopf_algebras_with_basis.py index 07afa9c44ec..2290419adb3 100644 --- a/src/sage/categories/examples/graded_connected_hopf_algebras_with_basis.py +++ b/src/sage/categories/examples/graded_connected_hopf_algebras_with_basis.py @@ -162,4 +162,5 @@ def coproduct_on_basis(self, i): for j in range(i+1) ) + Example = GradedConnectedCombinatorialHopfAlgebraWithPrimitiveGenerator diff --git a/src/sage/categories/examples/graded_modules_with_basis.py b/src/sage/categories/examples/graded_modules_with_basis.py index 8095beb11c2..8ddfb7eed04 100644 --- a/src/sage/categories/examples/graded_modules_with_basis.py +++ b/src/sage/categories/examples/graded_modules_with_basis.py @@ -163,4 +163,5 @@ def _repr_term(self, t): """ return 'P' + t._repr_() + Example = GradedPartitionModule diff --git a/src/sage/categories/examples/graphs.py b/src/sage/categories/examples/graphs.py index 21c2d2a150a..063eeff1427 100644 --- a/src/sage/categories/examples/graphs.py +++ b/src/sage/categories/examples/graphs.py @@ -117,4 +117,5 @@ def dimension(self): return 2 return 1 + Example = Cycle diff --git a/src/sage/categories/examples/infinite_enumerated_sets.py b/src/sage/categories/examples/infinite_enumerated_sets.py index c4bb3d8e55d..df4151f21c2 100644 --- a/src/sage/categories/examples/infinite_enumerated_sets.py +++ b/src/sage/categories/examples/infinite_enumerated_sets.py @@ -185,4 +185,5 @@ def _element_constructor_(self, i): Element = Integer + Example = NonNegativeIntegers diff --git a/src/sage/categories/examples/lie_algebras.py b/src/sage/categories/examples/lie_algebras.py index 2382f1d0e7b..135c122efa2 100644 --- a/src/sage/categories/examples/lie_algebras.py +++ b/src/sage/categories/examples/lie_algebras.py @@ -332,4 +332,5 @@ def _bracket_(self, rhs): """ return self.__class__(self.parent(), self.value * rhs.value - rhs.value * self.value) + Example = LieAlgebraFromAssociative diff --git a/src/sage/categories/examples/lie_algebras_with_basis.py b/src/sage/categories/examples/lie_algebras_with_basis.py index a92f51b49db..ca711e1cdb4 100644 --- a/src/sage/categories/examples/lie_algebras_with_basis.py +++ b/src/sage/categories/examples/lie_algebras_with_basis.py @@ -100,6 +100,7 @@ def lift(self): I = UEA._indices return UEA.sum_of_terms((I.gen(t), c) for t, c in self) + Example = AbelianLieAlgebra ############## diff --git a/src/sage/categories/examples/manifolds.py b/src/sage/categories/examples/manifolds.py index e1d7c851202..6a748884eec 100644 --- a/src/sage/categories/examples/manifolds.py +++ b/src/sage/categories/examples/manifolds.py @@ -89,4 +89,5 @@ def an_element(self): Element = ElementWrapper + Example = Plane diff --git a/src/sage/categories/examples/monoids.py b/src/sage/categories/examples/monoids.py index 7336c680bdf..131e2b8a0e4 100644 --- a/src/sage/categories/examples/monoids.py +++ b/src/sage/categories/examples/monoids.py @@ -141,4 +141,5 @@ def monoid_generators(self): class Element (ElementWrapper): wrapped_class = str + Example = FreeMonoid diff --git a/src/sage/categories/realizations.py b/src/sage/categories/realizations.py index 595ee38dc9a..1c40e597676 100644 --- a/src/sage/categories/realizations.py +++ b/src/sage/categories/realizations.py @@ -102,6 +102,7 @@ def Realizations(self): else: return getattr(self.__class__, "Realizations")(self) + Category.Realizations = Realizations class Category_realization_of_parent(Category_over_base, BindableClass): diff --git a/src/sage/categories/sets_cat.py b/src/sage/categories/sets_cat.py index ea5695de6c2..3ebd6c44406 100644 --- a/src/sage/categories/sets_cat.py +++ b/src/sage/categories/sets_cat.py @@ -3154,5 +3154,6 @@ def _repr_(self): """ return "{} in the realization {}".format(self.realization_of(), self._realization_name()) + # Moved from sage.categories.cartesian_product to avoid circular import errors cartesian_product = CartesianProductFunctor() diff --git a/src/sage/categories/with_realizations.py b/src/sage/categories/with_realizations.py index 003277dcd2a..d0dc8d148bd 100644 --- a/src/sage/categories/with_realizations.py +++ b/src/sage/categories/with_realizations.py @@ -280,6 +280,7 @@ def WithRealizations(self): """ return WithRealizationsCategory.category_of(self) + Category.WithRealizations = WithRealizations class WithRealizationsCategory(RegressiveCovariantConstructionCategory): diff --git a/src/sage/coding/databases.py b/src/sage/coding/databases.py index e0c8b6e4068..7839cd8c693 100644 --- a/src/sage/coding/databases.py +++ b/src/sage/coding/databases.py @@ -309,6 +309,7 @@ def self_orthogonal_binary_codes(n, k, b=2, parent=None, BC=None, equal=False, if out_test(N): yield N + # Import the following function so that it is available as # sage.codes.databases.self_dual_binary_codes sage.codes.databases functions # somewhat like a catalog in this respect. diff --git a/src/sage/coding/goppa_code.py b/src/sage/coding/goppa_code.py index cc9fdb4791b..2a974cf1ef2 100644 --- a/src/sage/coding/goppa_code.py +++ b/src/sage/coding/goppa_code.py @@ -436,4 +436,5 @@ def generator_matrix(self): aux = codes.from_parity_check_matrix(pmat) return aux.generator_matrix() + GoppaCode._registered_encoders["GoppaEncoder"] = GoppaCodeEncoder diff --git a/src/sage/coding/linear_rank_metric.py b/src/sage/coding/linear_rank_metric.py index 2b687775102..bc1301bd6ad 100644 --- a/src/sage/coding/linear_rank_metric.py +++ b/src/sage/coding/linear_rank_metric.py @@ -895,4 +895,5 @@ def decoding_radius(self): ####################### registration ############################### + LinearRankMetricCode._registered_encoders["GeneratorMatrix"] = LinearCodeGeneratorMatrixEncoder diff --git a/src/sage/coding/parity_check_code.py b/src/sage/coding/parity_check_code.py index 03f23bcc17f..80783625055 100644 --- a/src/sage/coding/parity_check_code.py +++ b/src/sage/coding/parity_check_code.py @@ -351,5 +351,6 @@ def message_space(self): ####################### registration ############################### + ParityCheckCode._registered_encoders["ParityCheckCodeGeneratorMatrixEncoder"] = ParityCheckCodeGeneratorMatrixEncoder ParityCheckCode._registered_encoders["ParityCheckCodeStraightforwardEncoder"] = ParityCheckCodeStraightforwardEncoder diff --git a/src/sage/coding/punctured_code.py b/src/sage/coding/punctured_code.py index df57fb90e54..31e0b2b696f 100644 --- a/src/sage/coding/punctured_code.py +++ b/src/sage/coding/punctured_code.py @@ -711,6 +711,7 @@ def decoding_radius(self, number_erasures=None): ####################### registration ############################### + PuncturedCode._registered_encoders["PuncturedMatrix"] = PuncturedCodePuncturedMatrixEncoder PuncturedCode._registered_decoders["OriginalCode"] = PuncturedCodeOriginalCodeDecoder PuncturedCodeOriginalCodeDecoder._decoder_type = {"dynamic"} diff --git a/src/sage/coding/subfield_subcode.py b/src/sage/coding/subfield_subcode.py index 2783c66ec4a..8f59d8cacb6 100644 --- a/src/sage/coding/subfield_subcode.py +++ b/src/sage/coding/subfield_subcode.py @@ -421,5 +421,6 @@ def decoding_radius(self, **kwargs): ####################### registration ############################### + SubfieldSubcode._registered_decoders["OriginalCode"] = SubfieldSubcodeOriginalCodeDecoder SubfieldSubcodeOriginalCodeDecoder._decoder_type = {"dynamic"} diff --git a/src/sage/crypto/sboxes.py b/src/sage/crypto/sboxes.py index bfb3834d5aa..e502365b88f 100644 --- a/src/sage/crypto/sboxes.py +++ b/src/sage/crypto/sboxes.py @@ -400,6 +400,7 @@ def monomial_function(n, e): # Bijective S-Boxes mapping 9 bits to 9 # ===================================== + DryGASCON256 = SBox([ 0x10, 0x93, 0x11f, 0x9d, 0x1f, 0x9c, 0x113, 0x91, 0x2a, 0xa9, 0x127, 0xa5, 0x27, 0xa4, 0x129, 0xab, 0x2c, 0xaf, 0x123, 0xa1, 0x23, 0xa0, 0x12f, 0xad, 0x1a, 0x99, 0x117, 0x95, 0x17, 0x94, 0x119, 0x9b, diff --git a/src/sage/databases/findstat.py b/src/sage/databases/findstat.py index 8fc3ef8ec15..86ab944744a 100644 --- a/src/sage/databases/findstat.py +++ b/src/sage/databases/findstat.py @@ -4516,6 +4516,7 @@ def name(self, style="singular"): return self._data["NamePlural"] raise ValueError("argument 'style' (=%s) must be 'singular' or 'plural'" % style) + from collections import namedtuple _SupportedFindStatCollection = namedtuple("SupportedFindStatCollection", ["string_to_element", diff --git a/src/sage/doctest/external.py b/src/sage/doctest/external.py index 8744bd93e72..9768202e76f 100644 --- a/src/sage/doctest/external.py +++ b/src/sage/doctest/external.py @@ -372,6 +372,7 @@ def external_software(): """ return sorted(f.name for f in external_features()) + external_software = external_software() diff --git a/src/sage/functions/gamma.py b/src/sage/functions/gamma.py index 54a3a5aa3ba..c9ccbb5b6ef 100644 --- a/src/sage/functions/gamma.py +++ b/src/sage/functions/gamma.py @@ -183,6 +183,7 @@ def __init__(self): 'fricas':'Gamma', 'giac':'Gamma'}) + gamma1 = Function_gamma() @@ -486,6 +487,7 @@ def _evalf_(self, x, y, parent=None, algorithm='pari'): else: return C(v) + # synonym. gamma_inc = Function_gamma_inc() @@ -649,6 +651,7 @@ def _mathematica_init_evaled_(self, *args): x, z = args_mathematica return "Gamma[%s,0,%s]" % (x, z) + # synonym. gamma_inc_lower = Function_gamma_inc_lower() @@ -750,6 +753,7 @@ def _mathematica_gamma3(*args): assert len(args) == 3 return gamma_inc(args[0], args[1]) - gamma_inc(args[0], args[2]) + register_symbol(_mathematica_gamma3, dict(mathematica='Gamma'), 3) @@ -893,6 +897,7 @@ def _maxima_init_evaled_(self, *args): n, x = args_maxima return "psi[%s](%s)" % (n, x) + psi1 = Function_psi1() psi2 = Function_psi2() @@ -945,6 +950,7 @@ def psi(x, *args, **kwds): raise TypeError("Symbolic function psi takes at most 2 arguments (%s given)" % (len(args) + 1)) return psi2(x, args[0], **kwds) + # We have to add the wrapper function manually to the symbol_table when we have # two functions with different number of arguments and the same name symbol_table['functions']['psi'] = psi @@ -953,6 +959,7 @@ def psi(x, *args, **kwds): def _swap_psi(a, b): return psi(b, a) + register_symbol(_swap_psi, {'giac': 'Psi'}, 2) @@ -1075,4 +1082,5 @@ def _method_arguments(self, x, y): """ return [x, y] + beta = Function_beta() diff --git a/src/sage/functions/other.py b/src/sage/functions/other.py index 38276c57fbe..9dbe9787545 100644 --- a/src/sage/functions/other.py +++ b/src/sage/functions/other.py @@ -127,6 +127,7 @@ def __init__(self): giac='abs', fricas='abs')) + abs = abs_symbolic = Function_abs() @@ -466,6 +467,7 @@ def _eval_(self, x): return Integer(math.ceil(x)) return None + ceil = Function_ceil() @@ -634,6 +636,7 @@ def _eval_(self, x): return Integer(math.floor(x)) return None + floor = Function_floor() @@ -698,6 +701,7 @@ def _sympy_(self, arg): import sympy return sympy.O(*sympy.sympify(arg, evaluate=False)) + Order = Function_Order() @@ -771,6 +775,7 @@ def _eval_(self, x): return x - ret return None + frac = Function_frac() @@ -955,6 +960,7 @@ def _derivative_(self, base, exp, diff_param=None): """ return 1/exp * self(base, exp)**(1-exp) + real_nth_root = Function_real_nth_root() @@ -1107,6 +1113,7 @@ def _evalf_(self, x, parent=None, algorithm=None): return parent(x).arg() + arg=Function_arg() @@ -1206,6 +1213,7 @@ def __call__(self, x, **kwargs): else: return GinacFunction.__call__(self, x, **kwargs) + real = real_part = Function_real_part() @@ -1891,6 +1899,7 @@ def _sympy_(self, term, k, a, n): import sympy return sympy.Product(term, (k, a, n)) + symbolic_product = Function_prod() @@ -1996,6 +2005,7 @@ def _print_latex_(self, ex, var, to, direction=''): return r"\lim_{{{} \to {}{}}}\, {}".format(latex(var), latex(to), dir_str, latex(ex)) + symbolic_limit = Function_limit() @@ -2208,6 +2218,7 @@ def _evalf_(self, poly, index, parent=None, algorithm=None): sobj = CRootOf(Poly(poly._sympy_()), int(index)) return parent(sobj.n(1 + prec_to_dps(prec))._sage_()) + complex_root_of = Function_crootof() @@ -2282,4 +2293,5 @@ def _print_latex_(self, ex, s): """ return r"{} \in {}".format(latex(ex), latex(s)) + element_of = Function_elementof() diff --git a/src/sage/geometry/lattice_polytope.py b/src/sage/geometry/lattice_polytope.py index 701b8e43ee8..26c7d9a3819 100644 --- a/src/sage/geometry/lattice_polytope.py +++ b/src/sage/geometry/lattice_polytope.py @@ -398,6 +398,7 @@ def ReflexivePolytope(dim, n): else: raise NotImplementedError("only 2- and 3-dimensional reflexive polytopes are available!") + # Sequences of reflexive polytopes _rp = [None] * 4 @@ -5545,6 +5546,7 @@ def all_polars(polytopes): result.close() os.remove(result_name) + # Synonym for the above function all_facet_equations = all_polars diff --git a/src/sage/groups/galois_group.py b/src/sage/groups/galois_group.py index d4023125644..bc1b9a807f1 100644 --- a/src/sage/groups/galois_group.py +++ b/src/sage/groups/galois_group.py @@ -622,5 +622,6 @@ class GaloisSubgroup_ab(AbelianGroup_subgroup, _SubGaloisMixin): """ pass + GaloisGroup_perm.Subgroup = GaloisSubgroup_perm GaloisGroup_ab.Subgroup = GaloisSubgroup_ab diff --git a/src/sage/groups/group_exp.py b/src/sage/groups/group_exp.py index 4f3d27a8def..ffae5e73cb2 100644 --- a/src/sage/groups/group_exp.py +++ b/src/sage/groups/group_exp.py @@ -357,4 +357,5 @@ def group_generators(self): raise AttributeError("Additive group has no method 'gens'") return tuple([self(x) for x in additive_generators]) + GroupExp_Class.Element = GroupExpElement diff --git a/src/sage/logic/propcalc.py b/src/sage/logic/propcalc.py index 2ff45801bf0..2533cdac702 100644 --- a/src/sage/logic/propcalc.py +++ b/src/sage/logic/propcalc.py @@ -310,5 +310,6 @@ def consistent(*formulas): # if conjunction is a contradiction, the formulas are inconsistent return not conjunction.is_contradiction() + # define function ``valid_consequence`` for backward compatibility valid_consequence = deprecated_function_alias(28052, boolformula.is_consequence) diff --git a/src/sage/manifolds/manifold.py b/src/sage/manifolds/manifold.py index bb3f6cc42f5..35caa81aace 100644 --- a/src/sage/manifolds/manifold.py +++ b/src/sage/manifolds/manifold.py @@ -2723,6 +2723,7 @@ def set_simplify_function(self, simplifying_func, method=None): ############################################################################## ## Constructor function + _manifold_id = Integer(0) diff --git a/src/sage/manifolds/utilities.py b/src/sage/manifolds/utilities.py index 852dd0be1f1..c66d54e774e 100644 --- a/src/sage/manifolds/utilities.py +++ b/src/sage/manifolds/utilities.py @@ -1357,4 +1357,5 @@ def exterior_derivative(form): """ return form.exterior_derivative() + xder = exterior_derivative diff --git a/src/sage/misc/call.py b/src/sage/misc/call.py index c70b7972ef9..966ee34514b 100644 --- a/src/sage/misc/call.py +++ b/src/sage/misc/call.py @@ -181,5 +181,6 @@ def call_method(obj, name, *args, **kwds): """ return getattr(obj, name)(*args, **kwds) + from sage.misc.persist import register_unpickle_override register_unpickle_override("sage.misc.misc", "call_method", call_method) diff --git a/src/sage/misc/explain_pickle.py b/src/sage/misc/explain_pickle.py index c2e663432bb..30c3988850b 100644 --- a/src/sage/misc/explain_pickle.py +++ b/src/sage/misc/explain_pickle.py @@ -294,6 +294,7 @@ def explain_pickle_string(pickle, in_current_sage=False, else: return ans + valid_name_re = re.compile('^[a-zA-Z_][a-zA-Z0-9_]*$') def name_is_valid(name): r""" @@ -313,6 +314,7 @@ def name_is_valid(name): # Technically, we also need to reject keywords... return bool(valid_name_re.match(name)) + # The pickle interpreter can push and pop "marks" on the stack. # This string is used as the representation of a mark. the_mark = 'mark' @@ -3051,6 +3053,7 @@ def __repr__(self): """ return "TestGlobalFunnyName" + TestGlobalFunnyName.__name__ = "funny$name" #This crashed Sphinx. Instead, we manually execute this just before the test. #globals()['funny$name'] = TestGlobalFunnyName diff --git a/src/sage/misc/rest_index_of_methods.py b/src/sage/misc/rest_index_of_methods.py index 52b5d841893..82b988deda2 100644 --- a/src/sage/misc/rest_index_of_methods.py +++ b/src/sage/misc/rest_index_of_methods.py @@ -349,4 +349,5 @@ def hey(f): return f return hey + __doc__ = __doc__.format(INDEX_OF_FUNCTIONS=gen_rest_table_index([gen_rest_table_index])) diff --git a/src/sage/misc/sh.py b/src/sage/misc/sh.py index a16c987731f..968cb48cb74 100644 --- a/src/sage/misc/sh.py +++ b/src/sage/misc/sh.py @@ -32,5 +32,6 @@ def eval(self, code, globals=None, locals=None): # gets printed when doing %sh in the notebook. return '' + # Create the sh object, so that %sh mode works in the notebook. sh = Sh() diff --git a/src/sage/misc/test_nested_class.py b/src/sage/misc/test_nested_class.py index a8dcdb11125..40712bfc9fb 100644 --- a/src/sage/misc/test_nested_class.py +++ b/src/sage/misc/test_nested_class.py @@ -186,6 +186,7 @@ class C(): """ pass + C = ALB.C diff --git a/src/sage/misc/viewer.py b/src/sage/misc/viewer.py index de84f31ddf4..e5d30d72afe 100644 --- a/src/sage/misc/viewer.py +++ b/src/sage/misc/viewer.py @@ -301,6 +301,7 @@ def __call__(self, x=None): elif x.startswith('pdf'): return self.pdf_viewer() + viewer = Viewer() def browser(): diff --git a/src/sage/modules/free_module.py b/src/sage/modules/free_module.py index 313ffb25798..519bad41d24 100644 --- a/src/sage/modules/free_module.py +++ b/src/sage/modules/free_module.py @@ -291,6 +291,7 @@ def create_object(self, version, key): return FreeModule_ambient(base_ring, rank, sparse=sparse) + FreeModuleFactory_with_standard_basis = FreeModuleFactory("FreeModule") def FreeModule(base_ring, rank_or_basis_keys=None, sparse=False, inner_product_matrix=None, *, @@ -7665,6 +7666,7 @@ def has_user_basis(self): """ return False + FreeModule_generic_pid._submodule_class = FreeModule_submodule_pid @@ -8142,6 +8144,7 @@ def has_user_basis(self): """ return False + FreeModule_generic_field._submodule_class = FreeModule_submodule_field diff --git a/src/sage/modules/vector_symbolic_dense.py b/src/sage/modules/vector_symbolic_dense.py index e4d9efff0b3..ce134c0462e 100644 --- a/src/sage/modules/vector_symbolic_dense.py +++ b/src/sage/modules/vector_symbolic_dense.py @@ -108,6 +108,7 @@ def apply(self, *args, **kwds): class Vector_symbolic_dense(free_module_element.FreeModuleElement_generic_dense): pass + # Add elementwise methods. for method in ['simplify', 'simplify_factorial', 'simplify_log', 'simplify_rational', diff --git a/src/sage/modules/vector_symbolic_sparse.py b/src/sage/modules/vector_symbolic_sparse.py index 30ec55214c6..73cb41ae611 100644 --- a/src/sage/modules/vector_symbolic_sparse.py +++ b/src/sage/modules/vector_symbolic_sparse.py @@ -110,6 +110,7 @@ def apply(self, *args, **kwds): class Vector_symbolic_sparse(free_module_element.FreeModuleElement_generic_sparse): pass + # Add elementwise methods. for method in ['simplify', 'simplify_factorial', 'simplify_log', 'simplify_rational', diff --git a/src/sage/monoids/string_monoid.py b/src/sage/monoids/string_monoid.py index 5f4e3819b5e..91cb82e4229 100644 --- a/src/sage/monoids/string_monoid.py +++ b/src/sage/monoids/string_monoid.py @@ -247,6 +247,7 @@ def encoding(self, S, padic=False): # """ # return 2 + BinaryStrings = BinaryStringMonoid @@ -309,6 +310,7 @@ def __call__(self, x, check=True): else: raise TypeError("Argument x (= %s) is of the wrong type." % x) + OctalStrings = OctalStringMonoid @@ -421,6 +423,7 @@ def encoding(self, S, padic=False): hex_string.extend(hex_chars) return self(hex_string) + HexadecimalStrings = HexadecimalStringMonoid @@ -487,6 +490,7 @@ def __call__(self, x, check=True): else: raise TypeError("Argument x (= %s) is of the wrong type." % x) + Radix64Strings = Radix64StringMonoid @@ -798,4 +802,5 @@ def encoding(self, S): """ return self(strip_encoding(S)) + AlphabeticStrings = AlphabeticStringMonoid diff --git a/src/sage/sandpiles/examples.py b/src/sage/sandpiles/examples.py index e38ce664483..a902a156318 100644 --- a/src/sage/sandpiles/examples.py +++ b/src/sage/sandpiles/examples.py @@ -246,4 +246,5 @@ def Wheel(self, n): """ return Sandpile(graphs.WheelGraph(n),0) + sandpiles = SandpileExamples() diff --git a/src/sage/structure/sequence.py b/src/sage/structure/sequence.py index 7a8c77ad1cf..00ee377ac82 100644 --- a/src/sage/structure/sequence.py +++ b/src/sage/structure/sequence.py @@ -889,6 +889,8 @@ def __getattr__(self, name): return self.__hash else: raise AttributeError("'Sequence_generic' object has no attribute '%s'"%name) + + seq = Sequence from sage.misc.persist import register_unpickle_override diff --git a/src/sage/structure/set_factories_example.py b/src/sage/structure/set_factories_example.py index 5414edea03d..df1d7d7f49c 100644 --- a/src/sage/structure/set_factories_example.py +++ b/src/sage/structure/set_factories_example.py @@ -169,6 +169,7 @@ def _repr_(self): """ return "Factory for XY pairs" + XYPairs = XYPairsFactory() XYPairs.__doc__ = XYPairsFactory.__call__.__doc__ diff --git a/src/sage/structure/test_factory.py b/src/sage/structure/test_factory.py index b45996c5a80..145311b9dd3 100644 --- a/src/sage/structure/test_factory.py +++ b/src/sage/structure/test_factory.py @@ -50,4 +50,5 @@ def create_object(self, version, key, **extra_args): print("Making object", key) return A() + test_factory = UniqueFactoryTester('sage.structure.test_factory.test_factory') diff --git a/src/sage/tests/functools_partial_src.py b/src/sage/tests/functools_partial_src.py index 1fb24e15b34..d352d160230 100644 --- a/src/sage/tests/functools_partial_src.py +++ b/src/sage/tests/functools_partial_src.py @@ -21,4 +21,5 @@ def base(x): x = x * 7 return x + test_func = partial(base, 6) From 025b4abb603b3f32be83ac46633d3eb66e112eca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Chapoton?= Date: Wed, 30 Aug 2023 08:58:19 +0200 Subject: [PATCH 4/4] fix suggestions --- src/sage/coding/linear_rank_metric.py | 4 ++-- src/sage/coding/parity_check_code.py | 2 +- src/sage/coding/punctured_code.py | 2 +- src/sage/coding/subfield_subcode.py | 2 +- src/sage/crypto/sboxes.py | 2 +- src/sage/functions/gamma.py | 4 ++-- src/sage/interfaces/gap.py | 9 +++------ src/sage/interfaces/magma.py | 2 -- src/sage/interfaces/singular.py | 11 +++++------ src/sage/manifolds/manifold.py | 4 ++-- src/sage/misc/viewer.py | 6 ++++++ 11 files changed, 24 insertions(+), 24 deletions(-) diff --git a/src/sage/coding/linear_rank_metric.py b/src/sage/coding/linear_rank_metric.py index bc1301bd6ad..babb22ff1ce 100644 --- a/src/sage/coding/linear_rank_metric.py +++ b/src/sage/coding/linear_rank_metric.py @@ -891,9 +891,9 @@ def decoding_radius(self): sage: D.decoding_radius() 1 """ - return (self.code().minimum_distance()-1) // 2 + return (self.code().minimum_distance() - 1) // 2 -####################### registration ############################### +####################### registration ############################### LinearRankMetricCode._registered_encoders["GeneratorMatrix"] = LinearCodeGeneratorMatrixEncoder diff --git a/src/sage/coding/parity_check_code.py b/src/sage/coding/parity_check_code.py index 80783625055..d131ecaf80a 100644 --- a/src/sage/coding/parity_check_code.py +++ b/src/sage/coding/parity_check_code.py @@ -349,8 +349,8 @@ def message_space(self): """ return VectorSpace(self.code().base_field(), self.code().dimension()) -####################### registration ############################### +####################### registration ############################### ParityCheckCode._registered_encoders["ParityCheckCodeGeneratorMatrixEncoder"] = ParityCheckCodeGeneratorMatrixEncoder ParityCheckCode._registered_encoders["ParityCheckCodeStraightforwardEncoder"] = ParityCheckCodeStraightforwardEncoder diff --git a/src/sage/coding/punctured_code.py b/src/sage/coding/punctured_code.py index 31e0b2b696f..7aafa4f3f27 100644 --- a/src/sage/coding/punctured_code.py +++ b/src/sage/coding/punctured_code.py @@ -709,8 +709,8 @@ def decoding_radius(self, number_erasures=None): elif "error-erasure" in D.decoder_type() and number_erasures is None: raise ValueError("You must provide the number of erasures") -####################### registration ############################### +####################### registration ############################### PuncturedCode._registered_encoders["PuncturedMatrix"] = PuncturedCodePuncturedMatrixEncoder PuncturedCode._registered_decoders["OriginalCode"] = PuncturedCodeOriginalCodeDecoder diff --git a/src/sage/coding/subfield_subcode.py b/src/sage/coding/subfield_subcode.py index 8f59d8cacb6..9ec9650c43a 100644 --- a/src/sage/coding/subfield_subcode.py +++ b/src/sage/coding/subfield_subcode.py @@ -419,8 +419,8 @@ def decoding_radius(self, **kwargs): """ return self.original_decoder().decoding_radius(**kwargs) -####################### registration ############################### +####################### registration ############################### SubfieldSubcode._registered_decoders["OriginalCode"] = SubfieldSubcodeOriginalCodeDecoder SubfieldSubcodeOriginalCodeDecoder._decoder_type = {"dynamic"} diff --git a/src/sage/crypto/sboxes.py b/src/sage/crypto/sboxes.py index e502365b88f..27ca13fbcc3 100644 --- a/src/sage/crypto/sboxes.py +++ b/src/sage/crypto/sboxes.py @@ -397,10 +397,10 @@ def monomial_function(n, e): X = R.gen() return SBox(X**e) + # Bijective S-Boxes mapping 9 bits to 9 # ===================================== - DryGASCON256 = SBox([ 0x10, 0x93, 0x11f, 0x9d, 0x1f, 0x9c, 0x113, 0x91, 0x2a, 0xa9, 0x127, 0xa5, 0x27, 0xa4, 0x129, 0xab, 0x2c, 0xaf, 0x123, 0xa1, 0x23, 0xa0, 0x12f, 0xad, 0x1a, 0x99, 0x117, 0x95, 0x17, 0x94, 0x119, 0x9b, diff --git a/src/sage/functions/gamma.py b/src/sage/functions/gamma.py index c9ccbb5b6ef..8ecf834a8a8 100644 --- a/src/sage/functions/gamma.py +++ b/src/sage/functions/gamma.py @@ -488,7 +488,7 @@ def _evalf_(self, x, y, parent=None, algorithm='pari'): return C(v) -# synonym. +# shorter alias gamma_inc = Function_gamma_inc() @@ -652,7 +652,7 @@ def _mathematica_init_evaled_(self, *args): return "Gamma[%s,0,%s]" % (x, z) -# synonym. +# shorter alias gamma_inc_lower = Function_gamma_inc_lower() diff --git a/src/sage/interfaces/gap.py b/src/sage/interfaces/gap.py index 951a36807b6..b7f9b5edd51 100644 --- a/src/sage/interfaces/gap.py +++ b/src/sage/interfaces/gap.py @@ -222,10 +222,11 @@ # suppress unaligned access to 0x..., ip=0x... warnings gap_cmd = 'prctl --unaligned=silent ' + gap_cmd + def gap_command(use_workspace_cache=True, local=True): if use_workspace_cache: if local: - return "%s -L %s"%(gap_cmd, WORKSPACE), False + return "%s -L %s" % (gap_cmd, WORKSPACE), False else: # TO DO: Use remote workspace return gap_cmd, False @@ -1037,7 +1038,6 @@ def _matrix_(self, R): entries = [[R(self[r,c]) for c in range(1,m+1)] for r in range(1,n+1)] return M(entries) -############ class Gap(Gap_generic): r""" @@ -1465,8 +1465,6 @@ def _tab_completion(self): return [n for n in names if n[0] in string.ascii_letters] -############ - def gap_reset_workspace(max_workspace_size=None, verbose=False): r""" Call this to completely reset the GAP workspace, which is used by @@ -1765,11 +1763,10 @@ def intmod_gap_to_sage(x): return Mod(Integer(m.group(1)), Integer(m.group(2))) raise ValueError("Unable to convert Gap element '%s'" % s) -############# - gap = Gap() + def reduce_load_GAP(): """ Returns the GAP interface object defined in sage.interfaces.gap. diff --git a/src/sage/interfaces/magma.py b/src/sage/interfaces/magma.py index 09f809ef4d0..e47d47f8fd2 100644 --- a/src/sage/interfaces/magma.py +++ b/src/sage/interfaces/magma.py @@ -2751,8 +2751,6 @@ def ideal(self, gens): """ return self.parent().bar_call(self, 'ideal', gens, nvals=1) -########################################################################### - magma = Magma() diff --git a/src/sage/interfaces/singular.py b/src/sage/interfaces/singular.py index 614d3649a8b..7ecc3db56f1 100644 --- a/src/sage/interfaces/singular.py +++ b/src/sage/interfaces/singular.py @@ -847,9 +847,9 @@ def cputime(self, t=None): else: return float(self.eval('timer'))/1000.0 - ################################################################### + ########################################################### # Singular libraries - ################################################################### + ########################################################### def lib(self, lib, reload=False): """ Load the Singular library named lib. @@ -873,9 +873,9 @@ def lib(self, lib, reload=False): LIB = lib load = lib - ################################################################### + ########################################################## # constructors - ################################################################### + ########################################################## def ideal(self, *gens): """ Return the ideal generated by gens. @@ -2418,11 +2418,10 @@ def get_docstring(name): except KeyError: return "" -################################## - singular = Singular() + def reduce_load_Singular(): """ EXAMPLES:: diff --git a/src/sage/manifolds/manifold.py b/src/sage/manifolds/manifold.py index 35caa81aace..b19177da9e5 100644 --- a/src/sage/manifolds/manifold.py +++ b/src/sage/manifolds/manifold.py @@ -2720,9 +2720,9 @@ def set_simplify_function(self, simplifying_func, method=None): chart.calculus_method().set_simplify_function(simplifying_func, method=method) -############################################################################## -## Constructor function +########################################################### +# Constructor function _manifold_id = Integer(0) diff --git a/src/sage/misc/viewer.py b/src/sage/misc/viewer.py index e5d30d72afe..439dedc5e75 100644 --- a/src/sage/misc/viewer.py +++ b/src/sage/misc/viewer.py @@ -30,6 +30,7 @@ VIEWERS = ['browser', 'dvi_viewer', 'pdf_viewer', 'png_viewer'] + def default_viewer(viewer=None): """ Set up default programs for opening web pages, PDFs, PNGs, and DVI files. @@ -138,6 +139,7 @@ def default_viewer(viewer=None): # _viewer_prefs: a dictionary holding global preferences for viewers. _viewer_prefs = {} + class Viewer(SageObject): """ Set defaults for various viewing applications: a web browser, a @@ -304,6 +306,7 @@ def __call__(self, x=None): viewer = Viewer() + def browser(): """ Return the program used to open a web page. By default, the @@ -320,6 +323,7 @@ def browser(): """ return viewer.browser() + def dvi_viewer(): """ Return the program used to display a dvi file. By default, the @@ -337,6 +341,7 @@ def dvi_viewer(): viewer() return viewer.dvi_viewer() + def pdf_viewer(): """ Return the program used to display a pdf file. By default, the @@ -357,6 +362,7 @@ def pdf_viewer(): viewer() return viewer.pdf_viewer() + def png_viewer(): """ Return the program used to display a png file. By default, the