Skip to content

Commit 413b5d6

Browse files
author
Release Manager
committed
gh-36247: fix E228 and E225 in categories/ Fix pycodestyle warnings E228 and E225 in src/sage/categories This was scripted using autopep8 ### 📝 Checklist - [x] The title is concise, informative, and self-explanatory. - [x] The description explains in detail what this PR is about. URL: #36247 Reported by: Frédéric Chapoton Reviewer(s): David Coudert
2 parents 96d249a + b8f0598 commit 413b5d6

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+122
-122
lines changed

src/sage/categories/bimodules.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ def _repr_object_names(self):
118118
Category of bimodules over Rational Field on the left and Integer Ring on the right
119119
"""
120120
return "bimodules over %s on the left and %s on the right" \
121-
%(self._left_base_ring, self._right_base_ring)
121+
% (self._left_base_ring, self._right_base_ring)
122122

123123
def left_base_ring(self):
124124
"""

src/sage/categories/cartesian_product.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ def _repr_object_names(self):
242242
243243
"""
244244
# This method is only required for the capital `C`
245-
return "Cartesian products of %s"%(self.base_category()._repr_object_names())
245+
return "Cartesian products of %s" % (self.base_category()._repr_object_names())
246246

247247
def CartesianProducts(self):
248248
"""

src/sage/categories/category.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -629,7 +629,7 @@ def _latex_(self):
629629
sage: latex(CommutativeAdditiveSemigroups())
630630
\mathbf{CommutativeAdditiveSemigroups}
631631
"""
632-
return "\\mathbf{%s}"%self._short_name()
632+
return "\\mathbf{%s}" % self._short_name()
633633

634634
# The convention for which hash function to use should be decided at the level of UniqueRepresentation
635635
# The implementation below is bad (hash independent of the base ring)
@@ -1452,9 +1452,9 @@ def _test_category(self, **options):
14521452
from sage.categories.sets_cat import Sets
14531453
tester = self._tester(**options)
14541454
tester.assertTrue(isinstance(self.super_categories(), list),
1455-
"%s.super_categories() should return a list"%self)
1455+
"%s.super_categories() should return a list" % self)
14561456
tester.assertTrue(self.is_subcategory(Objects()),
1457-
"%s is not a subcategory of Objects()"%self)
1457+
"%s is not a subcategory of Objects()" % self)
14581458
tester.assertTrue(isinstance(self.parent_class, type))
14591459
tester.assertTrue(all(not isinstance(cat, JoinCategory) for cat in self._super_categories))
14601460
if not isinstance(self, JoinCategory):
@@ -1580,7 +1580,7 @@ def _make_named_class(self, name, method_provider, cache=False, picklable=True):
15801580
cls = self.__class__
15811581
if isinstance(cls, DynamicMetaclass):
15821582
cls = cls.__base__
1583-
class_name = "%s.%s"%(cls.__name__, name)
1583+
class_name = "%s.%s" % (cls.__name__, name)
15841584
method_provider_cls = getattr(self, method_provider, None)
15851585
if method_provider_cls is None:
15861586
# If the category provides no XXXMethods class,
@@ -1589,10 +1589,10 @@ def _make_named_class(self, name, method_provider, cache=False, picklable=True):
15891589
else:
15901590
# Otherwise, check XXXMethods
15911591
assert inspect.isclass(method_provider_cls),\
1592-
"%s.%s should be a class"%(cls.__name__, method_provider)
1592+
"%s.%s should be a class" % (cls.__name__, method_provider)
15931593
mro = inspect.getmro(method_provider_cls)
15941594
if len(mro) > 2 or (len(mro) == 2 and mro[1] is not object):
1595-
warn("%s.%s should not have a super class"%(cls.__name__, method_provider))
1595+
warn("%s.%s should not have a super class" % (cls.__name__, method_provider))
15961596
# and point the documentation to it
15971597
doccls = method_provider_cls
15981598
if picklable:

src/sage/categories/category_types.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ def _repr_object_names(self):
124124
sage: Elements(ZZ)._repr_object_names()
125125
'elements of Integer Ring'
126126
"""
127-
return "elements of %s"%self.object()
127+
return "elements of %s" % self.object()
128128

129129
def _latex_(self):
130130
r"""
@@ -135,7 +135,7 @@ def _latex_(self):
135135
sage: latex(x.category()) # indirect doctest # needs sage.modules
136136
\mathbf{Elt}_{\Bold{Q}^{3}}
137137
"""
138-
return "\\mathbf{Elt}_{%s}"%latex(self.__object)
138+
return "\\mathbf{Elt}_{%s}" % latex(self.__object)
139139

140140

