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

Commit 801c068

Browse files
committed
fix indentation E111 in some pyx files
1 parent b21ca55 commit 801c068

22 files changed

+128
-125
lines changed

src/sage/arith/multi_modular.pyx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ cdef class MultiModularBasis_base(object):
116116
"""
117117
sig_free(self.moduli)
118118
for i in range(self.n):
119-
mpz_clear(self.partial_products[i])
119+
mpz_clear(self.partial_products[i])
120120
sig_free(self.partial_products)
121121
sig_free(self.C)
122122
mpz_clear(self.product)
@@ -487,9 +487,9 @@ cdef class MultiModularBasis_base(object):
487487
count = self.n * mpz_sizeinbase(height, 2) / mpz_sizeinbase(self.partial_products[self.n-1], 2) # an estimate
488488
count = max(min(count, self.n), 1)
489489
while count > 1 and mpz_cmp(height, self.partial_products[count-1]) < 0:
490-
count -= 1
490+
count -= 1
491491
while mpz_cmp(height, self.partial_products[count-1]) > 0:
492-
count += 1
492+
count += 1
493493

494494
return count
495495

src/sage/categories/action.pyx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ cdef class Action(Functor):
304304
return S
305305

306306
def codomain(self):
307-
return self.underlying_set()
307+
return self.underlying_set()
308308

309309
def domain(self):
310310
return self.underlying_set()
@@ -454,7 +454,7 @@ cdef class PrecomposedAction(Action):
454454
if right_precomposition is not None:
455455
rco = right_precomposition._codomain
456456
if rco is not right:
457-
right_precomposition = homset.Hom(rco, right).natural_map() * right_precomposition
457+
right_precomposition = homset.Hom(rco, right).natural_map() * right_precomposition
458458
right = right_precomposition.domain()
459459
if action._is_left:
460460
Action.__init__(self, left, US, 1)

src/sage/combinat/degree_sequences.pyx

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -441,24 +441,25 @@ cdef init(int n):
441441
return sequences
442442

443443
cdef inline add_seq():
444-
"""
445-
This function is called whenever a sequence is found.
444+
"""
445+
This function is called whenever a sequence is found.
446+
447+
Build the degree sequence corresponding to the current state of the
448+
algorithm and adds it to the sequences list.
449+
"""
450+
global sequences
451+
global N
452+
global seq
446453

447-
Build the degree sequence corresponding to the current state of the
448-
algorithm and adds it to the sequences list.
449-
"""
450-
global sequences
451-
global N
452-
global seq
454+
cdef list s = []
455+
cdef int i, j
453456

454-
cdef list s = []
455-
cdef int i, j
457+
for N > i >= 0:
458+
for 0 <= j < seq[i]:
459+
s.append(i)
456460

457-
for N > i >= 0:
458-
for 0<= j < seq[i]:
459-
s.append(i)
461+
sequences.append(s)
460462

461-
sequences.append(s)
462463

463464
cdef void enum(int k, int M):
464465
r"""

src/sage/ext/fast_callable.pyx

Lines changed: 50 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1481,55 +1481,56 @@ cdef class ExpressionChoice(Expression):
14811481
repr(self._iffalse))
14821482

14831483
cpdef _expression_binop_helper(s, o, op):
1484-
r"""
1485-
Make an Expression for (s op o). Either s or o (or both) must already
1486-
be an expression.
1487-
1488-
EXAMPLES::
1489-
1490-
sage: from sage.ext.fast_callable import _expression_binop_helper, ExpressionTreeBuilder
1491-
sage: var('x,y')
1492-
(x, y)
1493-
sage: etb = ExpressionTreeBuilder(vars=(x,y))
1494-
sage: x = etb(x)
1495-
1496-
Now x is an Expression, but y is not. Still, all the following
1497-
cases work::
1498-
1499-
sage: _expression_binop_helper(x, x, operator.add)
1500-
add(v_0, v_0)
1501-
sage: _expression_binop_helper(x, y, operator.add)
1502-
add(v_0, v_1)
1503-
sage: _expression_binop_helper(y, x, operator.add)
1504-
add(v_1, v_0)
1505-
1506-
"""
1507-
# The Cython way of handling operator overloading on cdef classes
1508-
# (which is inherited from Python) is quite annoying. Inside the
1509-
# code for a binary operator, you know that either the first or
1510-
# second argument (or both) is a member of your class, but you
1511-
# don't know which.
1512-
1513-
# If there is an arithmetic operator between an Expression and
1514-
# a non-Expression, I want to convert the non-Expression into
1515-
# an Expression. But to do that, I need the ExpressionTreeBuilder
1516-
# from the Expression.
1517-
1518-
cdef Expression self
1519-
cdef Expression other
1520-
1521-
if not isinstance(o, Expression):
1522-
self = s
1523-
other = self._etb(o)
1524-
elif not isinstance(s, Expression):
1525-
other = o
1526-
self = other._etb(s)
1527-
else:
1528-
self = s
1529-
other = o
1530-
assert self._etb is other._etb
1531-
1532-
return ExpressionCall(self._etb, op, [self, other])
1484+
r"""
1485+
Make an Expression for (s op o). Either s or o (or both) must already
1486+
be an expression.
1487+
1488+
EXAMPLES::
1489+
1490+
sage: from sage.ext.fast_callable import _expression_binop_helper, ExpressionTreeBuilder
1491+
sage: var('x,y')
1492+
(x, y)
1493+
sage: etb = ExpressionTreeBuilder(vars=(x,y))
1494+
sage: x = etb(x)
1495+
1496+
Now x is an Expression, but y is not. Still, all the following
1497+
cases work::
1498+
1499+
sage: _expression_binop_helper(x, x, operator.add)
1500+
add(v_0, v_0)
1501+
sage: _expression_binop_helper(x, y, operator.add)
1502+
add(v_0, v_1)
1503+
sage: _expression_binop_helper(y, x, operator.add)
1504+
add(v_1, v_0)
1505+
1506+
"""
1507+
# The Cython way of handling operator overloading on cdef classes
1508+
# (which is inherited from Python) is quite annoying. Inside the
1509+
# code for a binary operator, you know that either the first or
1510+
# second argument (or both) is a member of your class, but you
1511+
# don't know which.
1512+
1513+
# If there is an arithmetic operator between an Expression and
1514+
# a non-Expression, I want to convert the non-Expression into
1515+
# an Expression. But to do that, I need the ExpressionTreeBuilder
1516+
# from the Expression.
1517+
1518+
cdef Expression self
1519+
cdef Expression other
1520+
1521+
if not isinstance(o, Expression):
1522+
self = s
1523+
other = self._etb(o)
1524+
elif not isinstance(s, Expression):
1525+
other = o
1526+
self = other._etb(s)
1527+
else:
1528+
self = s
1529+
other = o
1530+
assert self._etb is other._etb
1531+
1532+
return ExpressionCall(self._etb, op, [self, other])
1533+
15331534

