Skip to content

Commit 002c38e

Browse files
author
Release Manager
committed
sagemathgh-38862: some spaces around % in pyx files adding spaces around modulo signs in some pyx files (pycodestyle E228) ### 📝 Checklist - [x] The title is concise and informative. - [x] The description explains in detail what this PR is about. - [ ] I have linked a relevant issue or discussion. - [ ] I have created tests covering the changes. - [ ] I have updated the documentation and checked the documentation preview. URL: sagemath#38862 Reported by: Frédéric Chapoton Reviewer(s): David Coudert
2 parents 2e287ac + e15036f commit 002c38e

37 files changed

+112
-111
lines changed

src/sage/coding/codecan/autgroup_can_label.pyx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ class LinearCodeAutGroupCanLabel:
223223
from sage.coding.linear_code import LinearCode, AbstractLinearCode
224224

225225
if not isinstance(C, AbstractLinearCode):
226-
raise TypeError("%s is not a linear code"%C)
226+
raise TypeError("%s is not a linear code" % C)
227227

228228
self.C = C
229229
mat = C.generator_matrix()

src/sage/combinat/rigged_configurations/rigged_partition.pyx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ cdef class RiggedPartition(SageObject):
191191

192192
from sage.combinat.rigged_configurations.rigged_configurations import RiggedConfigurations
193193
if RiggedConfigurations.options.convention == 'English':
194-
ret_string += "\\cline{2-%s} "%(1+num_cols) + latex(self.vacancy_numbers[0])
194+
ret_string += "\\cline{2-%s} " % (1+num_cols) + latex(self.vacancy_numbers[0])
195195
for i, row_len in enumerate(self._list):
196196

197197
ret_string += " &" + "\\phantom{|}&"*row_len
@@ -210,7 +210,7 @@ cdef class RiggedPartition(SageObject):
210210
ret_string += "\n\\end{array}\n}"
211211
else:
212212
for i, row_len in enumerate(reversed(self._list)):
213-
ret_string += "\\cline{2-%s} "%(1 + row_len) + latex(self.vacancy_numbers[-i-1])
213+
ret_string += "\\cline{2-%s} " % (1 + row_len) + latex(self.vacancy_numbers[-i-1])
214214
ret_string += " &" + "\\phantom{|}&"*row_len
215215

216216
if num_cols == row_len:
@@ -220,7 +220,7 @@ cdef class RiggedPartition(SageObject):
220220
ret_string += "}{l}{" + latex(self.rigging[-i-1]) + "}"
221221

222222
ret_string += " \\\\\n"
223-
ret_string += "\\cline{2-%s}\n\\end{array}\n}"%(1 + num_cols)
223+
ret_string += "\\cline{2-%s}\n\\end{array}\n}" % (1 + num_cols)
224224

225225
return ret_string
226226

@@ -645,7 +645,7 @@ cdef class RiggedPartitionTypeB(RiggedPartition):
645645
ret_string = "{\n\\begin{array}[t]{r|" + "c|"*num_cols + "l}\n"
646646

647647
if RiggedConfigurations.options.convention == 'English':
648-
ret_string += "\\cline{2-%s} "%(1+num_cols) + latex(self.vacancy_numbers[0])
648+
ret_string += "\\cline{2-%s} " % (1+num_cols) + latex(self.vacancy_numbers[0])
649649
for i, row_len in enumerate(self._list):
650650
ret_string += " &" + box_str*row_len
651651

@@ -663,7 +663,7 @@ cdef class RiggedPartitionTypeB(RiggedPartition):
663663
ret_string += "\n\\end{array}\n}"
664664
else:
665665
for i, row_len in enumerate(reversed(self._list)):
666-
ret_string += "\\cline{2-%s} "%(1 + row_len)
666+
ret_string += "\\cline{2-%s} " % (1 + row_len)
667667
ret_string += latex(self.vacancy_numbers[-i-1])
668668
ret_string += " &" + box_str*row_len
669669

@@ -674,6 +674,6 @@ cdef class RiggedPartitionTypeB(RiggedPartition):
674674
ret_string += "}{l}{" + latex(self.rigging[-i-1]) + "}"
675675

