Skip to content

Commit

Permalink
gh-38858: autopep8 fixes for E302 in matrix,rings,groups,dynamics
Browse files Browse the repository at this point in the history
    
as the next step towards activiting the check for E302 in our linter

purely scripted using `autopep8`

### 📝 Checklist

- [x] The title is concise and informative.
- [x] The description explains in detail what this PR is about.
- [ ] I have linked a relevant issue or discussion.
- [ ] I have created tests covering the changes.
- [ ] I have updated the documentation and checked the documentation
preview.
    
URL: #38858
Reported by: Frédéric Chapoton
Reviewer(s): David Coudert
  • Loading branch information
Release Manager committed Nov 2, 2024
2 parents 59a5a5f + 471d555 commit 4fa65ed
Show file tree
Hide file tree
Showing 59 changed files with 145 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/sage/dynamics/arithmetic_dynamics/affine_ds.py
Original file line number Diff line number Diff line change
Expand Up @@ -884,6 +884,7 @@ def degree(self):
"""
return self.as_scheme_morphism().degree()


class DynamicalSystem_affine_field(DynamicalSystem_affine,
SchemeMorphism_polynomial_affine_space_field):
@cached_method
Expand Down Expand Up @@ -985,6 +986,7 @@ def reduce_base_field(self):
"""
return self.as_scheme_morphism().reduce_base_field().as_dynamical_system()


class DynamicalSystem_affine_finite_field(DynamicalSystem_affine_field,
SchemeMorphism_polynomial_affine_space_finite_field):

Expand Down
1 change: 1 addition & 0 deletions src/sage/dynamics/arithmetic_dynamics/berkovich_ds.py
Original file line number Diff line number Diff line change
Expand Up @@ -960,6 +960,7 @@ def __call__(self, x, type_3_pole_check=True):
new_radius = max(new_radius, p**(-valuation/prime.absolute_ramification_index())*r**i)
return self.domain()(new_center, new_radius)


class DynamicalSystem_Berkovich_affine(DynamicalSystem_Berkovich):
r"""
A dynamical system of the affine Berkovich line over `\CC_p`.
Expand Down
14 changes: 14 additions & 0 deletions src/sage/dynamics/arithmetic_dynamics/endPN_automorphism_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,7 @@ def height_bound(polynomial):

return (6*(L2norm_sq)**3)


def PGL_repn(rational_function):
r"""
Take a linear fraction transformation and represent it as a 2x2 matrix.
Expand Down Expand Up @@ -365,6 +366,7 @@ def PGL_repn(rational_function):
g = rational_function.denominator()
return matrix(F, 2, [f[1], f[0], g[1], g[0]])


def PGL_order(A):
r"""
Find the multiplicative order of a linear fractional transformation that
Expand Down Expand Up @@ -402,6 +404,7 @@ def PGL_order(A):

return n


def CRT_helper(automorphisms, moduli):
r"""
Lift the given list of automorphisms to `Zmod(M)`.
Expand Down Expand Up @@ -449,6 +452,7 @@ def CRT_helper(automorphisms, moduli):

return autos, modulus*moduli[0]


