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

fix all pycodestyle E303 warnings in rings/ #35452

Merged
merged 1 commit into from
Apr 13, 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
9 changes: 0 additions & 9 deletions src/sage/rings/asymptotic/asymptotic_expansion_generators.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,6 @@ def Stirling(var, precision=None, skip_constant_factor=False):

return result


@staticmethod
def log_Stirling(var, precision=None, skip_constant_summand=False):
r"""
Expand Down Expand Up @@ -321,7 +320,6 @@ def log_Stirling(var, precision=None, skip_constant_summand=False):

return result


@staticmethod
def _log_StirlingNegativePowers_(var, precision):
r"""
Expand Down Expand Up @@ -371,7 +369,6 @@ def _log_StirlingNegativePowers_(var, precision):
A.zero())
return result + (1 / n**(2*precision + 1)).O()


@staticmethod
def HarmonicNumber(var, precision=None, skip_constant_summand=False):
r"""
Expand Down Expand Up @@ -477,7 +474,6 @@ def HarmonicNumber(var, precision=None, skip_constant_summand=False):

return result


@staticmethod
def Binomial_kn_over_n(var, k, precision=None, skip_constant_factor=False):
r"""
Expand Down Expand Up @@ -603,7 +599,6 @@ def Binomial_kn_over_n(var, k, precision=None, skip_constant_factor=False):

return result


@staticmethod
def SingularityAnalysis(var, zeta=1, alpha=0, beta=0, delta=0,
precision=None, normalized=True):
Expand Down Expand Up @@ -961,7 +956,6 @@ def inverse_gamma_derivative(shift, r):
if precision is None:
precision = series_precision()


if not normalized and not (beta in ZZ and delta in ZZ):
raise ValueError("beta and delta must be integers")
if delta != 0:
Expand Down Expand Up @@ -1040,7 +1034,6 @@ def inverse_gamma_derivative(shift, r):

return result


@staticmethod
@experimental(20050)
def ImplicitExpansion(var, phi, tau=None, precision=None):
Expand Down Expand Up @@ -1208,7 +1201,6 @@ def ansatz(prec=precision):

return A(tau) + ansatz(prec=precision-1).map_coefficients(lambda term: term.subs(solution_dict).simplify_rational())


@staticmethod
@experimental(20050)
def ImplicitExpansionPeriodicPart(var, phi, period, tau=None, precision=None):
Expand Down Expand Up @@ -1298,7 +1290,6 @@ def ImplicitExpansionPeriodicPart(var, phi, period, tau=None, precision=None):
Z = aperiodic_expansion.parent().gen()
return 1/rho * (aperiodic_expansion/(1 - 1/Z))**(1/period)


@staticmethod
def InverseFunctionAnalysis(var, phi, tau=None, period=1, precision=None):
r"""
Expand Down
9 changes: 0 additions & 9 deletions src/sage/rings/asymptotic/asymptotic_ring.py
Original file line number Diff line number Diff line change
Expand Up @@ -1209,7 +1209,6 @@ def _mul_term_(self, term):
return self.parent()(self.summands.mapped(lambda element: term * element),
simplify=simplify, convert=False)


def _mul_(self, other):
r"""
Multiply this asymptotic expansion by another asymptotic expansion ``other``.
Expand Down Expand Up @@ -1309,7 +1308,6 @@ def _div_(self, other):
"""
return self * ~other


def __invert__(self, precision=None):
r"""
Return the multiplicative inverse of this element.
Expand Down Expand Up @@ -1485,7 +1483,6 @@ def exact_part(self):

return self.parent(exact_terms)


def error_part(self):
r"""
Return the expansion consisting of all error terms of this
Expand All @@ -1511,7 +1508,6 @@ def error_part(self):
if not term.is_exact()),
parent.zero())


def __pow__(self, exponent, precision=None):
r"""
Calculate the power of this asymptotic expansion to the given ``exponent``.
Expand Down Expand Up @@ -1717,10 +1713,8 @@ def __pow__(self, exponent, precision=None):
raise combine_exceptions(
ValueError('Cannot take %s to the exponent %s.' % (self, exponent)), e)


pow = __pow__


