Skip to content

Commit 81d63c1

Browse files
author
Release Manager
committed
Trac #34677: fix most W2 and W3 in geometry, rings, schemes
only on .py files for now another little step on the way towards activating W2 and W3 checks in the linter made using {{{ autopep8 -i -r --select=W2,W3 src/sage/geometry/ }}} and the same for rings/ and schemes/ URL: https://trac.sagemath.org/34677 Reported by: chapoton Ticket author(s): Frédéric Chapoton Reviewer(s): Matthias Koeppe
2 parents cfbbce0 + d531fb3 commit 81d63c1

File tree

18 files changed

+52
-52
lines changed

18 files changed

+52
-52
lines changed

src/sage/geometry/hyperplane_arrangement/affine_subspace.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ def __hash__(self):
131131
"""
132132
# note that the point is not canonically chosen, but the linear part is
133133
return hash(self._linear_part)
134-
134+
135135
def _repr_(self):
136136
r"""
137137
String representation for an :class:`AffineSubspace`.

src/sage/geometry/hyperplane_arrangement/check_freeness.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ def next_step(indices, prev, T):
120120
ret = next_step(I, Y, U)
121121
if ret is not None:
122122
return [prev] + ret
123-
return None
123+
return None
124124

125125
T = matrix.identity(S, r)
126126
for i in indices:

