Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing many e305 #36147

Merged
merged 4 commits into from
Sep 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/sage/algebras/free_algebra.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')


Expand Down
1 change: 1 addition & 0 deletions src/sage/algebras/group_algebra.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
1 change: 1 addition & 0 deletions src/sage/categories/cartesian_product.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')
"""
Expand Down
1 change: 1 addition & 0 deletions src/sage/categories/category_with_axiom.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions src/sage/categories/examples/algebras_with_basis.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -194,4 +194,5 @@ def __hash__(self):
"""
return hash(tuple(self.value.items()))


Example = FreeCommutativeAdditiveSemigroup
1 change: 1 addition & 0 deletions src/sage/categories/examples/cw_complexes.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,4 +158,5 @@ def dimension(self):
"""
return self._dim


Example = Surface
Original file line number Diff line number Diff line change
Expand Up @@ -198,4 +198,5 @@ def product_on_basis(self, s, t):
cur = cur * self.monomial(self._indices.gen(a))
return cur


Example = PBWBasisCrossProduct
Original file line number Diff line number Diff line change
Expand Up @@ -149,4 +149,5 @@ def _repr_term(self, t):
"""
return 'P' + t._repr_()


Example = FilteredPartitionModule
Original file line number Diff line number Diff line change
Expand Up @@ -143,4 +143,5 @@ def _repr_term(self, p):
"""
return str(p)


Example = KroneckerQuiverPathAlgebra
Original file line number Diff line number Diff line change
Expand Up @@ -404,4 +404,5 @@ def monomial_coefficients(self, copy=True):
"""
return self.value.monomial_coefficients(copy)


Example = AbelianLieAlgebra
1 change: 1 addition & 0 deletions src/sage/categories/examples/finite_monoids.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,4 +146,5 @@ def an_element(self):
class Element (ElementWrapper):
wrapped_class = Integer


Example = IntegerModMonoid
1 change: 1 addition & 0 deletions src/sage/categories/examples/finite_semigroups.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,4 +187,5 @@ class Element (ElementWrapper):
wrapped_class = str
__lt__ = ElementWrapper._lt_by_value


Example = LeftRegularBand
Original file line number Diff line number Diff line change
Expand Up @@ -162,4 +162,5 @@ def coproduct_on_basis(self, i):
for j in range(i+1)
)


Example = GradedConnectedCombinatorialHopfAlgebraWithPrimitiveGenerator
1 change: 1 addition & 0 deletions src/sage/categories/examples/graded_modules_with_basis.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,4 +163,5 @@ def _repr_term(self, t):
"""
return 'P' + t._repr_()


Example = GradedPartitionModule
1 change: 1 addition & 0 deletions src/sage/categories/examples/graphs.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,4 +117,5 @@ def dimension(self):
return 2
return 1


Example = Cycle
1 change: 1 addition & 0 deletions src/sage/categories/examples/infinite_enumerated_sets.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,4 +185,5 @@ def _element_constructor_(self, i):

Element = Integer


Example = NonNegativeIntegers
1 change: 1 addition & 0 deletions src/sage/categories/examples/lie_algebras.py
Original file line number Diff line number Diff line change
Expand Up @@ -332,4 +332,5 @@ def _bracket_(self, rhs):
"""
return self.__class__(self.parent(), self.value * rhs.value - rhs.value * self.value)


Example = LieAlgebraFromAssociative
1 change: 1 addition & 0 deletions src/sage/categories/examples/lie_algebras_with_basis.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

##############
Expand Down
1 change: 1 addition & 0 deletions src/sage/categories/examples/manifolds.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,4 +89,5 @@ def an_element(self):

Element = ElementWrapper


Example = Plane
1 change: 1 addition & 0 deletions src/sage/categories/examples/monoids.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,4 +141,5 @@ def monoid_generators(self):
class Element (ElementWrapper):
wrapped_class = str


Example = FreeMonoid
1 change: 1 addition & 0 deletions src/sage/categories/realizations.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
1 change: 1 addition & 0 deletions src/sage/categories/sets_cat.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
1 change: 1 addition & 0 deletions src/sage/categories/with_realizations.py
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,7 @@ def WithRealizations(self):
"""
return WithRealizationsCategory.category_of(self)


Category.WithRealizations = WithRealizations

class WithRealizationsCategory(RegressiveCovariantConstructionCategory):
Expand Down
1 change: 1 addition & 0 deletions src/sage/coding/databases.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
1 change: 1 addition & 0 deletions src/sage/coding/goppa_code.py
Original file line number Diff line number Diff line change
Expand Up @@ -436,4 +436,5 @@ def generator_matrix(self):
aux = codes.from_parity_check_matrix(pmat)
return aux.generator_matrix()


GoppaCode._registered_encoders["GoppaEncoder"] = GoppaCodeEncoder
3 changes: 2 additions & 1 deletion src/sage/coding/linear_rank_metric.py
Original file line number Diff line number Diff line change
Expand Up @@ -891,7 +891,8 @@ def decoding_radius(self):
sage: D.decoding_radius()
1
"""
return (self.code().minimum_distance()-1) // 2
return (self.code().minimum_distance() - 1) // 2