141141
#############################################################
@@ -290,7 +290,7 @@ def _repr_object_names(self):
290290
name = base._repr_object_names()
291291
else:
292292
name = base
293-
return Category._repr_object_names(self) + " over %s"%name
293+
return Category._repr_object_names(self) + " over %s" % name
294294

295295
def _latex_(self):
296296
r"""
@@ -299,7 +299,7 @@ def _latex_(self):
299299
sage: latex(ModulesWithBasis(ZZ))
300300
\mathbf{ModulesWithBasis}_{\Bold{Z}}
301301
"""
302-
return "\\mathbf{%s}_{%s}"%(self._label, latex(self.__base))
302+
return "\\mathbf{%s}_{%s}" % (self._label, latex(self.__base))
303303

304304
# def construction(self):
305305
# return (self.__class__, self.__base)
@@ -555,7 +555,7 @@ def _repr_(self):
555555
sage: Ideals(IntegerRing())
556556
Category of ring ideals in Integer Ring
557557
"""
558-
return Category._repr_(self) + " in %s"%self.__ambient
558+
return Category._repr_(self) + " in %s" % self.__ambient
559559

560560
# def construction(self):
561561
# return (self.__class__, self.__ambient)

src/sage/categories/commutative_ring_ideals.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ def __init__(self, R):
4242
sage: TestSuite(CommutativeRingIdeals(ZZ)).run()
4343
"""
4444
if R not in CommutativeRings():
45-
raise TypeError("R (=%s) must be a commutative ring"%R)
45+
raise TypeError("R (=%s) must be a commutative ring" % R)
4646
Category_ideal.__init__(self, R)
4747

4848
def super_categories(self):

src/sage/categories/commutative_rings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,7 @@ def cyclotomic_cosets(self, q, cosets=None):
349349
try:
350350
~q
351351
except ZeroDivisionError:
352-
raise ValueError("%s is not invertible in %s"%(q,self))
352+
raise ValueError("%s is not invertible in %s" % (q,self))
353353

354354
if cosets is None:
355355
rest = set(self)

src/sage/categories/covariant_functorial_construction.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ def _repr_(self):
199199
sage: tensor # indirect doctest
200200
The tensor functorial construction
201201
"""
202-
return "The %s functorial construction"%self._functor_name
202+
return "The %s functorial construction" % self._functor_name
203203

204204
def __call__(self, args, **kwargs):
205205
"""
@@ -494,7 +494,7 @@ def _repr_object_names(self):
494494
sage: Semigroups().Subquotients() # indirect doctest
495495
Category of subquotients of semigroups
496496
"""
497-
return "%s of %s"%(Category._repr_object_names(self), self.base_category()._repr_object_names())
497+
return "%s of %s" % (Category._repr_object_names(self), self.base_category()._repr_object_names())
498498

499499
def _latex_(self):
500500
r"""
@@ -508,7 +508,7 @@ def _latex_(self):
508508
\mathbf{Algebras}(\mathbf{Semigroups})
509509
"""
510510
from sage.misc.latex import latex
511-
return "\\mathbf{%s}(%s)"%(self._short_name(), latex(self.base_category()))
511+
return "\\mathbf{%s}(%s)" % (self._short_name(), latex(self.base_category()))
512512

513513
class CovariantConstructionCategory(FunctorialConstructionCategory):
514514
"""