def __pow_number__(self, exponent, precision=None, check_convergence=False):
r"""
Return the power of this asymptotic expansion to some
Expand Down Expand Up @@ -1873,7 +1867,6 @@ def binomials(a):

return result * pmax


def sqrt(self, precision=None):
r"""
Return the square root of this asymptotic expansion.
Expand Down Expand Up @@ -2244,7 +2237,6 @@ def rpow(self, base, precision=None, locals=None):
if not expr_o:
return large_result


if base == 'e':
geom = expr_o
else:
Expand Down Expand Up @@ -3911,7 +3903,6 @@ def _create_empty_summands_():
can_merge=can_absorb,
merge=absorption)


def _create_element_in_extension_(self, term, old_term_parent=None):
r"""
Create an element in an extension of this asymptotic ring which
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3324,7 +3324,6 @@ def _an_element_(self):
from sage.rings.semirings.non_negative_integer_semiring import NN
return self(NN.an_element(), [(self.base().an_element(), NN(3))])


Element = FractionWithFactoredDenominator


Expand Down
2 changes: 0 additions & 2 deletions src/sage/rings/asymptotic/growth_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,6 @@ def __init__(self, var, repr=None, latex_name=None, ignore=None):
raise ValueError('Variable names %s are not pairwise distinct.' %
(var_bases,))


self.var_bases = var_bases
self.var_repr = var_repr

Expand Down Expand Up @@ -1679,7 +1678,6 @@ class GenericGrowthGroup(UniqueRepresentation, Parent, WithLocals):
# enable the category framework for elements
Element = GenericGrowthElement


# set everything up to determine category
from sage.categories.sets_cat import Sets
from sage.categories.posets import Posets
Expand Down
27 changes: 0 additions & 27 deletions src/sage/rings/asymptotic/growth_group_cartesian.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,6 @@ def create_key_and_extra_args(self, growth_groups, category, **kwds):

return (tuple(growth_groups), category), kwds


def create_object(self, version, args, **kwds):
r"""
Create an object from the given arguments.
Expand Down Expand Up @@ -287,7 +286,6 @@ class GenericProduct(CartesianProductPoset, GenericGrowthGroup):

__classcall__ = CartesianProductPoset.__classcall__


def __init__(self, sets, category, **kwds):
r"""
See :class:`GenericProduct` for details.
Expand Down Expand Up @@ -319,10 +317,8 @@ def __init__(self, sets, category, **kwds):

GenericGrowthGroup.__init__(self, sets[0], Vars, self.category(), **kwds)


__hash__ = CartesianProductPoset.__hash__


def some_elements(self):
r"""
Return some elements of this Cartesian product of growth groups.
Expand Down Expand Up @@ -399,7 +395,6 @@ def _create_element_in_extension_(self, element):
category=self.category())
return parent(element)


def _element_constructor_(self, data):
r"""
Converts the given object to an element of this Cartesian
Expand Down Expand Up @@ -520,10 +515,8 @@ def convert_factors(data, raw_data):

return convert_factors((data,), data)


_repr_ = GenericGrowthGroup._repr_


def _repr_short_(self):
r"""
A short (shorter than :meth:`._repr_`) representation string
Expand All @@ -547,7 +540,6 @@ def _repr_short_(self):
"""
return ' * '.join(S._repr_short_() for S in self.cartesian_factors())


def _convert_factors_(self, factors):
r"""
Helper method. Try to convert some ``factors`` to an
Expand Down Expand Up @@ -617,7 +609,6 @@ def get_factors(data):
return prod(self.cartesian_injection(*fs)
for f in factors for fs in get_factors(f))


def cartesian_injection(self, factor, element):
r"""
Inject the given element into this Cartesian product at the given factor.
Expand All @@ -642,7 +633,6 @@ def cartesian_injection(self, factor, element):
return self(tuple((f.one() if f != factor else element)
for f in self.cartesian_factors()))


def _coerce_map_from_(self, S):
r"""
Return whether ``S`` coerces into this growth group.
Expand Down Expand Up @@ -677,7 +667,6 @@ def _coerce_map_from_(self, S):
for f in factors):
return True


def _pushout_(self, other):
r"""
Construct the pushout of this and the other growth group. This is called by
Expand Down Expand Up @@ -864,7 +853,6 @@ def next_custom(self):
from sage.categories.cartesian_product import cartesian_product
return pushout(cartesian_product(newS), cartesian_product(newO))


def gens_monomial(self):
r"""
Return a tuple containing monomial generators of this growth group.
Expand Down Expand Up @@ -900,7 +888,6 @@ def gens_monomial(self):
for factor in self.cartesian_factors()),
tuple())


