Skip to content

Commit 25a0853

Browse files
author
Release Manager
committed
gh-35165: activate W293 and E714 in pyx files <!-- ^^^^^ Please provide a concise, informative and self-explanatory title. Don't put issue numbers in there, do this in the PR body below. For example, instead of "Fixes #1234" use "Introduce new method to calculate 1+1" --> ### 📚 Description This fixes and activate the pycodestyle warnings W293: blank line contains whitespace and E714: Test for object identity should be 'is not' in all .pyx files inside src/sage <!-- Describe your changes here in detail --> <!-- Why is this change required? What problem does it solve? --> <!-- If it resolves an open issue, please link to the issue here. For example "Closes #1337" --> ### 📝 Checklist <!-- Put an `x` in all the boxes that apply. --> <!-- If your change requires a documentation PR, please link it appropriately --> <!-- If you're unsure about any of these, don't hesitate to ask. We're here to help! --> - [x] I have made sure that the title is self-explanatory and the description concisely explains the PR. - [ ] I have linked an issue or discussion. - [ ] I have created tests covering the changes. - [ ] I have updated the documentation accordingly. ### ⌛ Dependencies <!-- List all open pull requests that this PR logically depends on --> <!-- - #xyz: short description why this is a dependency - #abc: ... --> URL: #35165 Reported by: Frédéric Chapoton Reviewer(s): David Coudert
2 parents dc4930a + fe1e890 commit 25a0853

File tree

4 files changed

+11
-9
lines changed

4 files changed

+11
-9
lines changed

src/sage/graphs/graph_coloring.pyx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1498,11 +1498,11 @@ def _vizing_edge_coloring(g):
14981498
14991499
INPUT:
15001500
1501-
- ``g`` -- a graph.
1501+
- ``g`` -- a graph
15021502
15031503
OUTPUT:
15041504
1505-
- Returns a partition of the edge set into at most `\Delta + 1` matchings.
1505+
a partition of the edge set into at most `\Delta + 1` matchings
15061506
15071507
.. SEEALSO::
15081508
@@ -1512,7 +1512,7 @@ def _vizing_edge_coloring(g):
15121512
ALGORITHM:
15131513
15141514
This function's implementation is based on the algorithm described at [MG1992]_
1515-
1515+
15161516
EXAMPLES:
15171517
15181518
Coloring the edges of the Petersen Graph::

src/sage/matrix/matrix_polynomial_dense.pyx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3974,7 +3974,7 @@ cdef class Matrix_polynomial_dense(Matrix_generic_dense):
39743974
P = self.minimal_approximant_basis(orders,shifts,True,normal_form)
39753975
row_indices = []
39763976
for i in range(m):
3977-
if P[i,i].degree() + shifts[i] <= degree_bound:
3977+
if P[i, i].degree() + shifts[i] <= degree_bound:
39783978
row_indices.append(i)
39793979
return P[row_indices,:]
39803980

@@ -4000,6 +4000,6 @@ cdef class Matrix_polynomial_dense(Matrix_generic_dense):
40004000
P = self.minimal_approximant_basis(orders,shifts,False,normal_form)
40014001
column_indices = []
40024002
for j in range(n):
4003-
if P[j,j].degree() + shifts[j] <= degree_bound:
4003+
if P[j, j].degree() + shifts[j] <= degree_bound:
40044004
column_indices.append(j)
40054005
return P[:,column_indices]

src/sage/modular/hypergeometric_misc.pyx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ significantly from Cythonization.
55
from cpython cimport array
66
from cysignals.signals cimport sig_check
77

8+
89
cpdef hgm_coeffs(long long p, int f, int prec, gamma, m, int D,
910
gtable, int gtable_prec, bint use_longs):
1011
r"""
@@ -24,9 +25,9 @@ cpdef hgm_coeffs(long long p, int f, int prec, gamma, m, int D,
2425
sage: D = 1
2526
sage: hgm_coeffs(7, 1, 2, gamma, [0]*6, D, gtable, prec, False)
2627
[7, 2*7, 6*7, 7, 6, 4*7]
27-
28+
2829
Check issue from :trac:`28404`::
29-
30+
3031
sage: H = Hyp(cyclotomic=[[10,2],[1,1,1,1,1]])
3132
sage: u = H.euler_factor(2,79) # indirect doctest
3233
sage: u.reverse().is_weil_polynomial()
@@ -116,7 +117,7 @@ cpdef hgm_coeffs(long long p, int f, int prec, gamma, m, int D,
116117
if flip:
117118
gv = -gv
118119
if use_longs:
119-
w2 = gtab2[r1] # cast to long long to avoid overflow
120+
w2 = gtab2[r1] # cast to long long to avoid overflow
120121
if gv > 0:
121122
for j in range(gv):
122123
w = w * w2 % q2

src/tox.ini

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,12 +119,13 @@ description =
119119
# E721: do not compare types, use isinstance()
120120
# E722: do not use bare except, specify exception instead
121121
# W291: trailing whitespace
122+
# W293: blank line contains whitespace
122123
# W391: blank line at end of file
123124
# W605: invalid escape sequence ‘x’
124125
# See https://pycodestyle.pycqa.org/en/latest/intro.html#error-codes
125126
deps = pycodestyle
126127
commands = pycodestyle --select E111,E211,E306,E401,E701,E702,E703,W291,W391,W605,E711,E712,E713,E721,E722 {posargs:{toxinidir}/sage/}
127-
pycodestyle --select E111,E306,E401,E703,W391,W605,E712,E713,E721,E722 --filename *.pyx {posargs:{toxinidir}/sage/}
128+
pycodestyle --select E111,E306,E401,E703,W293,W391,W605,E712,E713,E714,E721,E722 --filename *.pyx {posargs:{toxinidir}/sage/}
128129
129130
[pycodestyle]
130131
max-line-length = 160

0 commit comments

Comments
 (0)