def CRT_automorphisms(automorphisms, order_elts, degree, moduli):
r"""
Compute a maximal list of automorphisms over `Zmod(M)`.
Expand Down Expand Up @@ -495,6 +499,7 @@ def CRT_automorphisms(automorphisms, order_elts, degree, moduli):
# get list of CRT'ed automorphisms
return CRT_helper(degree_d_autos, moduli)


def valid_automorphisms(automorphisms_CRT, rational_function, ht_bound, M,
return_functions=False):
r"""
Expand Down Expand Up @@ -904,6 +909,7 @@ def automorphism_group_FF(rational_function, absolute=False, iso_type=False, ret
else:
return G, which_group(G[1])


def field_descent(sigma, y):
r"""
Function for descending an element in a field `E` to a subfield `F`.
Expand Down Expand Up @@ -961,6 +967,7 @@ def field_descent(sigma, y):

return x + F(quotient)*a**(steps)


def rational_function_coefficient_descent(rational_function, sigma, poly_ring):
r"""
Function for descending the coefficients of a rational function from field `E`
Expand Down Expand Up @@ -1059,6 +1066,7 @@ def rational_function_coerce(rational_function, sigma, S_polys):
else:
return S_polys([sigma(a) for a in f]) / S_polys([sigma(b) for b in g])


def rational_function_reduce(rational_function):
r"""
Force Sage to divide out common factors in numerator and denominator
Expand All @@ -1084,6 +1092,7 @@ def rational_function_reduce(rational_function):
comm_factor = gcd(F,G)
return (F.quo_rem(comm_factor)[0]) / (G.quo_rem(comm_factor)[0])


def three_stable_points(rational_function, invariant_list):
r"""
Implementation of Algorithm 1 for automorphism groups from
Expand Down Expand Up @@ -1157,6 +1166,7 @@ def three_stable_points(rational_function, invariant_list):
automorphisms.append(s)
return automorphisms


def automorphism_group_FF_alg2(rational_function):
r"""
Implementation of algorithm for determining the absolute automorphism
Expand Down Expand Up @@ -1455,6 +1465,7 @@ def order_p_automorphisms(rational_function, pre_image):

return automorphisms_p


def automorphisms_fixing_pair(rational_function, pair, quad):
r"""
Compute the set of automorphisms with order prime to the characteristic
Expand Down Expand Up @@ -1535,6 +1546,7 @@ def automorphisms_fixing_pair(rational_function, pair, quad):

return list(set(automorphisms_prime_to_p))


def automorphism_group_FF_alg3(rational_function):
r"""
Implementation of Algorithm 3 in the paper by Faber/Manes/Viray [FMV]_
Expand Down Expand Up @@ -2125,6 +2137,7 @@ def greedy_independence_check(P, repeated_mult, point_to_mult):
if len(source) == n+2:
return source, corresponding


def conjugating_set_helper(f, g, num_cpus, source, possible_targets):
r"""
Return the set of elements in PGL over the base ring
Expand Down Expand Up @@ -2270,6 +2283,7 @@ def find_conjugations_arrangement(tuples):
Conj = find_conjugations_subset(product(*subset_iterators))
return Conj


def is_conjugate_helper(f, g, num_cpus, source, possible_targets):
r"""
Return if ``f`` is conjugate to ``g``.
Expand Down
9 changes: 9 additions & 0 deletions src/sage/dynamics/arithmetic_dynamics/endPN_minimal_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -473,6 +473,8 @@ def Min(Fun, p, ubRes, conj, all_orbits=False):
###################################################

#modification of Bruin-Molnar for all representatives


def BM_all_minimal(vp, return_transformation=False, D=None):
r"""
Determine a representative in each `SL(2,\ZZ)` orbit with minimal
Expand Down Expand Up @@ -623,6 +625,8 @@ def BM_all_minimal(vp, return_transformation=False, D=None):
###################################################

#find minimal model


def HS_minimal(f, return_transformation=False, D=None):
r"""
Compute a minimal model for the given projective dynamical system.
Expand Down Expand Up @@ -713,6 +717,8 @@ def HS_minimal(f, return_transformation=False, D=None):
return F

#find all representatives of orbits for one prime


def HS_all_minimal_p(p, f, m=None, return_transformation=False):
r"""
Find a representative in each distinct `SL(2,\ZZ)` orbit with
Expand Down Expand Up @@ -814,6 +820,8 @@ def HS_all_minimal_p(p, f, m=None, return_transformation=False):
return [funct for funct, matr in reps]

#find all representatives of orbits


def HS_all_minimal(f, return_transformation=False, D=None):
r"""
Determine a representative in each `SL(2,\ZZ)` orbit with minimal resultant.
Expand Down Expand Up @@ -906,6 +914,7 @@ def HS_all_minimal(f, return_transformation=False, D=None):
# Ben Hutz July 2018
#####################################3


def get_bound_dynamical(F, f, m=1, dynatomic=True, prec=53, emb=None):
"""
The hyperbolic distance from `j` which must contain the smallest map.
Expand Down
2 changes: 2 additions & 0 deletions src/sage/dynamics/arithmetic_dynamics/projective_ds.py
Original file line number Diff line number Diff line change
Expand Up @@ -7026,6 +7026,7 @@ def Lattes_to_curve(self, return_conjugation=False, check_lattes=False):
return (M, E)
return E


class DynamicalSystem_projective_field(DynamicalSystem_projective,
SchemeMorphism_polynomial_projective_space_field):

Expand Down Expand Up @@ -9117,6 +9118,7 @@ def is_newton(self, return_conjugation=False):
else:
return Npoly.derivative(z) == (z - N_aff[0]).denominator()


class DynamicalSystem_projective_finite_field(DynamicalSystem_projective_field,
SchemeMorphism_polynomial_projective_space_finite_field):

Expand Down
1 change: 1 addition & 0 deletions src/sage/dynamics/cellular_automata/elementary.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
lazy_import("sage.plot.matrix_plot", "matrix_plot")
from sage.misc.constant_function import ConstantFunction


class ElementaryCellularAutomata(SageObject):
r"""
Elementary cellular automata.
Expand Down
1 change: 1 addition & 0 deletions src/sage/dynamics/cellular_automata/glca.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
from sage.typeset.ascii_art import AsciiArt
from sage.typeset.unicode_art import UnicodeArt


class GraftalLaceCellularAutomata(SageObject):
r"""
Graftal Lace Cellular Automata (GLCA).
Expand Down
2 changes: 2 additions & 0 deletions src/sage/dynamics/complex_dynamics/mandel_julia.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@

EPS = 0.00001


def mandelbrot_plot(f=None, **kwds):
r"""
Plot of the Mandelbrot set for a one parameter family of polynomial maps.
Expand Down Expand Up @@ -498,6 +499,7 @@ def kneading_sequence(theta):
KS_str = ''.join(KS) + '*'
return KS_str


def julia_plot(f=None, **kwds):
r"""
Plots the Julia set of a given polynomial ``f``. Users can specify whether
Expand Down
3 changes: 3 additions & 0 deletions src/sage/dynamics/finite_dynamical_system.py
Original file line number Diff line number Diff line change
Expand Up @@ -678,6 +678,7 @@ def is_homomesic(self, h, average=None, find_average=False, elements=None):
return True
return orbavgs[0] == average


class InvertibleDiscreteDynamicalSystem(DiscreteDynamicalSystem):
r"""
An invertible discrete dynamical system.
Expand Down Expand Up @@ -969,6 +970,7 @@ def inverse_evolution_default(self, x):
"""
return self.orbit(x)[-1]


class FiniteDynamicalSystem(DiscreteDynamicalSystem):
r"""
A finite discrete dynamical system.
Expand Down Expand Up @@ -1113,6 +1115,7 @@ def cycles(self):
break
return cycs


class InvertibleFiniteDynamicalSystem(InvertibleDiscreteDynamicalSystem, FiniteDynamicalSystem):
r"""
An invertible finite discrete dynamical system.
Expand Down
3 changes: 3 additions & 0 deletions src/sage/dynamics/finite_dynamical_system_catalog.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
FiniteDynamicalSystem, InvertibleDiscreteDynamicalSystem, \
InvertibleFiniteDynamicalSystem


def permutation(pi, invertible=True):
r"""
Return the invertible finite discrete dynamical system
Expand Down Expand Up @@ -64,6 +65,7 @@ def permutation(pi, invertible=True):
X = range(1, n+1)
return InvertibleFiniteDynamicalSystem(X, pi, inverse=pi.inverse(), create_tuple=True)


def one_line(xs):
r"""
Return the finite discrete dynamical system
Expand Down Expand Up @@ -148,6 +150,7 @@ def bitstring_rotation(n, ones=None):
psi = lambda x: (x[-1],) + x[:-1]
return InvertibleFiniteDynamicalSystem(X, phi, inverse=psi)


def striker_sweep(E, predicate, elements, lazy=False):
r"""
Return the invertible finite discrete dynamical system
Expand Down
1 change: 1 addition & 0 deletions src/sage/dynamics/surface_dynamics_deprecation.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"information at\n" \
" http://www.labri.fr/perso/vdelecro/surface-dynamics/latest/"


def surface_dynamics_deprecation(name):
r"""
TESTS::
Expand Down
3 changes: 3 additions & 0 deletions src/sage/groups/abelian_gps/abelian_aut.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@ def matrix(self):
m.set_immutable()
return m


class AbelianGroupAutomorphismGroup_gap(CachedRepresentation,
GroupMixinLibGAP,
Group,
Expand Down Expand Up @@ -407,6 +408,7 @@ def is_subgroup_of(self, G):
return False
return G.gap().IsSubsemigroup(self).sage()


class AbelianGroupAutomorphismGroup(AbelianGroupAutomorphismGroup_gap):
r"""
The full automorphism group of a finite abelian group.
Expand Down Expand Up @@ -467,6 +469,7 @@ def _repr_(self):
"""
return "Full group of automorphisms of %s" % self.domain()


class AbelianGroupAutomorphismGroup_subgroup(AbelianGroupAutomorphismGroup_gap):
r"""
Groups of automorphisms of abelian groups.
Expand Down
6 changes: 6 additions & 0 deletions src/sage/groups/abelian_gps/abelian_group_gap.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
from sage.structure.unique_representation import UniqueRepresentation
from sage.categories.groups import Groups


class AbelianGroupElement_gap(ElementLibGAP):
r"""
An element of an abelian group via libgap.
Expand Down Expand Up @@ -184,6 +185,7 @@ def order(self):
"""
return self.gap().Order().sage()


class AbelianGroupElement_polycyclic(AbelianGroupElement_gap):
r"""
An element of an abelian group using the GAP package ``Polycyclic``.
Expand Down Expand Up @@ -220,6 +222,7 @@ def exponents(self):
"""
return tuple(self.gap().Exponents().sage())


class AbelianGroup_gap(UniqueRepresentation, GroupMixinLibGAP, ParentLibGAP, AbelianGroupBase):
r"""
Finitely generated abelian groups implemented in GAP.
Expand Down Expand Up @@ -620,6 +623,7 @@ def subgroup(self, gens):
gens = tuple([self(g) for g in gens])
return AbelianGroupSubgroup_gap(self.ambient(), gens)


class AbelianGroupGap(AbelianGroup_gap):
r"""
Abelian groups implemented using GAP.
Expand Down Expand Up @@ -730,6 +734,7 @@ def __reduce__(self):
"""
return AbelianGroupGap, (self.gens_orders(),)


class AbelianGroupSubgroup_gap(AbelianGroup_gap):
r"""
Subgroups of abelian groups with GAP.
Expand Down Expand Up @@ -879,6 +884,7 @@ def retract(self, x):
"""
return self(x)


class AbelianGroupQuotient_gap(AbelianGroup_gap):
r"""
Quotients of abelian groups by a subgroup.
Expand Down
Loading

0 comments on commit 4fa65ed

Please sign in to comment.