676676
ret_string += " \\\\\n"
677-
ret_string += "\\cline{2-%s}\n\\end{array}\n}"%(1 + num_cols)
677+
ret_string += "\\cline{2-%s}\n\\end{array}\n}" % (1 + num_cols)
678678

679679
return ret_string

src/sage/groups/group.pyx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ cdef class Group(Parent):
110110
if not isinstance(category, tuple):
111111
category = (category,)
112112
if not any(cat.is_subcategory(Groups()) for cat in category):
113-
raise ValueError("%s is not a subcategory of %s"%(category, Groups()))
113+
raise ValueError("%s is not a subcategory of %s" % (category, Groups()))
114114
Parent.__init__(self, base=base, category=category)
115115

116116
def is_abelian(self):

src/sage/groups/perm_gps/partn_ref/data_structures.pyx

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -145,9 +145,9 @@ def OP_represent(int n, merges, perm):
145145
print("Finding:")
146146
for i in range(n):
147147
j = OP_find(OP, i)
148-
s = "%d -> %d"%(i, j)
148+
s = "%d -> %d" % (i, j)
149149
if i == j:
150-
s += ", root: size=%d, mcr=%d, rank=%d"%\
150+
s += ", root: size=%d, mcr=%d, rank=%d" % \
151151
(OP.size[i], OP.mcr[i], OP.rank[i])
152152
print(s)
153153
print("Allocating array to test merge_perm.")
@@ -165,9 +165,9 @@ def OP_represent(int n, merges, perm):
165165
print("Finding:")
166166
for i in range(n):
167167
j = OP_find(OP, i)
168-
s = "%d -> %d"%(i, j)
168+
s = "%d -> %d" % (i, j)
169169
if i == j:
170-
s += ", root: size=%d, mcr=%d, rank=%d"%\
170+
s += ", root: size=%d, mcr=%d, rank=%d" % \
171171
(OP.size[i], OP.mcr[i], OP.rank[i])
172172
print(s)
173173
print("Deallocating OrbitPartition.")
@@ -474,7 +474,7 @@ def PS_represent(partition, splits):
474474
print(PS.entries[i], PS.levels[i], i, n)
475475
good = False
476476
if not (PS.entries[n-1] == n-1 and PS.levels[n-1] == -1):
477-
print("Failed at i = %d!"%(n-1))
477+
print("Failed at i = %d!" % (n-1))
478478
good = False
479479
if not PS.degree == n or not PS.depth == 0:
480480
print("Incorrect degree or depth!")
@@ -486,8 +486,8 @@ def PS_represent(partition, splits):
486486
print("Creating PartitionStack from partition %s." % partition)
487487
PS = PS_from_list(partition)
488488
print("PartitionStack's data:")
489-
print("entries -> %s"%[PS.entries[i] for i in range(n)])
490-
print("levels -> %s"%[PS.levels[i] for i in range(n)])
489+
print("entries -> %s" % [PS.entries[i] for i in range(n)])
490+
print("levels -> %s" % [PS.levels[i] for i in range(n)])
491491
print("depth = %d, degree = %d" % (PS.depth,PS.degree))
492492
PS_print(PS)
493493
print("Checking PS_is_discrete:")
@@ -506,7 +506,7 @@ def PS_represent(partition, splits):
506506
good = True
507507
for i in range(n):
508508
if PS.entries[i] != PS2.entries[i] or PS.levels[i] != PS2.levels[i]:
509-
print("Failed at i = %d!"%i)
509+
print("Failed at i = %d!" % i)
510510
good = False
511511
if PS.degree != PS2.degree or PS.depth != PS2.depth:
512512
print("Failure with degree or depth!")
@@ -517,7 +517,7 @@ def PS_represent(partition, splits):
517517
PS_clear(PS2)
518518
PS_print(PS2)
519519
for s in splits:
520-
print("Splitting point %d from original:"%s)
520+
print("Splitting point %d from original:" % s)
521521
print(PS_split_point(PS, s))
522522
PS_print(PS)
523523
print("Getting permutation from PS2->PS:")
@@ -528,7 +528,7 @@ def PS_represent(partition, splits):
528528
print("Finding first smallest:")
529529
bitset_init(b, n)
530530
i = PS_first_smallest(PS, b)
531-
print("Minimal element is %d, bitset is:"%i)
531+
print("Minimal element is %d, bitset is:" % i)
532532
print(bitset_string(b))
533533
bitset_free(b)
534534
print("Finding element 1:")
@@ -1187,7 +1187,7 @@ cdef bint SC_is_giant(int n, int num_perms, int *perms, float p, bitset_t suppor
11871187
# get a bit lost in the group, so our random elements are more random:
11881188
SC_identify(perm, n)
11891189
for i from 0 <= i < 10:
1190-
SC_mult_perms(perm, perm, perms + n*(rand()%num_perms), n)
1190+
SC_mult_perms(perm, perm, perms + n*(rand() % num_perms), n)
11911191

11921192
# look for elements with cycles of prime length q, m/2 < q < m-2
11931193
num_steps = <int> ceil(-log(1-p)*log(m)/log(2))
@@ -1203,7 +1203,7 @@ cdef bint SC_is_giant(int n, int num_perms, int *perms, float p, bitset_t suppor
12031203
sig_free(perm)
12041204
OP_dealloc(OP)
12051205
return True
1206-
SC_mult_perms(perm, perm, perms + n*(rand()%num_perms), n)
1206+
SC_mult_perms(perm, perm, perms + n*(rand() % num_perms), n)
12071207
OP_dealloc(OP)
12081208
sig_free(perm)
12091209
return False
@@ -1421,21 +1421,21 @@ def SC_test_list_perms(list L, int n, int limit, bint gap, bint limit_complain,
14211421
m = bitset_len(giant_support)
14221422
from sage.arith.misc import factorial
14231423
if not (order == factorial(m) or order == factorial(m)/2):
1424-
print("SC_is_giant failed: %s %s"%(str(L), order))
1424+
print("SC_is_giant failed: %s %s" % (str(L), order))
14251425
raise AssertionError
14261426
if order == factorial(n):
14271427
SC_dealloc(SC)
14281428
SC = SC_symmetric_group(n)
14291429
SC_order(SC,0,order.value)
14301430
if not order == factorial(n):
1431-
print("SC_symmetric_group failed: %s %s"%(str(L), order))
1431+
print("SC_symmetric_group failed: %s %s" % (str(L), order))
14321432
raise AssertionError
14331433
elif order == factorial(n)/2:
14341434
SC_dealloc(SC)
14351435
SC = SC_alternating_group(n)
14361436
SC_order(SC,0,order.value)
14371437
if not order == factorial(n)/2:
1438-
print("SC_alternating_group failed: %s %s"%(str(L), order))
1438+
print("SC_alternating_group failed: %s %s" % (str(L), order))
14391439
raise AssertionError
14401440
order2 = Integer(0)
14411441
SC_order(SCC,0,order2.value)
@@ -1540,8 +1540,8 @@ def SC_test_list_perms(list L, int n, int limit, bint gap, bint limit_complain,
15401540
if SC_is_giant(n, len(L), perm, 0.9, giant_support):
15411541
from sage.arith.misc import factorial
15421542
m = bitset_len(giant_support)
1543-
if order != factorial(m) and order != factorial(m)/2:
1544-
print("SC_is_giant failed: %s %s"%(str(L), order))
1543+
if order != factorial(m) and order != factorial(m)//2:
1544+
print("SC_is_giant failed: %s %s" % (str(L), order))
15451545
raise AssertionError
15461546
if order != G.order():
15471547
print("FAIL {}".format(L))
@@ -1572,13 +1572,13 @@ def SC_test_list_perms(list L, int n, int limit, bint gap, bint limit_complain,
15721572
if bool(SC_says) != bool(gap_says):
15731573
print("FAIL {}".format(L))
15741574
print('element {}'.format(permy))
1575-
print('GAP says %d, SC_contains(modify=0) says %d'%(gap_says, SC_says))
1575+
print('GAP says %d, SC_contains(modify=0) says %d' % (gap_says, SC_says))
15761576
raise AssertionError
15771577
SC_says = SC_contains(SC, 0, perm, 1)
15781578
if bool(SC_says) != bool(gap_says):
15791579
print("FAIL {}".format(L))
15801580
print('element {}'.format(permy))
1581-
print('GAP says %d, SC_contains(modify=0) says %d'%(gap_says, SC_says))
1581+
print('GAP says %d, SC_contains(modify=0) says %d' % (gap_says, SC_says))
15821582
raise AssertionError
15831583
SC_random_element(SC, 0, perm)
15841584
for j from 0 <= j < n:

src/sage/groups/perm_gps/partn_ref/refinement_python.pyx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ cdef class PythonPartitionStack:
7878
sage: P # implicit doctest
7979
PythonPartitionStack of degree 7 and depth 0.
8080
"""
81-
return "PythonPartitionStack of degree %d and depth %d."%(self.c_ps.degree, self.c_ps.depth)
81+
return "PythonPartitionStack of degree %d and depth %d." % (self.c_ps.degree, self.c_ps.depth)
8282

8383
def display(self):
8484
"""

src/sage/groups/perm_gps/permgroup_element.pyx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1126,7 +1126,7 @@ cdef class PermutationGroupElement(MultiplicativeGroupElement):
11261126
...
11271127
AssertionError: (1,3,5)(2,4,6) and [1, 2, 3, 4, 5, 6, 7] should have the same length
11281128
"""
1129-
assert len(x) == self.n, '%s and %s should have the same length'%(self, x)
1129+
assert len(x) == self.n, '%s and %s should have the same length' % (self, x)
11301130
return [ x[self.perm[i]] for i in range(self.n) ]
11311131

11321132
cpdef ClonableIntArray _act_on_array_on_position(self, ClonableIntArray x):
@@ -1146,7 +1146,7 @@ cdef class PermutationGroupElement(MultiplicativeGroupElement):
11461146
cdef int i
11471147
cdef ClonableIntArray y
11481148
cdef int l = self.n
1149-
assert x._len == l, '%s and %s should have the same length'%(self, x)
1149+
assert x._len == l, '%s and %s should have the same length' % (self, x)
11501150
y = x.clone()
11511151
for i in range(l):
11521152
y._list[i] = x._list[self.perm[i]]

src/sage/groups/semimonomial_transformations/semimonomial_transformation.pyx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -243,8 +243,8 @@ cdef class SemimonomialTransformation(MultiplicativeGroupElement):
243243
sage: SemimonomialTransformationGroup(F, 4).an_element() # indirect doctest
244244
((a, 1, 1, 1); (1,4,3,2), Ring endomorphism of Finite Field in a of size 3^2 Defn: a |--> 2*a + 1)
245245
"""
246-
return "(%s; %s, %s)"%(self.v, self.perm.cycle_string(),
247-
self.get_autom())
246+
return "(%s; %s, %s)" % (self.v, self.perm.cycle_string(),
247+
self.get_autom())
248248

249249
cpdef _richcmp_(left, _right, int op):
250250
"""

src/sage/libs/coxeter3/coxeter.pyx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -423,7 +423,8 @@ cdef class CoxGroup(SageObject):
423423
sage: W = CoxGroup(['A', 5]); W
424424
Coxeter group of type A and rank 5
425425
"""
426-
return "Coxeter group of type %s and rank %s"%(self.type(), self.rank())
426+
return "Coxeter group of type %s and rank %s" % (self.type(),
427+
self.rank())
427428

428429
def __iter__(self):
429430
"""

src/sage/libs/eclib/homspace.pyx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ cdef class ModularSymbols:
7171
sage: CremonaModularSymbols(37, cuspidal=True).__repr__()
7272
'Cremona Cuspidal Modular Symbols space of dimension 4 for Gamma_0(37) of weight 2 with sign 0'
7373
"""
74-
return "Cremona %sModular Symbols space of dimension %s for Gamma_0(%s) of weight 2 with sign %s"%(
74+
return "Cremona %sModular Symbols space of dimension %s for Gamma_0(%s) of weight 2 with sign %s" % (
7575
'Cuspidal ' if self.is_cuspidal() else '',
7676
self.dimension(), self.level(), self.sign())
7777

src/sage/libs/eclib/mat.pyx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ cdef class Matrix:
4949
[-1 1 1 -1 0]
5050
[ 0 -1 0 0 0]
5151
"""
52-
return "%s x %s Cremona matrix over Rational Field"%(self.nrows(), self.ncols())
52+
return "%s x %s Cremona matrix over Rational Field" % (self.nrows(), self.ncols())
5353

5454
def str(self):
5555
r"""

0 commit comments

Comments
 (0)