def variable_names(self):
r"""
Return the names of the variables.
Expand All @@ -921,13 +908,11 @@ def variable_names(self):
from itertools import groupby
return tuple(v for v, _ in groupby(vars))


class Element(CartesianProductPoset.Element):

from .growth_group import _is_lt_one_
is_lt_one = _is_lt_one_


def _repr_(self, latex=False):
r"""
A representation string for this Cartesian product element.
Expand Down Expand Up @@ -961,7 +946,6 @@ def _repr_(self, latex=False):
return '1'
return s


def _latex_(self):
r"""
A representation string for this Cartesian product element.
Expand All @@ -982,7 +966,6 @@ def _latex_(self):
"""
return self._repr_(latex=True)


def __pow__(self, exponent):
r"""
Calculate the power of this growth element to the given
Expand Down Expand Up @@ -1013,7 +996,6 @@ def __pow__(self, exponent):
return self.parent()._create_element_in_extension_(
tuple(x ** exponent for x in self.cartesian_factors()))


def factors(self):
r"""
Return the atomic factors of this growth element. An atomic factor
Expand Down Expand Up @@ -1062,12 +1044,10 @@ def factors(self):
if not f.is_one()),
tuple())


from .growth_group import _log_factor_, _log_
log = _log_
log_factor = _log_factor_


def _log_factor_(self, base=None, locals=None):
r"""
Helper method for calculating the logarithm of the factorization
Expand Down Expand Up @@ -1120,11 +1100,9 @@ def try_create_growth(g):
ArithmeticError('Cannot build log(%s) in %s.' %
(self, self.parent())), e)


from .growth_group import _rpow_
rpow = _rpow_


def _rpow_element_(self, base):
r"""
Return an element which is the power of ``base`` to this
Expand Down Expand Up @@ -1166,7 +1144,6 @@ def _rpow_element_(self, base):
raise ValueError # calling method has to deal with it...
return factor._rpow_element_(base)


def exp(self):
r"""
The exponential of this element.
Expand Down Expand Up @@ -1211,7 +1188,6 @@ def exp(self):
"""
return self.rpow('e')


def __invert__(self):
r"""
Return the multiplicative inverse of this Cartesian product.
Expand All @@ -1235,7 +1211,6 @@ def __invert__(self):
return self.parent()._create_element_in_extension_(
tuple(~x for x in self.cartesian_factors()))


def _substitute_(self, rules):
r"""
Substitute the given ``rules`` in this
Expand Down Expand Up @@ -1378,7 +1353,6 @@ def _singularity_analysis_(self, var, zeta, precision):
'singularity analysis of {} not yet implemented '
'since it has more than two factors'.format(self))


def variable_names(self):
r"""
Return the names of the variables of this growth element.
Expand Down Expand Up @@ -1408,7 +1382,6 @@ def variable_names(self):
from itertools import groupby
return tuple(v for v, _ in groupby(vars))


CartesianProduct = CartesianProductGrowthGroups


Expand Down
1 change: 0 additions & 1 deletion src/sage/rings/asymptotic/term_monoid.py
Original file line number Diff line number Diff line change
Expand Up @@ -4640,7 +4640,6 @@ def __init__(self, parent, growth, valid_from, **kwds):
raise ValueError('B-Term has not defined all variables which occur in the term in valid_from.')
self.valid_from = valid_from


def construction(self):
r"""
Return a construction of this term.
Expand Down
2 changes: 0 additions & 2 deletions src/sage/rings/continued_fraction.py
Original file line number Diff line number Diff line change
Expand Up @@ -1018,8 +1018,6 @@ def __bool__(self):
"""
return bool(self.quotient(0)) or self.quotient(1) is not Infinity



def is_zero(self):
r"""
Test whether ``self`` is zero.
Expand Down
2 changes: 0 additions & 2 deletions src/sage/rings/function_field/ideal_polymod.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,6 @@ def __bool__(self):
"""
return self._hnf.nrows() != 0



def __hash__(self):
"""
Return the hash of this ideal.
Expand Down
Loading