Skip to content
This repository has been archived by the owner on Feb 1, 2023. It is now read-only.

Commit

Permalink
fix and activate W291 (trailing whitespace) in linter
Browse files Browse the repository at this point in the history
  • Loading branch information
fchapoton committed Nov 24, 2022
1 parent 84f02af commit 68cef16
Show file tree
Hide file tree
Showing 31 changed files with 89 additions and 83 deletions.
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"python.linting.enabled": true,
// The following pycodestyle arguments are the same as the pycodestyle-minimal
// tox environnment, see the file SAGE_ROOT/src/tox.ini
"python.linting.pycodestyleArgs": ["--select=E111,E306,E401,E701,E702,E703,W391,W605,E711,E712,E713,E721,E722"],
"python.linting.pycodestyleArgs": ["--select=E111,E306,E401,E701,E702,E703,W291,W391,W605,E711,E712,E713,E721,E722"],
"cSpell.words": [
"furo",
"Conda",
Expand Down
2 changes: 1 addition & 1 deletion src/conftest_inputtest.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
def something():
""" a doctest in a docstring
EXAMPLES::
sage: something()
Expand Down
2 changes: 1 addition & 1 deletion src/sage/combinat/diagram.py
Original file line number Diff line number Diff line change
Expand Up @@ -856,7 +856,7 @@ def peelable_tableaux(self):
For a fixed northwest diagram `D`, we say that a Young tableau `T` is
`D`-peelable if:
1. the row indices of the cells in the first column of `D` are
the entries in an initial segment in the first column of `T` and
2. the tableau `Q` obtained by removing those cells from `T` and playing
Expand Down
2 changes: 1 addition & 1 deletion src/sage/combinat/matrices/hadamard_matrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,7 @@ def hadamard_matrix(n,existence=False, check=True):
return True
M = skew_hadamard_matrix(n, check=False)
elif regular_symmetric_hadamard_matrix_with_constant_diagonal(n, 1, existence=True) is True:
if existence:
if existence:
return True
M = regular_symmetric_hadamard_matrix_with_constant_diagonal(n, 1)
else:
Expand Down
4 changes: 2 additions & 2 deletions src/sage/geometry/hyperplane_arrangement/plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,9 @@
sage: a.plot(hyperplane_labels=True,label_colors=['red','green','black']) # optional - sage.plot
Graphics3d Object
"""

from copy import copy
from colorsys import hsv_to_rgb

from sage.misc.lazy_import import lazy_import
lazy_import("sage.plot.plot3d.parametric_plot3d", "parametric_plot3d")
lazy_import("sage.plot.plot3d.shapes2", "text3d")
Expand All @@ -119,7 +119,7 @@

def plot(hyperplane_arrangement, **kwds):
r"""
Return a plot of the hyperplane arrangement.
Return a plot of the hyperplane arrangement.
If the arrangement is in 4 dimensions but inessential, a plot of
the essentialization is returned.
Expand Down
42 changes: 21 additions & 21 deletions src/sage/geometry/ribbon_graph.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
r"""
Ribbon Graphs
This file implements objects called *ribbon graphs*. These are graphs
together with a cyclic ordering of the darts adjacent to each
vertex. This data allows us to unambiguously "thicken" the ribbon
This file implements objects called *ribbon graphs*. These are graphs
together with a cyclic ordering of the darts adjacent to each
vertex. This data allows us to unambiguously "thicken" the ribbon
graph to an orientable surface with boundary. Also, every orientable
surface with non-empty boundary is the thickening of a ribbon graph.
Expand Down Expand Up @@ -103,10 +103,10 @@ class RibbonGraph(SageObject, UniqueRepresentation):
**Brief introduction**
Let `\Sigma` be an orientable surface with non-empty boundary and let
`\Gamma` be the topological realization of a graph that is embedded in
Let `\Sigma` be an orientable surface with non-empty boundary and let
`\Gamma` be the topological realization of a graph that is embedded in
`\Sigma` in such a way that the graph is a strong deformation retract of
the surface.
the surface.
Let `v(\Gamma)` be the set of vertices of `\Gamma`, suppose that these
are white vertices. Now we mark black vertices in an interior point
Expand All @@ -121,7 +121,7 @@ class RibbonGraph(SageObject, UniqueRepresentation):
`\Gamma` and suppose that we enumerate the set `D(\Gamma)` and that it
has `n` elements.
With the orientation of the surface and the embedding of the graph in
With the orientation of the surface and the embedding of the graph in
the surface we can produce two permutations:
- A permutation that we denote by `\sigma`. This permutation is a
Expand All @@ -139,13 +139,13 @@ class RibbonGraph(SageObject, UniqueRepresentation):
.. RUBRIC:: Abstract definition
Consider a graph `\Gamma` (not a priori embedded in any surface).
Now we can again consider one vertex in the interior of each edge
Consider a graph `\Gamma` (not a priori embedded in any surface).
Now we can again consider one vertex in the interior of each edge
splitting each edge in two darts. We label the darts with numbers.
We say that a ribbon structure on `\Gamma` is a set of two
We say that a ribbon structure on `\Gamma` is a set of two
permutations `(\sigma, \rho)`. Where `\sigma` is formed by as many
disjoint cycles as vertices had `\Gamma`. And each cycle is a
disjoint cycles as vertices had `\Gamma`. And each cycle is a
cyclic ordering of the darts adjacent to a vertex. The permutation
`\rho` just tell us which two darts belong to the same edge.
Expand Down Expand Up @@ -210,7 +210,7 @@ class RibbonGraph(SageObject, UniqueRepresentation):
sage: R2.sigma()
(1,3,5,8)(2,4,6)
This example is constructed by taking the bipartite graph of
This example is constructed by taking the bipartite graph of
type `(3,3)`::
sage: s3 = PermutationGroupElement('(1,2,3)(4,5,6)(7,8,9)(10,11,12)(13,14,15)(16,17,18)')
Expand Down Expand Up @@ -384,7 +384,7 @@ def number_boundaries(self):
sage: R1.number_boundaries()
1
This example is constructed by taking the bipartite graph of
This example is constructed by taking the bipartite graph of
type `(3,3)`::
sage: s2 = PermutationGroupElement('(1,2,3)(4,5,6)(7,8,9)(10,11,12)(13,14,15)(16,17,18)')
Expand All @@ -409,7 +409,7 @@ def contract_edge(self, k):
INPUT:
- ``k`` -- non-negative integer; the position in `\rho` of the
- ``k`` -- non-negative integer; the position in `\rho` of the
transposition that is going to be contracted
OUTPUT:
Expand Down Expand Up @@ -441,7 +441,7 @@ def contract_edge(self, k):
ValueError: the edge is a loop and cannot be contracted
In this example, we consider a graph that has one edge ``(19,20)``
such that one of its ends is a vertex of valency 1. This is
such that one of its ends is a vertex of valency 1. This is
the vertex ``(20)`` that is not specified when defining `\sigma`.
We contract precisely this edge and get a ribbon graph with no
vertices of valency 1::
Expand Down Expand Up @@ -514,7 +514,7 @@ def extrude_edge(self, vertex, dart1, dart2):
OUTPUT:
A ribbon graph resulting from extruding a new edge that
A ribbon graph resulting from extruding a new edge that
pulls from ``vertex`` a new vertex that is, now, adjacent
to all the darts from ``dart1``to ``dart2`` (not including
``dart2``) in the cyclic ordering given by the cycle corresponding
Expand Down Expand Up @@ -553,7 +553,7 @@ def extrude_edge(self, vertex, dart1, dart2):
(1,2)(3,4)(5,6)(7,8)
In the following example we first extrude one edge from a vertex
of valency 3 generating a new vertex of valency 2. Then we
of valency 3 generating a new vertex of valency 2. Then we
extrude a new edge from this vertex of valency 2::
sage: s1 = PermutationGroupElement('(1,3,5)(2,4,6)')
Expand Down Expand Up @@ -674,7 +674,7 @@ def boundary(self):
OUTPUT:
A list of lists. The number of inner lists is the number of
A list of lists. The number of inner lists is the number of
boundary components of the surface. Each list in the list
consists of an ordered tuple of numbers, each number comes
from the number assigned to the corresponding dart before
Expand Down Expand Up @@ -878,7 +878,7 @@ def make_generic(self):

def homology_basis(self):
r"""
Return an oriented basis of the first homology group of the
Return an oriented basis of the first homology group of the
graph.
OUTPUT:
Expand Down Expand Up @@ -1098,8 +1098,8 @@ def make_ribbon(g, r):
OUTPUT:
- a ribbon graph that has 2 vertices (two non-trivial cycles
in its sigma permutation) of valency `2g + r` and it has
- a ribbon graph that has 2 vertices (two non-trivial cycles
in its sigma permutation) of valency `2g + r` and it has
`2g + r` edges (and hence `4g + 2r` darts)
EXAMPLES::
Expand Down
2 changes: 1 addition & 1 deletion src/sage/geometry/triangulation/point_configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -1865,7 +1865,7 @@ def contained_simplex(self, large=True, initial_point=None, point_order=None):
sage: pc.contained_simplex()
(P(-1, -1), P(1, 1), P(0, 1))
sage: pc.contained_simplex(point_order = [pc[1],pc[3],pc[4],pc[2],pc[0]])
(P(0, 1), P(1, 1), P(-1, -1))
(P(0, 1), P(1, 1), P(-1, -1))
Lower-dimensional example::
Expand Down
35 changes: 17 additions & 18 deletions src/sage/libs/eclib/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -731,20 +731,20 @@ class mwrank_MordellWeil(SageObject):
Reducing saturation bound from given value 20 to computed index bound 3
Tamagawa index primes are [ 2 ]
Checking saturation at [ 2 3 ]
Checking 2-saturation
Checking 2-saturation
Points were proved 2-saturated (max q used = 7)
Checking 3-saturation
Checking 3-saturation
Points were proved 3-saturated (max q used = 7)
done
P2 = [-2:3:1] is generator number 2
saturating up to 20...Saturation index bound (for points of good reduction) = 4
Reducing saturation bound from given value 20 to computed index bound 4
Tamagawa index primes are [ 2 ]
Checking saturation at [ 2 3 ]
Checking 2-saturation
Checking 2-saturation
possible kernel vector = [1,1]
This point may be in 2E(Q): [14:-52:1]
...and it is!
...and it is!
Replacing old generator #1 with new generator [1:-1:1]
Reducing index bound from 4 to 2
Points have successfully been 2-saturated (max q used = 7)
Expand All @@ -756,9 +756,9 @@ class mwrank_MordellWeil(SageObject):
Reducing saturation bound from given value 20 to computed index bound 3
Tamagawa index primes are [ 2 ]
Checking saturation at [ 2 3 ]
Checking 2-saturation
Checking 2-saturation
Points were proved 2-saturated (max q used = 11)
Checking 3-saturation
Checking 3-saturation
Points were proved 3-saturated (max q used = 13)
done, index = 1.
P4 = [-1:3:1] = -1*P1 + -1*P2 + -1*P3 (mod torsion)
Expand Down Expand Up @@ -911,10 +911,10 @@ def process(self, v, saturation_bound=0):
The resulting points may not be p-saturated for p between this and the computed index bound 93
Tamagawa index primes are [ 2 ]
Checking saturation at [ 2 ]
Checking 2-saturation
Checking 2-saturation
possible kernel vector = [1,0,0]
This point may be in 2E(Q): [1547:-2967:343]
...and it is!
...and it is!
Replacing old generator #1 with new generator [-2:3:1]
Reducing index bound from 93 to 46
Points have successfully been 2-saturated (max q used = 11)
Expand All @@ -933,12 +933,12 @@ def process(self, v, saturation_bound=0):
The resulting points may not be p-saturated for p between this and the computed index bound 46
Tamagawa index primes are [ 2 ]
Checking saturation at [ 2 3 ]
Checking 2-saturation
Checking 2-saturation
Points were proved 2-saturated (max q used = 11)
Checking 3-saturation
Checking 3-saturation
possible kernel vector = [0,1,0]
This point may be in 3E(Q): [2707496766203306:864581029138191:2969715140223272]
...and it is!
...and it is!
Replacing old generator #2 with new generator [-14:25:8]
Reducing index bound from 46 to 15
Points have successfully been 3-saturated (max q used = 13)
Expand All @@ -957,14 +957,14 @@ def process(self, v, saturation_bound=0):
The resulting points may not be p-saturated for p between this and the computed index bound 15
Tamagawa index primes are [ 2 ]
Checking saturation at [ 2 3 5 ]
Checking 2-saturation
Checking 2-saturation
Points were proved 2-saturated (max q used = 11)
Checking 3-saturation
Checking 3-saturation
Points were proved 3-saturated (max q used = 13)
Checking 5-saturation
Checking 5-saturation
possible kernel vector = [0,0,1]
This point may be in 5E(Q): [-13422227300:-49322830557:12167000000]
...and it is!
...and it is!
Replacing old generator #3 with new generator [1:-1:1]
Reducing index bound from 15 to 3
Points have successfully been 5-saturated (max q used = 71)
Expand All @@ -981,9 +981,9 @@ def process(self, v, saturation_bound=0):
saturating basis...Saturation index bound (for points of good reduction) = 3
Tamagawa index primes are [ 2 ]
Checking saturation at [ 2 3 ]
Checking 2-saturation
Checking 2-saturation
Points were proved 2-saturated (max q used = 11)
Checking 3-saturation
Checking 3-saturation
Points were proved 3-saturated (max q used = 13)
done
(True, 1, '[ ]')
Expand Down Expand Up @@ -1329,6 +1329,5 @@ def points(self):
P4 = [12:35:27] = 1*P1 + -1*P2 + -1*P3 (mod torsion)
sage: EQ.points()
[[1, -1, 1], [-2, 3, 1], [-14, 25, 8]]
"""
return self.__mw.getbasis()
2 changes: 1 addition & 1 deletion src/sage/libs/pari/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -1767,7 +1767,7 @@
sage: eta1 = e.elleta(precision=150)[0]
sage: eta1.sage()
3.605463601432652085915820564207726774810268996598024745444380641429820491740 # 64-bit
3.60546360143265208591582056420772677481026899659802474544 # 32-bit
3.60546360143265208591582056420772677481026899659802474544 # 32-bit
sage: from cypari2 import Pari
sage: pari = Pari()
Expand Down
2 changes: 1 addition & 1 deletion src/sage/logic/logic.py
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ def combine(self, statement1, statement2):
'CPAREN',
'CPAREN'],
{'a': 'False', 'b': 'False'},
['a', 'b', 'b']]
['a', 'b', 'b']]
"""
toks = ['OPAREN'] + statement1[0] + ['OR'] + statement2[0] + ['CPAREN']
variables = dict(statement1[1])
Expand Down
3 changes: 2 additions & 1 deletion src/sage/manifolds/catalog.py
Original file line number Diff line number Diff line change
Expand Up @@ -262,11 +262,12 @@ def Torus(R=2, r=1, names=None):
M.induced_metric()
return M


def RealProjectiveSpace(dim=2):
r"""
Generate projective space of dimension ``dim`` over the reals.
This is the topological space of lines through the origin in
This is the topological space of lines through the origin in
`\RR^{d+1}`. The standard atlas consists of `d+2` charts, which sends
the set `U_i = \{[x_1, x_2, \ldots, x_{d+1}] : x_i \neq 0 \}` to
`k^{d}` by dividing by `x_i` and omitting the `i`th coordinate
Expand Down
2 changes: 1 addition & 1 deletion src/sage/manifolds/differentiable/manifold.py
Original file line number Diff line number Diff line change
Expand Up @@ -3957,7 +3957,7 @@ def affine_connection(self, name, latex_name=None):
AffineConnection
return AffineConnection(self, name, latex_name)