####################### registration ###############################

Expand Down
1 change: 1 addition & 0 deletions src/sage/coding/parity_check_code.py
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,7 @@ def message_space(self):
"""
return VectorSpace(self.code().base_field(), self.code().dimension())


####################### registration ###############################

ParityCheckCode._registered_encoders["ParityCheckCodeGeneratorMatrixEncoder"] = ParityCheckCodeGeneratorMatrixEncoder
fchapoton marked this conversation as resolved.
Show resolved Hide resolved
Expand Down
1 change: 1 addition & 0 deletions src/sage/coding/punctured_code.py
Original file line number Diff line number Diff line change
Expand Up @@ -709,6 +709,7 @@ 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 ###############################

PuncturedCode._registered_encoders["PuncturedMatrix"] = PuncturedCodePuncturedMatrixEncoder
fchapoton marked this conversation as resolved.
Show resolved Hide resolved
Expand Down
1 change: 1 addition & 0 deletions src/sage/coding/subfield_subcode.py
Original file line number Diff line number Diff line change
Expand Up @@ -419,6 +419,7 @@ def decoding_radius(self, **kwargs):
"""
return self.original_decoder().decoding_radius(**kwargs)


####################### registration ###############################

SubfieldSubcode._registered_decoders["OriginalCode"] = SubfieldSubcodeOriginalCodeDecoder
fchapoton marked this conversation as resolved.
Show resolved Hide resolved
Expand Down
1 change: 1 addition & 0 deletions src/sage/crypto/sboxes.py
Original file line number Diff line number Diff line change
Expand Up @@ -397,6 +397,7 @@ def monomial_function(n, e):
X = R.gen()
return SBox(X**e)


# Bijective S-Boxes mapping 9 bits to 9
# =====================================

Expand Down
1 change: 1 addition & 0 deletions src/sage/databases/findstat.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
1 change: 1 addition & 0 deletions src/sage/doctest/external.py
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,7 @@ def external_software():
"""
return sorted(f.name for f in external_features())


external_software = external_software()


Expand Down
12 changes: 10 additions & 2 deletions src/sage/functions/gamma.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ def __init__(self):
'fricas':'Gamma',
'giac':'Gamma'})


gamma1 = Function_gamma()


Expand Down Expand Up @@ -486,7 +487,8 @@ def _evalf_(self, x, y, parent=None, algorithm='pari'):
else:
return C(v)

# synonym.

# shorter alias
gamma_inc = Function_gamma_inc()
fchapoton marked this conversation as resolved.
Show resolved Hide resolved


Expand Down Expand Up @@ -649,7 +651,8 @@ def _mathematica_init_evaled_(self, *args):
x, z = args_mathematica
return "Gamma[%s,0,%s]" % (x, z)

# synonym.

# shorter alias
gamma_inc_lower = Function_gamma_inc_lower()


Expand Down Expand Up @@ -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)


Expand Down Expand Up @@ -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()

Expand Down Expand Up @@ -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
Expand All @@ -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)


Expand Down Expand Up @@ -1075,4 +1082,5 @@ def _method_arguments(self, x, y):
"""
return [x, y]


beta = Function_beta()
12 changes: 12 additions & 0 deletions src/sage/functions/other.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ def __init__(self):
giac='abs',
fricas='abs'))


abs = abs_symbolic = Function_abs()


Expand Down Expand Up @@ -466,6 +467,7 @@ def _eval_(self, x):
return Integer(math.ceil(x))
return None


ceil = Function_ceil()


Expand Down Expand Up @@ -634,6 +636,7 @@ def _eval_(self, x):
return Integer(math.floor(x))
return None


floor = Function_floor()


Expand Down Expand Up @@ -698,6 +701,7 @@ def _sympy_(self, arg):
import sympy
return sympy.O(*sympy.sympify(arg, evaluate=False))


Order = Function_Order()


Expand Down Expand Up @@ -771,6 +775,7 @@ def _eval_(self, x):
return x - ret
return None


frac = Function_frac()


Expand Down Expand Up @@ -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()


Expand Down Expand Up @@ -1107,6 +1113,7 @@ def _evalf_(self, x, parent=None, algorithm=None):

return parent(x).arg()


arg=Function_arg()


Expand Down Expand Up @@ -1206,6 +1213,7 @@ def __call__(self, x, **kwargs):
else:
return GinacFunction.__call__(self, x, **kwargs)


real = real_part = Function_real_part()


Expand Down Expand Up @@ -1891,6 +1899,7 @@ def _sympy_(self, term, k, a, n):
import sympy
return sympy.Product(term, (k, a, n))


symbolic_product = Function_prod()


Expand Down Expand Up @@ -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()


Expand Down Expand Up @@ -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()


Expand Down Expand Up @@ -2282,4 +2293,5 @@ def _print_latex_(self, ex, s):
"""
return r"{} \in {}".format(latex(ex), latex(s))


element_of = Function_elementof()
Loading
Loading