Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ef0a7d5

Browse files
author
David
committed
Fixed pep8 issues in table.py and test_table.py
1 parent bb4e7d4 commit ef0a7d5

File tree

2 files changed

+20
-17
lines changed

2 files changed

+20
-17
lines changed

lib/matplotlib/table.py

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@ def set_text_props(self, **kwargs):
146146
'update the text properties with kwargs'
147147
self._text.update(kwargs)
148148

149+
149150
class ScientificCell(Cell):
150151
"""
151152
A subclass of Cell where vertical lines are ommitted.
@@ -155,10 +156,11 @@ class ScientificCell(Cell):
155156
def get_path(self):
156157
'Return a path where vertical lines are not drawn'
157158
path = Path([[0.0, 0.0], [1.0, 0.0], [1.0, 1.0], [0.0, 1.0],
158-
[0.0, 0.0]],
159-
[Path.MOVETO, Path.LINETO, Path.MOVETO, Path.LINETO,
159+
[0.0, 0.0]],
160+
[Path.MOVETO, Path.LINETO, Path.MOVETO, Path.LINETO,
160161
Path.CLOSEPOLY],
161-
readonly=True)
162+
readonly=True
163+
)
162164
return path
163165

164166

@@ -251,7 +253,7 @@ def cellType(self):
251253
@cellType.setter
252254
def cellType(self, value):
253255
if value is None:
254-
pass # Leave as previously set
256+
pass # Leave as previously set
255257
elif value in self.CELLTYPES:
256258
self._cellType = value
257259
else:
@@ -284,8 +286,8 @@ def draw(self, renderer):
284286
keys.sort()
285287
for key in keys:
286288
self._cells[key].draw(renderer)
287-
#for c in self._cells.itervalues():
288-
# c.draw(renderer)
289+
# for c in self._cells.itervalues():
290+
# c.draw(renderer)
289291
renderer.close_group('table')
290292

291293
def _get_grid_bbox(self, renderer):
@@ -311,8 +313,8 @@ def contains(self, mouseevent):
311313
# doesn't have to bind to each one individually.
312314
if self._cachedRenderer is not None:
313315
boxes = [self._cells[pos].get_window_extent(self._cachedRenderer)
314-
for pos in six.iterkeys(self._cells)
315-
if pos[0] >= 0 and pos[1] >= 0]
316+
for pos in six.iterkeys(self._cells)
317+
if pos[0] >= 0 and pos[1] >= 0]
316318
bbox = Bbox.union(boxes)
317319
return bbox.contains(mouseevent.x, mouseevent.y), {}
318320
else:
@@ -493,12 +495,12 @@ def get_celld(self):
493495

494496

495497
def table(ax,
496-
cellText=None, cellColours=None,
497-
cellLoc='right', colWidths=None,
498-
rowLabels=None, rowColours=None, rowLoc='left',
499-
colLabels=None, colColours=None, colLoc='center',
500-
loc='bottom', bbox=None, cellType=None,
501-
**kwargs):
498+
cellText=None, cellColours=None,
499+
cellLoc='right', colWidths=None,
500+
rowLabels=None, rowColours=None, rowLoc='left',
501+
colLabels=None, colColours=None, colLoc='center',
502+
loc='bottom', bbox=None, cellType=None,
503+
**kwargs):
502504
"""
503505
TABLE(cellText=None, cellColours=None,
504506
cellLoc='right', colWidths=None,

lib/matplotlib/tests/test_table.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,18 +80,19 @@ def test_label_colours():
8080
colLabels=['Header'] * dim,
8181
loc='best')
8282

83+
8384
@image_comparison(baseline_images=['table_types'],
8485
extensions=['png'])
8586
def test_table_types():
8687
fig = plt.figure()
87-
l1 = ["","t0", "t1", "t2", "t3 ", "t4", "t5", "t6"]
88+
l1 = ["", "t0", "t1", "t2", "t3 ", "t4", "t5", "t6"]
8889
l2 = ["DLI", 35, 38, 10, 22, 25, 85, 22]
8990

9091
ax1 = fig.add_subplot(4, 1, 1)
9192
ax1.plot([1, 2, 3, 4, 5, 6])
9293
ax1.table(
9394
colWidths=[0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1],
94-
cellText = [l1, l2],
95+
cellText=[l1, l2],
9596
loc="upper center",
9697
colLoc="center",
9798
rowLoc="center",
@@ -101,7 +102,7 @@ def test_table_types():
101102
ax2.plot([1, 2, 3, 4, 5, 6])
102103
ax2.table(
103104
colWidths=[0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1],
104-
cellText = [l1, l2],
105+
cellText=[l1, l2],
105106
loc="upper center",
106107
colLoc="center",
107108
rowLoc="center",

0 commit comments

Comments
 (0)