Skip to content

Commit 49e6c9f

Browse files
author
Release Manager
committed
gh-36851: various details in group (ruff and pycodestyle) This is fixing some E221 and some suggestions of ruff in the `groups` folder ### 📝 Checklist - [x] The title is concise, informative, and self-explanatory. - [x] The description explains in detail what this PR is about. URL: #36851 Reported by: Frédéric Chapoton Reviewer(s): Matthias Köppe
2 parents 1abf5c6 + cc81342 commit 49e6c9f

23 files changed

+52
-56
lines changed

src/sage/groups/abelian_gps/abelian_group.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1387,11 +1387,11 @@ def number_of_subgroups(self, order=None):
13871387
sylow_types = defaultdict(list)
13881388
for p, e in primary_factors:
13891389
sylow_types[p].append(e)
1390-
subgroups_orders_kwds = dict()
1390+
subgroups_orders_kwds = {}
13911391

13921392
if order is None:
13931393
for p, p_exps in sylow_types.items():
1394-
subgroups_orders_kwds[p] = dict(max_sum=sum(p_exps))
1394+
subgroups_orders_kwds[p] = {'max_sum': sum(p_exps)}
13951395
else:
13961396
order = Integer(order)
13971397
if order < 1:
@@ -1403,7 +1403,7 @@ def number_of_subgroups(self, order=None):
14031403
for p in (set(sylow_types) - set(order_exps)):
14041404
del sylow_types[p]
14051405
for p in sylow_types:
1406-
subgroups_orders_kwds[p] = dict(n=order_exps[p])
1406+
subgroups_orders_kwds[p] = {'n': order_exps[p]}
14071407

14081408
result = Integer(1)
14091409
for p, p_exps in sylow_types.items():

src/sage/groups/abelian_gps/abelian_group_morphism.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,8 @@ def _libgap_(self):
133133
sage: libgap(phi)
134134
[ f1, f2 ] -> [ f1*f4, f2 ]
135135
"""
136-
G = libgap(self.domain())
137-
H = libgap(self.codomain())
136+
G = libgap(self.domain())
137+
H = libgap(self.codomain())
138138
in_G = [libgap(g) for g in self.domaingens]
139139
in_H = [libgap(h) for h in self.codomaingens]
140140
return G.GroupHomomorphismByImages(H, in_G, in_H)

src/sage/groups/additive_abelian/qmodnz.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ def some_elements(self):
180180
sage: len(L)
181181
92
182182
"""
183-
return list(set(self(x) for x in QQ.some_elements()))
183+
return list({self(x) for x in QQ.some_elements()})
184184

185185
def random_element(self):
186186
r"""

src/sage/groups/affine_gps/group_element.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# -*- coding: utf-8 -*-
21
r"""
32
Elements of Affine Groups
43

src/sage/groups/artin.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# -*- coding: utf-8 -*-
21
"""
32
Artin Groups
43

src/sage/groups/braid.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# -*- coding: utf-8 -*-
21
"""
32
Braid groups
43
@@ -2068,7 +2067,7 @@ def reverse(self):
20682067
sage: br.is_conjugated(b)
20692068
False
20702069
"""
2071-
t = [i for i in self.Tietze()]
2070+
t = list(self.Tietze())
20722071
t.reverse()
20732072
return self.parent()(tuple(t))
20742073

@@ -2842,7 +2841,7 @@ def _links_gould_representation(self, symbolics=False):
28422841
# quantum trace operator on two fold tensor space
28432842
E = mu.parent().one()
28442843
mu2 = E.tensor_product(mu)
2845-
return tuple([[R, RI], mu2])
2844+
return ([R, RI], mu2)
28462845

28472846
from sage.matrix.matrix_space import MatrixSpace
28482847
Ed = MatrixSpace(BR, d, d, sparse=sparse).one()

src/sage/groups/conjugacy_classes.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# -*- coding: utf-8 -*-
21
r"""
32
Conjugacy classes of groups
43

src/sage/groups/cubic_braid.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -868,7 +868,7 @@ def degrees(self):
868868
raise TypeError('not a finite reflection group')
869869
if self.strands() > 5:
870870
raise TypeError('not a finite reflection group')
871-
d_table = {1: tuple(), 2: (3,), 3: (4, 6),
871+
d_table = {1: (), 2: (3,), 3: (4, 6),
872872
4: (6, 9, 12), 5: (12, 18, 24, 30)}
873873
return tuple(Integer(deg) for deg in d_table[self.strands()])
874874

@@ -887,7 +887,7 @@ def codegrees(self):
887887
raise TypeError('not a finite reflection group')
888888
if self.strands() > 5:
889889
raise TypeError('not a finite reflection group')
890-
d_table = {1: tuple(), 2: (0,), 3: (0, 2),
890+
d_table = {1: (), 2: (0,), 3: (0, 2),
891891
4: (0, 3, 6), 5: (0, 6, 12, 18)}
892892
return tuple(Integer(deg) for deg in d_table[self.strands()])
893893

src/sage/groups/finitely_presented.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ def __reduce__(self):
263263
(Finitely presented group < a, b, c | a*b*c*a^-1*c^-1*b^-1, a*b*c*b^-1*a^-1*c^-1 >,
264264
((1, 2, 3),))
265265
"""
266-
return (self.parent(), tuple([self.Tietze()]))
266+
return (self.parent(), (self.Tietze(),))
267267

268268
def _repr_(self):
269269
"""
@@ -1830,7 +1830,7 @@ def characteristic_varieties(self, ring=QQ, matrix_ideal=None, groebner=False):
18301830
S = R.polynomial_ring()
18311831
K = R.base_ring()
18321832
id_rels = R.ideal(rels)
1833-
res = dict()
1833+
res = {}
18341834
bound = n + 1
18351835
for j in range(bound + 1):
18361836
J = id_rels + A.fitting_ideal(j)
@@ -1847,7 +1847,7 @@ def characteristic_varieties(self, ring=QQ, matrix_ideal=None, groebner=False):
18471847
return res
18481848
if R.ngens() == 1:
18491849
res = {j: gcd(S(p) for p in res[j].gens()) for j in range(bound + 1)}
1850-
char_var = dict()
1850+
char_var = {}
18511851
strict = True
18521852
j = 0
18531853
while strict and j <= bound:
@@ -1862,7 +1862,7 @@ def characteristic_varieties(self, ring=QQ, matrix_ideal=None, groebner=False):
18621862
strict = False
18631863
j += 1
18641864
return char_var
1865-
char_var = dict()
1865+
char_var = {}
18661866
strict = True
18671867
j = 0
18681868
while strict and j <= bound:

src/sage/groups/fqf_orthogonal.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -549,7 +549,7 @@ def orbits(G, L):
549549
# separating the different primes here would speed things up
550550
b_cand = [[b for b in B if b.q() == a.q() and b.order() == a.order()] for a in A.smith_form_gens()]
551551

552-
G = B.orthogonal_group(tuple())
552+
G = B.orthogonal_group(())
553553
ambient = G.ambient()
554554
waiting = [[]]
555555
while len(waiting) > 0:

0 commit comments

Comments
 (0)