src/sage/categories/crystals.py

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -908,7 +908,7 @@ def digraph(self, subset=None, index_set=None):
908908
child = x.f(i)
909909
if child is None or child not in subset:
910910
continue
911-
d[x][child]=i
911+
d[x][child] = i
912912
G = DiGraph(d)
913913
from sage.graphs.dot2tex_utils import have_dot2tex
914914
if have_dot2tex():
@@ -1057,12 +1057,12 @@ def metapost(self, filename, thicklines=False, labels=True, scaling_factor=1.0,
10571057
c2 = int(35*tallness*scaling_factor)
10581058
c3 = int(12*scaling_factor)
10591059
c4 = int(-12*scaling_factor)
1060-
outstring = "verbatimtex\n\\magnification=600\netex\n\nbeginfig(-1);\nsx:=35; sy:=30;\n\nz1000=(%d,0);\nz1001=(%d,%d);\nz1002=(%d,%d);\nz2001=(-3,3);\nz2002=(3,3);\nz2003=(0,-3);\nz2004=(7,0);\nz2005=(0,7);\nz2006=(-7,0);\nz2007=(0,7);\n\n"%(c0,c1,c2,c3,c4)
1060+
outstring = "verbatimtex\n\\magnification=600\netex\n\nbeginfig(-1);\nsx:=35; sy:=30;\n\nz1000=(%d,0);\nz1001=(%d,%d);\nz1002=(%d,%d);\nz2001=(-3,3);\nz2002=(3,3);\nz2003=(0,-3);\nz2004=(7,0);\nz2005=(0,7);\nz2006=(-7,0);\nz2007=(0,7);\n\n" % (c0,c1,c2,c3,c4)
10611061
else:
10621062
if labels:
1063-
outstring = "verbatimtex\n\\magnification=600\netex\n\nbeginfig(-1);\n\nsx := %d;\nsy=%d;\n\nz1000=(2*sx,0);\nz1001=(-sx,sy);\nz1002=(-16,-10);\n\nz2001=(0,-3);\nz2002=(-5,3);\nz2003=(0,3);\nz2004=(5,3);\nz2005=(10,1);\nz2006=(0,10);\nz2007=(-10,1);\nz2008=(0,-8);\n\n"%(int(scaling_factor*40),int(tallness*scaling_factor*40))
1063+
outstring = "verbatimtex\n\\magnification=600\netex\n\nbeginfig(-1);\n\nsx := %d;\nsy=%d;\n\nz1000=(2*sx,0);\nz1001=(-sx,sy);\nz1002=(-16,-10);\n\nz2001=(0,-3);\nz2002=(-5,3);\nz2003=(0,3);\nz2004=(5,3);\nz2005=(10,1);\nz2006=(0,10);\nz2007=(-10,1);\nz2008=(0,-8);\n\n" % (int(scaling_factor*40),int(tallness*scaling_factor*40))
10641064
else:
1065-
outstring = "beginfig(-1);\n\nsx := %d;\nsy := %d;\n\nz1000=(2*sx,0);\nz1001=(-sx,sy);\nz1002=(-5,-5);\n\nz1003=(10,10);\n\n"%(int(scaling_factor*35),int(tallness*scaling_factor*35))
1065+
outstring = "beginfig(-1);\n\nsx := %d;\nsy := %d;\n\nz1000=(2*sx,0);\nz1001=(-sx,sy);\nz1002=(-5,-5);\n\nz1003=(10,10);\n\n" % (int(scaling_factor*35),int(tallness*scaling_factor*35))
10661066
for i in range(size):
10671067
if self.cartan_type()[0] == 'A':
10681068
[a1,a2,a3] = string_data[i]
@@ -1079,12 +1079,12 @@ def metapost(self, filename, thicklines=False, labels=True, scaling_factor=1.0,
10791079
if b1+b3 == a1+a3 and b2+b4 == a2+a4:
10801080
shift += 1
10811081
if self.cartan_type()[0] == 'A':
1082-
outstring = outstring +"z%d=%d*z1000+%d*z1001+%d*z1002;\n"%(i,a1+a3,a2,shift)
1082+
outstring = outstring + "z%d=%d*z1000+%d*z1001+%d*z1002;\n" % (i,a1+a3,a2,shift)
10831083
else:
1084-
outstring = outstring +"z%d=%d*z1000+%d*z1001+%d*z1002;\n"%(i,a1+a3,a2+a4,shift)
1084+
outstring = outstring + "z%d=%d*z1000+%d*z1001+%d*z1002;\n" % (i,a1+a3,a2+a4,shift)
10851085
outstring = outstring + "\n"
10861086
if thicklines:
1087-
outstring = outstring +"pickup pencircle scaled 2\n\n"
1087+
outstring = outstring + "pickup pencircle scaled 2\n\n"
10881088
for i in range(size):
10891089
for j in range(1,3):
10901090
dest = self.list()[i].f(j)
@@ -1096,19 +1096,19 @@ def metapost(self, filename, thicklines=False, labels=True, scaling_factor=1.0,
10961096
col = "green; "
10971097
if self.cartan_type()[0] == 'A':
10981098
[a1,a2,a3] = string_data[i] # included to facilitate hand editing of the .mp file
1099-
outstring = outstring+"draw z%d--z%d withcolor %s %% %d %d %d\n"%(i,dest,col,a1,a2,a3)
1099+
outstring = outstring+"draw z%d--z%d withcolor %s %% %d %d %d\n" % (i,dest,col,a1,a2,a3)
11001100
else:
11011101
[a1,a2,a3,a4] = string_data[i]
1102-
outstring = outstring+"draw z%d--z%d withcolor %s %% %d %d %d %d\n"%(i,dest,col,a1,a2,a3,a4)
1102+
outstring = outstring+"draw z%d--z%d withcolor %s %% %d %d %d %d\n" % (i,dest,col,a1,a2,a3,a4)
11031103
outstring += "\npickup pencircle scaled 3;\n\n"
11041104
for i in range(self.cardinality()):
11051105
if labels:
11061106
if self.cartan_type()[0] == 'A':
1107-
outstring = outstring+"pickup pencircle scaled 15;\nfill z%d+z2004..z%d+z2006..z%d+z2006..z%d+z2007..cycle withcolor white;\nlabel(btex %d etex, z%d+z2001);\nlabel(btex %d etex, z%d+z2002);\nlabel(btex %d etex, z%d+z2003);\npickup pencircle scaled .5;\ndraw z%d+z2004..z%d+z2006..z%d+z2006..z%d+z2007..cycle;\n"%(i,i,i,i,string_data[i][2],i,string_data[i][1],i,string_data[i][0],i,i,i,i,i)
1107+
outstring = outstring+"pickup pencircle scaled 15;\nfill z%d+z2004..z%d+z2006..z%d+z2006..z%d+z2007..cycle withcolor white;\nlabel(btex %d etex, z%d+z2001);\nlabel(btex %d etex, z%d+z2002);\nlabel(btex %d etex, z%d+z2003);\npickup pencircle scaled .5;\ndraw z%d+z2004..z%d+z2006..z%d+z2006..z%d+z2007..cycle;\n" % (i,i,i,i,string_data[i][2],i,string_data[i][1],i,string_data[i][0],i,i,i,i,i)
11081108
else:
1109-
outstring = outstring+"%%%d %d %d %d\npickup pencircle scaled 1;\nfill z%d+z2005..z%d+z2006..z%d+z2007..z%d+z2008..cycle withcolor white;\nlabel(btex %d etex, z%d+z2001);\nlabel(btex %d etex, z%d+z2002);\nlabel(btex %d etex, z%d+z2003);\nlabel(btex %d etex, z%d+z2004);\npickup pencircle scaled .5;\ndraw z%d+z2005..z%d+z2006..z%d+z2007..z%d+z2008..cycle;\n\n"%(string_data[i][0],string_data[i][1],string_data[i][2],string_data[i][3],i,i,i,i,string_data[i][0],i,string_data[i][1],i,string_data[i][2],i,string_data[i][3],i,i,i,i,i)
1109+
outstring = outstring+"%%%d %d %d %d\npickup pencircle scaled 1;\nfill z%d+z2005..z%d+z2006..z%d+z2007..z%d+z2008..cycle withcolor white;\nlabel(btex %d etex, z%d+z2001);\nlabel(btex %d etex, z%d+z2002);\nlabel(btex %d etex, z%d+z2003);\nlabel(btex %d etex, z%d+z2004);\npickup pencircle scaled .5;\ndraw z%d+z2005..z%d+z2006..z%d+z2007..z%d+z2008..cycle;\n\n" % (string_data[i][0],string_data[i][1],string_data[i][2],string_data[i][3],i,i,i,i,string_data[i][0],i,string_data[i][1],i,string_data[i][2],i,string_data[i][3],i,i,i,i,i)
11101110
else:
1111-
outstring += "drawdot z%d;\n"%i
1111+
outstring += "drawdot z%d;\n" % i
11121112
outstring += "\nendfig;\n\nend;\n\n"
11131113

11141114
f = open(filename, 'w')
@@ -1153,8 +1153,8 @@ def dot_tex(self):
11531153
else:
11541154
option = ""
11551155
(source, target) = (x, child)
1156-
result += " " + vertex_key(source) + " -> "+vertex_key(target)+ " [ "+option+"label = \" \", texlbl = \""+quoted_latex(i)+"\" ];\n"
1157-
result+="}"
1156+
result += " " + vertex_key(source) + " -> "+vertex_key(target) + " [ "+option+"label = \" \", texlbl = \""+quoted_latex(i)+"\" ];\n"
1157+
result += "}"
11581158
return result
11591159

11601160
def plot(self, **options):

src/sage/categories/dual.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,4 @@ def _repr_object_names(self):
3636
Category of duals of vector spaces over Rational Field
3737
"""
3838
# Just to remove the `objects`
39-
return "duals of %s"%(self.base_category()._repr_object_names())
39+
return "duals of %s" % (self.base_category()._repr_object_names())

src/sage/categories/enumerated_sets.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -742,7 +742,7 @@ def _unrank_from_iterator(self, r):
742742
for counter, u in enumerate(self):
743743
if counter == r:
744744
return u
745-
raise ValueError("the rank must be in the range from %s to %s"%(0,counter))
745+
raise ValueError("the rank must be in the range from %s to %s" % (0,counter))
746746
unrank = _unrank_from_iterator
747747

748748
def _rank_from_iterator(self, x):

0 commit comments

Comments
 (0)