Skip to content

Commit d2a38bf

Browse files
author
Release Manager
committed
gh-36423: fix and activate E225 and E228 This is fixing (around 200 cases) and activating pycodestyle E225 and E228 in the linter ``` E228 missing whitespace around modulo operator E225 missing whitespace around operator ``` ### 📝 Checklist - [x] The title is concise, informative, and self-explanatory. - [x] The description explains in detail what this PR is about. URL: #36423 Reported by: Frédéric Chapoton Reviewer(s): Kwankyu Lee
2 parents 1071779 + e17abfc commit d2a38bf

Some content is hidden

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

50 files changed

+438
-435
lines changed

.vscode/settings.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
"python.linting.enabled": true,
2828
// The following pycodestyle arguments are the same as the pycodestyle-minimal
2929
// tox environnment, see the file SAGE_ROOT/src/tox.ini
30-
"python.linting.pycodestyleArgs": ["--select= E111,E21,E222,E227,E25,E271,E303,E305,E306,E401,E502,E701,E702,E703,E71,E72,W291,W293,W391,W605"],
30+
"python.linting.pycodestyleArgs": ["--select= E111,E21,E222,E225,E227,E228,E25,E271,E303,E305,E306,E401,E502,E701,E702,E703,E71,E72,W291,W293,W391,W605"],
3131
"cSpell.words": [
3232
"furo",
3333
"Conda",

src/sage/databases/cremona.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ def build(name, data_tgz, largest_conductor=0, mini=False, decompress=True):
120120
raise RuntimeError('Please (re)move %s before building ' % db_path
121121
+ 'database')
122122
if not os.path.exists(data_tgz):
123-
raise IOError("The data file is not at %s"%data_tgz)
123+
raise IOError("The data file is not at %s" % data_tgz)
124124
t = walltime()
125125

126126
if decompress:
@@ -246,7 +246,7 @@ def cremona_letter_code(n):
246246
return "a"
247247
s = ""
248248
while n != 0:
249-
s = chr(n%26+97) + s
249+
s = chr(n % 26+97) + s
250250
n //= 26
251251
return s
252252

@@ -287,7 +287,7 @@ def old_cremona_letter_code(n):
287287
'CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC'
288288
"""
289289
n -= 1
290-
k = n%26 + 65
290+
k = n % 26 + 65
291291
label = chr(k)*int(n//26 + 1)
292292
return label
293293

@@ -678,7 +678,7 @@ def __init__(self, name, read_only=True, build=False):
678678
return
679679
SQLDatabase.__init__(self, db_path, read_only=read_only)
680680
if self.get_skeleton() != self._expected_skeleton:
681-
raise RuntimeError('Database at %s does '%(self.__dblocation__)
681+
raise RuntimeError('Database at %s does ' % (self.__dblocation__)
682682
+ 'not appear to be a valid SQL Cremona database.')
683683

684684
def __iter__(self):

src/sage/databases/db_class_polynomials.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def _dbpath(self, disc, level=1):
3333
NotImplementedError: Level (= 2) > 1 not yet implemented
3434
"""
3535
if level != 1:
36-
raise NotImplementedError("Level (= %s) > 1 not yet implemented"%level)
36+
raise NotImplementedError("Level (= %s) > 1 not yet implemented" % level)
3737
n1 = 5000*((abs(disc)-1)//5000)
3838
s1 = disc_format % (n1+1) #_pad_int(n1+1, disc_length)
3939
s2 = disc_format % (n1+5000)

src/sage/databases/knotinfo_db.py

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -202,9 +202,9 @@ def excel(self):
202202
'knotinfo_data_complete.xls'
203203
"""
204204
if self == KnotInfoFilename.knots:
205-
return '%s.xls' %(self.value[1])
205+
return '%s.xls' % (self.value[1])
206206
else:
207-
return '%s.xlsx' %(self.value[1])
207+
return '%s.xlsx' % (self.value[1])
208208

209209
def csv(self):
210210
r"""
@@ -218,7 +218,7 @@ def csv(self):
218218
sage: ki_db.filename.knots.csv()
219219
'knotinfo_data_complete.csv'
220220
"""
221-
return '%s.csv' %(self.value[1])
221+
return '%s.csv' % (self.value[1])
222222

223223
def num_knots(self, version):
224224
r"""
@@ -232,7 +232,7 @@ def num_knots(self, version):
232232
sage: ki_db.filename.knots.num_knots('21.7')
233233
'num_knots_21.7.sobj'
234234
"""
235-
return 'num_knots_%s.sobj' %version
235+
return 'num_knots_%s.sobj' % version
236236

237237
def sobj_row(self):
238238
r"""
@@ -275,9 +275,9 @@ def sobj_data(self, column):
275275
'knotinfo_braid_notation'
276276
"""
277277
if column.column_type() == column.types.OnlyLinks:
278-
return 'linkinfo_%s' %(column.name)
278+
return 'linkinfo_%s' % (column.name)
279279
else:
280-
return 'knotinfo_%s' %(column.name)
280+
return 'knotinfo_%s' % (column.name)
281281

282282
def description_url(self, column):
283283
r"""
@@ -290,7 +290,7 @@ def description_url(self, column):
290290
sage: ki_db.filename.knots.description_url(ki_db.columns().braid_notation)
291291
'https://knotinfo.math.indiana.edu/descriptions/braid_notation.html'
292292
"""
293-
return '%sdescriptions/%s.html' %(self.url(), column.name)
293+
return '%sdescriptions/%s.html' % (self.url(), column.name)
294294

295295
def diagram_url(self, fname, single=False):
296296
r"""
@@ -306,9 +306,9 @@ def diagram_url(self, fname, single=False):
306306
'https://knotinfo.math.indiana.edu/diagrams/3_1'
307307
"""
308308
if single:
309-
return '%sdiagrams/%s' %(self.url(), fname)
309+
return '%sdiagrams/%s' % (self.url(), fname)
310310
else:
311-
return '%sdiagram_display.php?%s' %(self.url(), fname)
311+
return '%sdiagram_display.php?%s' % (self.url(), fname)
312312

313313
knots = ['https://knotinfo.math.indiana.edu/', 'knotinfo_data_complete']
314314
links = ['https://linkinfo.sitehost.iu.edu/', 'linkinfo_data_complete']
@@ -457,7 +457,7 @@ def demo_version(self):
457457
self._demo = False
458458
else:
459459
self._demo = True
460-
self._num_knots = len([v for v in row_demo_sample.values() if v[1]==1])
460+
self._num_knots = len([v for v in row_demo_sample.values() if v[1] == 1])
461461
return self._demo
462462

463463
def knot_list(self):
@@ -548,7 +548,7 @@ def _create_col_dict_sobj(self, sobj_path=None):
548548
col_type = KnotInfoColumnTypes.OnlyLinks
549549
column_dict[col] = [name, col_type]
550550

551-
save(column_dict, '%s/%s' %(sobj_path, self.filename.knots.sobj_column()))
551+
save(column_dict, '%s/%s' % (sobj_path, self.filename.knots.sobj_column()))
552552

553553
def _create_data_sobj(self, sobj_path=None):
554554
r"""
@@ -582,7 +582,7 @@ def _create_data_sobj(self, sobj_path=None):
582582
# ----------------------------------------------------------------
583583
# Columns that exist for knots and links
584584
# ----------------------------------------------------------------
585-
column_dict = load('%s/%s' %(sobj_path, self.filename.knots.sobj_column()))
585+
column_dict = load('%s/%s' % (sobj_path, self.filename.knots.sobj_column()))
586586
cols = KnotInfoColumns('ColsTemp', column_dict)
587587
for col in cols:
588588
val_list = []
@@ -608,9 +608,9 @@ def _create_data_sobj(self, sobj_path=None):
608608
val_list.append(link_list[i][col.name])
609609

610610
if val_list:
611-
save(val_list, '%s/%s' %(sobj_path, self.filename.knots.sobj_data(col)))
611+
save(val_list, '%s/%s' % (sobj_path, self.filename.knots.sobj_data(col)))
612612

613-
save(row_dict, '%s/%s' %(sobj_path, self.filename.knots.sobj_row()))
613+
save(row_dict, '%s/%s' % (sobj_path, self.filename.knots.sobj_row()))
614614

615615
@cached_method
616616
def columns(self):
@@ -652,7 +652,7 @@ def read_column_dict(self):
652652
return column_demo_sample
653653
sobj_path = self._sobj_path
654654
filename = self.filename.knots.sobj_column()
655-
return load('%s/%s' %(sobj_path, filename))
655+
return load('%s/%s' % (sobj_path, filename))
656656

657657
# -------------------------------------------------------------------------------------------------------------
658658
# read the dictionary for the row names that is the knot and link names from sobj-file
@@ -680,7 +680,7 @@ def read_row_dict(self):
680680
return row_demo_sample
681681
sobj_path = self._sobj_path
682682
filename = self.filename.knots.sobj_row()
683-
return load('%s/%s' %(sobj_path, filename))
683+
return load('%s/%s' % (sobj_path, filename))
684684

685685
# -------------------------------------------------------------------------------------------------------------
686686
# return a dictionary to obtain the original name to a row_dict key
@@ -752,7 +752,7 @@ def read(self, column):
752752
sage: ki_db = KnotInfoDataBase()
753753
"""
754754
if not isinstance(column, KnotInfoColumns):
755-
raise TypeError('column must be an instance of enum %s' %(KnotInfoColumns))
755+
raise TypeError('column must be an instance of enum %s' % (KnotInfoColumns))
756756

757757
if self.demo_version():
758758
return data_demo_sample[column]
@@ -763,8 +763,8 @@ def read(self, column):
763763
else:
764764
filename = self.filename.knots.sobj_data(column)
765765

766-
verbose('loading data library %s ...' %(filename))
767-
res = load('%s/%s' %(sobj_path, filename))
766+
verbose('loading data library %s ...' % (filename))
767+
res = load('%s/%s' % (sobj_path, filename))
768768
verbose('... finished!')
769769

770770
return res

0 commit comments

Comments
 (0)