def metric(self, name: str, signature: Optional[int] = None,
def metric(self, name: str, signature: Optional[int] = None,
latex_name: Optional[str] = None,
dest_map: Optional[DiffMap] = None) -> PseudoRiemannianMetric:
r"""
Expand Down
2 changes: 1 addition & 1 deletion src/sage/manifolds/differentiable/symplectic_form.py
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,7 @@ def poisson_bracket(

def volume_form(self, contra: int = 0) -> TensorField:
r"""
Liouville volume form `\frac{1}{n!}\omega^n` associated with the
Liouville volume form `\frac{1}{n!}\omega^n` associated with the
symplectic form `\omega`, where `2n` is the dimension of the manifold.
INPUT:
Expand Down
2 changes: 1 addition & 1 deletion src/sage/modular/abvar/homspace.py
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ def __call__(self, M, **kwds):
elif M.domain() == self.domain() and M.codomain() == self.codomain():
M = M.matrix()
else:
raise ValueError("cannot convert %s into %s" % (M, self))
raise ValueError("cannot convert %s into %s" % (M, self))
elif is_Matrix(M):
if M.base_ring() != ZZ:
M = M.change_ring(ZZ)
Expand Down
8 changes: 4 additions & 4 deletions src/sage/monoids/free_monoid_element.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ def _latex_(self):
\alpha b
sage: latex(b*alpha)
b \alpha
sage: "%s"%latex(alpha*b)
sage: "%s" % latex(alpha*b)
'\\alpha b'
"""
s = ""
Expand All @@ -159,10 +159,10 @@ def _latex_(self):
g = x[int(v[i][0])]
e = v[i][1]
if e == 1:
s += "%s "%(g,)
s += "%s " % (g,)
else:
s += "%s^{%s}"%(g,e)
s = s.rstrip(" ") # strip the trailing whitespace caused by adding a space after each element name
s += "%s^{%s}" % (g, e)
s = s.rstrip(" ") # strip the trailing whitespace caused by adding a space after each element name
if len(s) == 0:
s = "1"
return s
Expand Down
Loading

0 comments on commit 68cef16

Please sign in to comment.