Skip to content

Commit f7269e4

Browse files
committed
some fixes for E221
1 parent ebef87a commit f7269e4

File tree

5 files changed

+58
-53
lines changed

5 files changed

+58
-53
lines changed

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
@@ -2443,7 +2443,7 @@ def aux(length, norm, max_):
24432443
iters = [iter(R) for _ in range(len(G))]
24442444
for x in iters:
24452445
next(x) # put at 0
2446-
zero = R(0)
2446+
zero = R.zero()
24472447
v = [zero for _ in range(len(G))]
24482448
n = 0
24492449
z = self(0)
@@ -3873,11 +3873,11 @@ def intersection(self, other):
38733873
V2 = self
38743874
A1 = V1.basis_matrix()
38753875
A2 = V2.basis_matrix()
3876-
S = A1.stack(A2)
3877-
K = S.integer_kernel(self.base_ring()).basis_matrix()
3878-
n = int(V1.dimension())
3876+
S = A1.stack(A2)
3877+
K = S.integer_kernel(self.base_ring()).basis_matrix()
3878+
n = int(V1.dimension())
38793879
K = K.matrix_from_columns(range(n))
3880-
B = K*A1
3880+
B = K * A1
38813881
return self.span(B)
38823882

38833883
def __and__(self, other):
@@ -5201,10 +5201,10 @@ def __quotient_matrices(self, sub):
52015201
# Our algorithm is to note that D is determined if we just
52025202
# replace both A and S by the submatrix got from their pivot
52035203
# columns.
5204-
P = A.pivots()
5204+
P = A.pivots()
52055205
AA = A.matrix_from_columns(P)
52065206
SS = S.matrix_from_columns(P)
5207-
D = SS * AA**(-1)
5207+
D = SS * AA**(-1)
52085208

52095209
# Compute the image of each basis vector for ``self`` under the
52105210
# 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"""

src/sage/plot/plot3d/tri_plot.py

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -412,38 +412,38 @@ def plot_block(self, min_x, mid_x, max_x, min_y, mid_y, max_y, sw_z, nw_z, se_z,
412412
self.interface(0, sw.top, sw.top_c, nw.bottom, nw.bottom_c)
413413
self.interface(0, se.top, se.top_c, ne.bottom, ne.bottom_c)
414414

415-
#get the boundary information about the subsquares
416-
left = sw.left + nw.left[1:]
417-
left_c = sw.left_c + nw.left_c
418-
right = se.right + ne.right[1:]
419-
right_c = se.right_c + ne.right_c
420-
top = nw.top + ne.top[1:]
421-
top_c = nw.top_c + ne.top_c
422-
bottom = sw.bottom + se.bottom[1:]
415+
# get the boundary information about the subsquares
416+
left = sw.left + nw.left[1:]
417+
left_c = sw.left_c + nw.left_c
418+
right = se.right + ne.right[1:]
419+
right_c = se.right_c + ne.right_c
420+
top = nw.top + ne.top[1:]
421+
top_c = nw.top_c + ne.top_c
422+
bottom = sw.bottom + se.bottom[1:]
423423
bottom_c = sw.bottom_c + se.bottom_c
424424

425425
else:
426426
# just build the square we're in
427427
if self._g is None:
428-
sw = [(min_x,min_y,sw_z[0])]
429-
nw = [(min_x,max_y,nw_z[0])]
430-
se = [(max_x,min_y,se_z[0])]
431-
ne = [(max_x,max_y,ne_z[0])]
432-
c = [[(mid_x,mid_y,mid_z[0])]]
428+
sw = [(min_x, min_y, sw_z[0])]
429+
nw = [(min_x, max_y, nw_z[0])]
430+
se = [(max_x, min_y, se_z[0])]
431+
ne = [(max_x, max_y, ne_z[0])]
432+
c = [[(mid_x, mid_y, mid_z[0])]]
433433
else:
434-
sw = [(min_x,min_y,sw_z[0]),sw_z[1]]
435-
nw = [(min_x,max_y,nw_z[0]),nw_z[1]]
436-
se = [(max_x,min_y,se_z[0]),se_z[1]]
437-
ne = [(max_x,max_y,ne_z[0]),ne_z[1]]
438-
c = [[(mid_x,mid_y,mid_z[0]),mid_z[1]]]
439-
440-
left = [sw,nw]
441-
left_c = c
442-
top = [nw,ne]
443-
top_c = c
444-
right = [se,ne]
445-
right_c = c
446-
bottom = [sw,se]
434+
sw = [(min_x, min_y, sw_z[0]), sw_z[1]]
435+
nw = [(min_x, max_y, nw_z[0]), nw_z[1]]
436+
se = [(max_x, min_y, se_z[0]), se_z[1]]
437+
ne = [(max_x, max_y, ne_z[0]), ne_z[1]]
438+
c = [[(mid_x, mid_y, mid_z[0]), mid_z[1]]]
439+
440+
left = [sw, nw]
441+
left_c = c
442+
top = [nw, ne]
443+
top_c = c
444+
right = [se, ne]
445+
right_c = c
446+
bottom = [sw, se]
447447
bottom_c = c
448448

449449
return PlotBlock(left, left_c, top, top_c, right, right_c, bottom, bottom_c)
@@ -465,9 +465,9 @@ def interface(self, n, p, p_c, q, q_c):
465465
sage: t._objects[-1].get_vertices()
466466
((-1/4, 0, 1/16), (-1/4, 1/4, 1/8), (-3/8, 1/8, 3/16))
467467
"""
468-
m = [p[0]] # a sorted union of p and q
469-
mpc = [p_c[0]] # centers from p_c corresponding to m
470-
mqc = [q_c[0]] # centers from q_c corresponding to m
468+
m = [p[0]] # a sorted union of p and q
469+
mpc = [p_c[0]] # centers from p_c corresponding to m
470+
mqc = [q_c[0]] # centers from q_c corresponding to m
471471

472472
i = 1
473473
j = 1

0 commit comments

Comments
 (0)