Skip to content

Commit c9e28a8

Browse files
author
Release Manager
committed
gh-36654: More fixes for e221 a few more fixes for pycodestyle E221 ### 📝 Checklist - [x] The title is concise, informative, and self-explanatory. - [x] The description explains in detail what this PR is about. URL: #36654 Reported by: Frédéric Chapoton Reviewer(s): Kwankyu Lee
2 parents 0394ea3 + a945f88 commit c9e28a8

File tree

6 files changed

+91
-86
lines changed

6 files changed

+91
-86
lines changed

src/sage/groups/cubic_braid.py

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ def eliminate_item(tietze_list):
141141
if second is None:
142142
return None
143143
middle = tietze_list[1:i]
144-
end = tietze_list[i+1:l]
144+
end = tietze_list[i+1:l]
145145
if first == second:
146146
return [-first] + middle + end
147147
else:
@@ -490,7 +490,7 @@ def find_root(domain):
490490
if root[0] == 0:
491491
continue
492492
root_bur = root[0]
493-
if root[1] == 1:
493+
if root[1] == 1:
494494
break
495495
return root_bur
496496

@@ -747,7 +747,7 @@ def __init__(self, names, cbg_type=None):
747747
sage: U5 = AssionGroupU(5) # indirect doctest
748748
sage: TestSuite(U5).run() # long time
749749
"""
750-
n = Integer(len(names))
750+
n = Integer(len(names))
751751
if n < 1:
752752
raise ValueError("the number of strands must be an integer larger than one")
753753

@@ -759,12 +759,12 @@ def __init__(self, names, cbg_type=None):
759759
free_group = FreeGroup(names)
760760
self._cbg_type = cbg_type
761761
self._nstrands = n + 1
762-
self._ident = self._cbg_type.value + self._nstrands.str()
762+
self._ident = self._cbg_type.value + self._nstrands.str()
763763
self._braid_group = BraidGroup(names)
764764

765765
# internal naming of elements for convenience
766-
b = [free_group([i]) for i in range(1, n+1)]
767-
t = [free_group([i, i+1]) ** 3 for i in range(1, n)]
766+
b = [free_group([i]) for i in range(1, n+1)]
767+
t = [free_group([i, i+1]) ** 3 for i in range(1, n)]
768768
ti = [free_group([-i, -i-1]) ** 3 for i in range(1, n)]
769769

770770
# first the braid relation
@@ -796,12 +796,12 @@ def __init__(self, names, cbg_type=None):
796796
# the following global pointers to classical group realizations will be set in the private method
797797
# _create_classical_realization
798798
# ------------------------------------------------------------------------------------------------
799-
self._classical_group = None # This is the classical Group returned by as_classical_group
800-
self._classical_base_group = None # this only differs for special cases for Assion groups from the former
801-
self._classical_invariant_form = None # invariant form of the classical base group
802-
self._classical_embedding = None # if self._classical_group different from self._classical_base_group
803-
self._centralizing_matrix = None # for Assion groups: element in classical base group commuting with self
804-
self._centralizing_element = None # image under nat. map of the former one in the proj. classical group
799+
self._classical_group = None # This is the classical Group returned by as_classical_group
800+
self._classical_base_group = None # this only differs for special cases for Assion groups from the former
801+
self._classical_invariant_form = None # invariant form of the classical base group
802+
self._classical_embedding = None # if self._classical_group different from self._classical_base_group
803+
self._centralizing_matrix = None # for Assion groups: element in classical base group commuting with self
804+
self._centralizing_element = None # image under nat. map of the former one in the proj. classical group
805805
return
806806

807807
def _repr_(self):
@@ -1095,7 +1095,7 @@ def set_classical_realization(self, base_group, proj_group, centralizing_matrix,
10951095
# ------------------------------------------------------------------------------
10961096
# Setting the List of Braid Images
10971097
# ------------------------------------------------------------------------------
1098-
im_gens = [base_group(m) for m in transvec_matrices]
1098+
im_gens = [base_group(m) for m in transvec_matrices]
10991099

11001100
# ------------------------------------------------------------------------------
11011101
# By the work of Assion no check on the group homomorphism is needed, at all.
@@ -1109,7 +1109,7 @@ def set_classical_realization(self, base_group, proj_group, centralizing_matrix,
11091109
# ------------------------------------------------------------------------------
11101110
# Do the projective group realization if needed
11111111
# ------------------------------------------------------------------------------
1112-
embedding = self._classical_embedding
1112+
embedding = self._classical_embedding
11131113
classical_group = None
11141114
if proj_group is None:
11151115
classical_group = base_group
@@ -1128,19 +1128,19 @@ def set_classical_realization(self, base_group, proj_group, centralizing_matrix,
11281128
nat_hom = base_group.hom(proj_group.gens(), check=check)
11291129
centralizing_element = nat_hom(centralizing_matrix)
11301130
classical_group_gens = [nat_hom(m) for m in transvec_matrices]
1131-
classical_group = proj_group.subgroup(classical_group_gens, canonicalize=False)
1131+
classical_group = proj_group.subgroup(classical_group_gens, canonicalize=False)
11321132
hom_to_classic = self.hom(classical_group.gens(), check=check)
11331133
classical_group.register_conversion(hom_to_classic)
11341134

11351135
# ------------------------------------------------------------------------------
11361136
# register constructed items
11371137
# ------------------------------------------------------------------------------
1138-
self._classical_group = classical_group
1139-
self._classical_base_group = base_group
1140-
self._classical_invariant_form = base_group.invariant_form()
1141-
self._centralizing_matrix = centralizing_matrix
1142-
self._centralizing_element = centralizing_element
1143-
self._classical_embedding = embedding
1138+
self._classical_group = classical_group
1139+
self._classical_base_group = base_group
1140+
self._classical_invariant_form = base_group.invariant_form()
1141+
self._centralizing_matrix = centralizing_matrix
1142+
self._centralizing_element = centralizing_element
1143+
self._classical_embedding = embedding
11441144
return
11451145

11461146
# -------------------------------------------------------------------------------
@@ -1211,7 +1211,7 @@ def transvec2mat(v, bas=bas, bform=bform, fact=1):
12111211
# ------------------------------------------------------------------------------
12121212
centralizing_vector = xbas[mhalf-1]
12131213
centralizing_matrix = base_group(transvec2mat(centralizing_vector, fact=1))
1214-
transvec_matrices = [transvec2mat(v) for v in transvections]
1214+
transvec_matrices = [transvec2mat(v) for v in transvections]
12151215

12161216
set_classical_realization(self, base_group, proj_group, centralizing_matrix, transvec_matrices)
12171217
return
@@ -1273,9 +1273,9 @@ def create_unitary_realization(self, m):
12731273
for j in range(mthird):
12741274
pos = 3*(j+1)-1
12751275
transvections.append(xbas[pos-1]) # t_{3i} = x_{3i-1}
1276-
if pos + 1 < m:
1276+
if pos + 1 < m:
12771277
transvections.append(xbas[pos-1]+xbas[pos]+xbas[pos+1]) # t_{3i+1} = x_{3i-1} + x_{3i} + x_{3i+1}
1278-
if pos + 3 < m:
1278+
if pos + 3 < m:
12791279
transvections.append(xbas[pos+1]+xbas[pos+2]+xbas[pos+3]) # t_{3i+2} = x_{3i+1} + x_{3i+2} + x_{3i+3}
12801280

12811281
# -----------------------------------------------------------
@@ -1294,7 +1294,7 @@ def transvec2mat(v, bas=bas, bform=bform, fact=a):
12941294
# ------------------------------------------------------------------------------
12951295
centralizing_vector = xbas[m-2]+xbas[m-1]
12961296
centralizing_matrix = base_group(transvec2mat(centralizing_vector, fact=1))
1297-
transvec_matrices = [transvec2mat(v) for v in transvections]
1297+
transvec_matrices = [transvec2mat(v) for v in transvections]
12981298

12991299
set_classical_realization(self, base_group, proj_group, centralizing_matrix, transvec_matrices)
13001300
return
@@ -1314,13 +1314,13 @@ def transvec2mat(v, bas=bas, bform=bform, fact=a):
13141314
# Setting the Classical group
13151315
# -------------------------------------------------------------------------------
13161316
if self._cbg_type == CubicBraidGroup.type.AssionS:
1317-
dim_sympl_group = n-1 # S(n-1) = Sp(n-1, 3)
1318-
if n % 2 == 0:
1319-
dim_sympl_group = n # S(n-1) = subgroup of PSp(n, 3)
1317+
dim_sympl_group = n-1 # S(n-1) = Sp(n-1, 3)
1318+
if n % 2 == 0:
1319+
dim_sympl_group = n # S(n-1) = subgroup of PSp(n, 3)
13201320
create_sympl_realization(self, dim_sympl_group)
13211321
elif self._cbg_type == CubicBraidGroup.type.AssionU:
13221322
dim_unitary_group = n-1 # U(n-1) = GU(n-1, 2)
1323-
if n % 3 == 0:
1323+
if n % 3 == 0:
13241324
dim_unitary_group = n # U(n-1) = subgroup PGU(n, 3)
13251325
create_unitary_realization(self, dim_unitary_group)
13261326
else:
@@ -1344,11 +1344,11 @@ def transvec2mat(v, bas=bas, bform=bform, fact=a):
13441344
UCF = UniversalCyclotomicField()
13451345
z12 = UCF.gen(12)
13461346
classical_group = self.as_matrix_group(root_bur=~z12, domain=UCF, reduced='unitary')
1347-
self._classical_group = classical_group
1348-
self._classical_base_group = classical_group
1349-
self._classical_embedding = classical_group
1347+
self._classical_group = classical_group
1348+
self._classical_base_group = classical_group
1349+
self._classical_embedding = classical_group
13501350
if self._classical_invariant_form is None:
1351-
self._classical_invariant_form = classical_group.ambient().invariant_form()
1351+
self._classical_invariant_form = classical_group.ambient().invariant_form()
13521352
return
13531353

13541354
def _element_constructor_(self, x, **kwds):

src/sage/misc/superseded.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -363,10 +363,10 @@ def __init__(self, issue_number, func, module, instance=None, unbound=None):
363363
try:
364364
self.__dict__.update(func.__dict__)
365365
except AttributeError:
366-
pass # Cython classes don't have __dict__
366+
pass # Cython classes don't have __dict__
367367
self.func = func
368-
self.issue_number = issue_number
369-
self.instance = instance # for use with methods
368+
self.issue_number = issue_number
369+
self.instance = instance # for use with methods
370370
self.unbound = unbound
371371
self.__module__ = module
372372
if isinstance(func, type(deprecation)):

src/sage/modules/free_module.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2459,7 +2459,7 @@ def aux(length, norm, max_):
24592459
iters = [iter(R) for _ in range(len(G))]
24602460
for x in iters:
24612461
next(x) # put at 0
2462-
zero = R(0)
2462+
zero = R.zero()
24632463
v = [zero for _ in range(len(G))]
24642464
n = 0
24652465
z = self(0)
@@ -3889,11 +3889,11 @@ def intersection(self, other):
38893889
V2 = self
38903890
A1 = V1.basis_matrix()
38913891
A2 = V2.basis_matrix()
3892-
S = A1.stack(A2)
3893-
K = S.integer_kernel(self.base_ring()).basis_matrix()
3894-
n = int(V1.dimension())
3892+
S = A1.stack(A2)
3893+
K = S.integer_kernel(self.base_ring()).basis_matrix()
3894+
n = int(V1.dimension())
38953895
K = K.matrix_from_columns(range(n))
3896-
B = K*A1
3896+
B = K * A1
38973897
return self.span(B)
38983898

38993899
def __and__(self, other):
@@ -5219,10 +5219,10 @@ def __quotient_matrices(self, sub):
52195219
# Our algorithm is to note that D is determined if we just
52205220
# replace both A and S by the submatrix got from their pivot
52215221
# columns.
5222-
P = A.pivots()
5222+
P = A.pivots()
52235223
AA = A.matrix_from_columns(P)
52245224
SS = S.matrix_from_columns(P)
5225-
D = SS * AA**(-1)
5225+
D = SS * AA**(-1)
52265226

52275227
# Compute the image of each basis vector for ``self`` under the
52285228
# map "write an element of ``self`` in terms of the basis A" then

src/sage/modules/with_basis/morphism.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1055,7 +1055,7 @@ def coreduced(self, y):
10551055
on_basis = self.on_basis()
10561056
assert y in G
10571057

1058-
result = G.zero()
1058+
result = G.zero()
10591059
remainder = y
10601060

10611061
while not remainder.is_zero():
@@ -1447,7 +1447,7 @@ def __init__(self, domain, diagonal, codomain=None, category=None):
14471447
if codomain is None:
14481448
raise ValueError("The codomain should be specified")
14491449
if not (domain.basis().keys() == codomain.basis().keys() and
1450-
domain.base_ring() == codomain.base_ring()):
1450+
domain.base_ring() == codomain.base_ring()):
14511451
raise ValueError("The domain and codomain should have the same base ring "
14521452
"and the same basis indexing")
14531453
from collections.abc import Callable

src/sage/plot/plot3d/platonic.py

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@ def prep(G, center, size, kwds):
152152
G = G.translate(center)
153153
return G
154154

155+
155156
@rename_keyword(alpha='opacity')
156157
def tetrahedron(center=(0, 0, 0), size=1, **kwds):
157158
"""
@@ -255,15 +256,16 @@ def tetrahedron(center=(0, 0, 0), size=1, **kwds):
255256
one = RR.one()
256257
sqrt2 = RR(2).sqrt()
257258
sqrt6 = RR(6).sqrt()
258-
point_list = [(0,0,1),
259-
(2*sqrt2/3, 0, -one/3),
260-
( -sqrt2/3, sqrt6/3, -one/3),
261-
( -sqrt2/3, -sqrt6/3, -one/3)]
259+
point_list = [(0, 0, 1),
260+
(2*sqrt2/3, 0, -one/3),
261+
(-sqrt2/3, sqrt6/3, -one/3),
262+
(-sqrt2/3, -sqrt6/3, -one/3)]
262263
face_list = [[0,1,2],[1,3,2],[0,2,3],[0,3,1]]
263264
if 'aspect_ratio' not in kwds:
264265
kwds['aspect_ratio'] = [1, 1, 1]
265266
return index_face_set(face_list, point_list, enclosed=True, center=center, size=size, **kwds)
266267