src/sage/geometry/hyperplane_arrangement/plot.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -410,7 +410,7 @@ def plot_hyperplane(hyperplane, **kwds):
410410
# the extra keywords have now been handled
411411
# now create the plot
412412
if hyperplane.dimension() == 0: # a point on a line
413-
x, = hyperplane.A()
413+
x, = hyperplane.A()
414414
d = hyperplane.b()
415415
p = point((d/x,0), size=pt_size, **kwds)
416416
if has_hyp_label:
@@ -456,7 +456,7 @@ def plot_hyperplane(hyperplane, **kwds):
456456
s0, s1 = -3, 3
457457
t0, t1 = -3, 3
458458
p = parametric_plot3d(pnt+s*w[0]+t*w[1], (s,s0,s1), (t,t0,t1), **kwds)
459-
if has_hyp_label:
459+
if has_hyp_label:
460460
if has_offset:
461461
b0, b1, b2 = label_offset
462462
else:
@@ -518,7 +518,7 @@ def legend_3d(hyperplane_arrangement, hyperplane_colors, length):
518518
for i in range(N):
519519
p += line([(0,0),(0,0)], color=hyperplane_colors[i], thickness=8,
520520
legend_label=labels[i], axes=False)
521-
p.set_legend_options(title='Hyperplanes', loc='center', labelspacing=0.4,
521+
p.set_legend_options(title='Hyperplanes', loc='center', labelspacing=0.4,
522522
fancybox=True, font_size='x-large', ncol=2)
523523
p.legend(True)
524524
return p

src/sage/geometry/ribbon_graph.py

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -460,16 +460,16 @@ def contract_edge(self, k):
460460
#the following two lines convert the list of tuples to list of lists
461461
aux_sigma = [list(x) for x in self._sigma.cycle_tuples(singletons=True)]
462462
aux_rho = [list(x) for x in self._rho.cycle_tuples()]
463-
#The following ''if'' rules out the cases when we would be
464-
#contracting a loop (which is not admissible since we would
463+
#The following ''if'' rules out the cases when we would be
464+
#contracting a loop (which is not admissible since we would
465465
#lose the topological type of the graph).
466-
if (_find(aux_sigma, aux_rho[k][0])[0] ==
466+
if (_find(aux_sigma, aux_rho[k][0])[0] ==
467467
_find(aux_sigma, aux_rho[k][1])[0]):
468468
raise ValueError("the edge is a loop and cannot be contracted")
469469
#We store in auxiliary variables the positions of the vertices
470470
#that are the ends of the edge to be contracted and we delete
471471
#from them the darts corresponding to the edge that is going
472-
#to be contracted. We also delete the contracted edge
472+
#to be contracted. We also delete the contracted edge
473473
#from aux_rho
474474
pos1 = _find(aux_sigma, aux_rho[k][0])
475475
pos2 = _find(aux_sigma, aux_rho[k][1])
@@ -582,7 +582,7 @@ def extrude_edge(self, vertex, dart1, dart2):
582582
for val in val_one:
583583
repr_sigma += [[val]]
584584

585-
# We find which is the highest value a dart has, in order to
585+
# We find which is the highest value a dart has, in order to
586586
# add new darts that do not conflict with previous ones.
587587
k = max(darts_rho)
588588

@@ -627,7 +627,7 @@ def genus(self):
627627
"""
628628
#We now use the same procedure as in _repr_ to get the vertices
629629
#of valency 1 and distinguish them from the extra singletons of
630-
#the permutation sigma.
630+
#the permutation sigma.
631631
repr_sigma = [list(x) for x in self._sigma.cycle_tuples()]
632632
repr_rho = [list(x) for x in self._rho.cycle_tuples()]
633633
darts_rho = flatten(repr_rho)
@@ -637,10 +637,10 @@ def genus(self):
637637
#the total number of vertices of sigma is its number of cycles
638638
#of length >1 plus the number of singletons that are actually
639639
#vertices of valency 1
640-
640+
641641
vertices = len(self._sigma.cycle_tuples()) + len(val_one)
642642
edges = len(self._rho.cycle_tuples())
643-
#formula for the genus using that the thickening is homotopically
643+
#formula for the genus using that the thickening is homotopically
644644
#equivalent to the graph
645645
g = (-vertices + edges - self.number_boundaries() + 2) // 2
646646

@@ -720,13 +720,13 @@ def boundary(self):
720720
bound = []
721721

722722
#since lists of tuples are not modifiable, we change the data to a
723-
#list of lists
723+
#list of lists
724724
aux_perm = (self._rho * self._sigma).cycle_tuples(singletons=True)
725725

726-
#the cycles of the permutation rho*sigma are in 1:1 correspondence with
726+
#the cycles of the permutation rho*sigma are in 1:1 correspondence with
727727
#the boundary components of the thickening (see function number_boundaries())
728728
#but they are not the labeled boundary components.
729-
#With the next for, we convert the cycles of rho*sigma to actually
729+
#With the next for, we convert the cycles of rho*sigma to actually
730730
#the labelling of the edges. Each edge, therefore, should appear twice
731731

732732
for i,p in enumerate(aux_perm):
@@ -799,16 +799,16 @@ def reduced(self):
799799
aux_sigma = [list(x) for x in aux_ribbon._sigma.cycle_tuples(singletons=True)]
800800
aux_rho = [list(x) for x in aux_ribbon._rho.cycle_tuples()]
801801
for j in range(len(aux_rho)):
802-
if (_find(aux_sigma, aux_rho[j][0])[0] !=
802+
if (_find(aux_sigma, aux_rho[j][0])[0] !=
803803
_find(aux_sigma, aux_rho[j][1])[0]):
804804
aux_ribbon = aux_ribbon.contract_edge(j)
805-
aux_rho = [list(x) for
805+
aux_rho = [list(x) for
806806
x in aux_ribbon._rho.cycle_tuples()]
807807
break
808808
#finally we change the data to a list of tuples and return the
809-
#information as a ribbon graph.
809+
#information as a ribbon graph.
810810
return aux_ribbon
811-
811+
812812
#the next function computes a basis of homology, it uses
813813
#the previous function.
814814

@@ -960,15 +960,15 @@ def homology_basis(self):
960960

961961
basis = [[list(x)] for x in self.reduced()._rho.cycle_tuples()]
962962

963-
#Now we define center as the set of edges that were contracted
964-
#in reduced() this set is contractible and can be define as the
963+
#Now we define center as the set of edges that were contracted
964+
#in reduced() this set is contractible and can be define as the
965965
#complement of reduced_rho in rho
966966

967-
center = [list(x) for x in self._rho.cycle_tuples()
967+
center = [list(x) for x in self._rho.cycle_tuples()
968968
if (x not in self.reduced()._rho.cycle_tuples())]
969969

970970
#We define an auxiliary list 'vertices' that will contain the
971-
#vertices (cycles of sigma) corresponding to each half edge.
971+
#vertices (cycles of sigma) corresponding to each half edge.
972972

973973
vertices = []
974974

@@ -1013,7 +1013,7 @@ def homology_basis(self):
10131013
basis[i][j][0], basis[i][j][1] = \
10141014
basis[i][j][1], basis[i][j][0]
10151015

1016-
#the variable basis is a LIST of Lists of lists. Each List
1016+
#the variable basis is a LIST of Lists of lists. Each List
10171017
#corresponds to an element of the basis and each list in a List
10181018
#is just a 2-tuple which corresponds to an ''ordered'' edge of rho.
10191019

@@ -1056,7 +1056,7 @@ def normalize(self):
10561056
darts_rho = flatten(aux_rho)
10571057
darts_sigma = flatten(aux_sigma)
10581058
val_one = [x for x in darts_rho if x not in darts_sigma]
1059-
1059+
10601060
#We add them to aux_sigma
10611061
for i in range(len(val_one)):
10621062
aux_sigma += [[val_one[i]]]
@@ -1147,7 +1147,7 @@ def make_ribbon(g, r):
11471147
repr_sigma[1].append(i+(2*g+2)+1)
11481148
repr_rho += [[i+2,i+(2*g+2)+1]]
11491149

1150-
#finally we add an edge for each additional boundary component.
1150+
#finally we add an edge for each additional boundary component.
11511151
max_dart = 4*g+2
11521152
for j in range(r-1):
11531153
repr_sigma[0].insert(0, max_dart+2*(j+1)-1)

src/sage/geometry/triangulation/point_configuration.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1899,7 +1899,7 @@ def contained_simplex(self, large=True, initial_point=None, point_order=None):
18991899
# PointConfiguration are actually ignored.
19001900
if not points:
19011901
return tuple()
1902-
1902+
19031903
if initial_point is None:
19041904
origin = points.pop()
19051905
else:
@@ -2005,7 +2005,7 @@ def facets_of_simplex(simplex):
20052005

20062006
# input verification
20072007
self._assert_is_affine()
2008-
2008+
20092009
point_order_is_given = point_order is not None
20102010
if point_order is None:
20112011
point_order = list(self.points())

src/sage/rings/continued_fraction.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1018,7 +1018,7 @@ def __bool__(self):
10181018
"""
10191019
return bool(self.quotient(0)) or self.quotient(1) is not Infinity
10201020

1021-
1021+
10221022

10231023
def is_zero(self):
10241024
r"""

src/sage/rings/function_field/ideal.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1266,7 +1266,7 @@ def __bool__(self):
12661266
"""
12671267
return self._hnf.nrows() != 0
12681268

1269-
1269+
12701270

12711271
def __hash__(self):
12721272
"""

src/sage/rings/number_field/number_field.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6288,7 +6288,7 @@ def _normalize_prime_list(self, v):
62886288
v = []
62896289
elif not isinstance(v, (list, tuple)):
62906290
v = [v]
6291-
6291+
62926292
v = [ZZ(p).abs() for p in v]
62936293
v = sorted(set(v))
62946294

src/sage/rings/number_field/splitting_field.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,7 @@ def splitting_field(poly, name, map=False, degree_multiple=None, abort_degree=No
378378
abort_rel_degree = abort_degree//absolute_degree
379379
if abort_rel_degree and rel_degree_divisor > abort_rel_degree:
380380
raise SplittingFieldAbort(absolute_degree * rel_degree_divisor, degree_multiple)
381-
381+
382382
# First, factor polynomials in Lred and store the result in L
383383
verbose("SplittingData to factor: %s"%[s._repr_tuple() for s in Lred])
384384
t = cputime()

src/sage/rings/polynomial/all.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
# Quotient of polynomial ring
2323
from sage.rings.polynomial.polynomial_quotient_ring import PolynomialQuotientRing
2424
from sage.rings.polynomial.polynomial_quotient_ring_element import PolynomialQuotientRingElement
25-
25+
2626
# Univariate Polynomial Rings
2727
from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing
2828
from sage.rings.polynomial.polynomial_ring import polygen, polygens

0 commit comments

Comments
 (0)