15341535
class IntegerPowerFunction(object):
15351536
r"""

src/sage/graphs/bliss.pyx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -861,15 +861,16 @@ cdef Graph *bliss_graph(G, partition, vert2int, int2vert):
861861
vert2int[v] = i
862862
int2vert[i] = v
863863

864-
for x,y in G.edge_iterator(labels=False):
865-
g.add_edge(vert2int[x], vert2int[y])
864+
for x, y in G.edge_iterator(labels=False):
865+
g.add_edge(vert2int[x], vert2int[y])
866866

867867
if partition:
868868
for i in range(1, len(partition)):
869869
for v in partition[i]:
870870
g.change_color(vert2int[v], i)
871871
return g
872872

873+
873874
cdef Digraph *bliss_digraph(G, partition, vert2int, int2vert):
874875
r"""
875876
Return a bliss copy of a digraph G

src/sage/graphs/distances_all_pairs.pyx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -591,7 +591,7 @@ def is_distance_regular(G, parameters=False):
591591
for u in range(n):
592592
for v in range(n):
593593
if u == v:
594-
continue
594+
continue
595595

596596
d = distance_matrix[u * n + v]
597597
if d == infinity:

src/sage/graphs/graph_coloring.pyx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1190,7 +1190,7 @@ def b_coloring(g, k, value_only=True, solver=None, verbose=0,
11901190

11911191
# a color class is used if and only if it has one b-vertex
11921192
for i in range(k):
1193-
p.add_constraint(p.sum(b[w,i] for w in g) - is_used[i], min=0, max=0)
1193+
p.add_constraint(p.sum(b[w,i] for w in g) - is_used[i], min=0, max=0)
11941194

11951195

11961196
# We want to maximize the number of used colors

src/sage/graphs/strongly_regular_db.pyx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1341,7 +1341,7 @@ def is_unitary_dual_polar(int v,int k,int l,int mu):
13411341
if p**t != q or t % 2:
13421342
return
13431343
if (r < 0 and q != -r - 1) or (s < 0 and q != -s - 1):
1344-
return
1344+
return
13451345
t //= 2
13461346
# we have correct mu, negative eigenvalue, and q=p^(2t)
13471347
if (v == (q**2*p**t + 1)*(q*p**t + 1) and

src/sage/graphs/trees.pyx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -229,9 +229,9 @@ cdef class TreeIterator:
229229
if p <= h1:
230230
h1 = p - 1
231231
if p <= r:
232-
needr = 1
232+
needr = 1
233233
elif p <= h2:
234-
needh2 = 1
234+
needh2 = 1
235235
elif l[h2 - 1] == l[h1 - 1] - 1 and n - h2 == r - h1:
236236
if p <= c:
237237
needc = 1

src/sage/interacts/library_cython.pyx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,12 @@ cpdef julia(ff_j, z, int iterations):
4040
1.0 + 3.0*I
4141
"""
4242
for i in range(iterations):
43-
z = ff_j(z)
44-
if z.abs() > 2: break
43+
z = ff_j(z)
44+
if z.abs() > 2:
45+
break
4546
return z
4647

48+
4749
cpdef mandel(ff_m, z, int iterations):
4850
"""
4951
Helper function for the Mandelbrot Fractal interact example.

0 commit comments

Comments
 (0)