268+
267269
@rename_keyword(alpha='opacity')
268270
def cube(center=(0, 0, 0), size=1, color=None, frame_thickness=0,
269271
frame_color=None, **kwds):
@@ -405,6 +407,7 @@ def cube(center=(0, 0, 0), size=1, color=None, frame_thickness=0,
405407
B += frame3d((-0.5,-0.5,-0.5),(0.5,0.5,0.5), thickness=frame_thickness, color=frame_color)
406408
return prep(B, center, size, kwds)
407409

410+
408411
@rename_keyword(alpha='opacity')
409412
def octahedron(center=(0, 0, 0), size=1, **kwds):
410413
r"""
@@ -440,7 +443,8 @@ def octahedron(center=(0, 0, 0), size=1, **kwds):
440443
kwds['enclosed'] = True
441444
if 'aspect_ratio' not in kwds:
442445
kwds['aspect_ratio'] = [1, 1, 1]
443-
return prep(Box(1,1,1).dual(**kwds), center, size, kwds)
446+
return prep(Box(1, 1, 1).dual(**kwds), center, size, kwds)
447+
444448

445449
@rename_keyword(alpha='opacity')
446450
def dodecahedron(center=(0, 0, 0), size=1, **kwds):
@@ -514,21 +518,21 @@ def dodecahedron(center=(0, 0, 0), size=1, **kwds):
514518
- Robert Bradshaw, William Stein
515519
"""
516520
RR = RDF
517-
one = RR(1)
521+
one = RR.one()
518522
sqrt3 = RR(3).sqrt()
519523
sqrt5 = RR(5).sqrt()
520524
R3 = RR**3
521-
rot = matrix(RR, [[ -one/2,-sqrt3/2, 0],
522-
[ sqrt3/2, -one/2, 0],
523-
[ 0, 0, 1]])
524-
rot2 = rot*rot
525+
rot = matrix(RR, [[-one / 2, -sqrt3 / 2, 0],
526+
[sqrt3 / 2, -one / 2, 0],
527+
[0, 0, 1]])
528+
rot2 = rot * rot
525529

526530
# The top
527-
Q = R3([0,0,1])
531+
Q = R3([0, 0, 1])
528532
# The first ring
529533
P1 = R3([2*one/3, 0, sqrt5/3])
530534
# The second ring
531-
R1 = R3([sqrt5/3, 1/sqrt3, one/3])
535+
R1 = R3([sqrt5/3, 1/sqrt3, one/3])
532536
R2 = R3([sqrt5/3, -1/sqrt3, one/3])
533537

534538
top = [Q, P1, rot*P1, rot2*P1, R1, rot*R2, rot*R1, rot2*R2, rot2*R1, R2]
@@ -555,6 +559,7 @@ def dodecahedron(center=(0, 0, 0), size=1, **kwds):
555559
# vertex_spheres += [faces.stickers(['red','yellow','blue','purple','black','orange'], .1, .1)] # [faces]
556560
# return Graphics3dGroup(vertex_spheres)
557561

562+
558563
@rename_keyword(alpha='opacity')
559564
def icosahedron(center=(0, 0, 0), size=1, **kwds):
560565
r"""

0 commit comments

Comments
 (0)