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

Skip to content

Commit 583ae91

Browse files
committed
examples: fully automated fixing of E30 pep8 errors
Signed-off-by: Thomas Hisch <[email protected]>
1 parent 26710ad commit 583ae91

File tree

111 files changed

+190
-141
lines changed

Some content is hidden

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

111 files changed

+190
-141
lines changed

examples/color/colormaps_reference.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@
5959
gradient = np.linspace(0, 1, 256)
6060
gradient = np.vstack((gradient, gradient))
6161

62+
6263
def plot_color_gradients(cmap_category, cmap_list):
6364
fig, axes = plt.subplots(nrows=nrows)
6465
fig.subplots_adjust(top=0.95, bottom=0.01, left=0.2, right=0.99)

examples/event_handling/close_event.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
from __future__ import print_function
22
import matplotlib.pyplot as plt
33

4+
45
def handle_close(evt):
56
print('Closed Figure!')
67

examples/event_handling/data_browser.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ class PointBrowser:
77
generated the point will be shown in the lower axes. Use the 'n'
88
and 'p' keys to browse through the next and previous points
99
"""
10+
1011
def __init__(self):
1112
self.lastind = 0
1213

@@ -21,7 +22,6 @@ def onpress(self, event):
2122
if event.key=='n': inc = 1
2223
else: inc = -1
2324

24-
2525
self.lastind += inc
2626
self.lastind = np.clip(self.lastind, 0, len(xs)-1)
2727
self.update()
@@ -37,7 +37,6 @@ def onpick(self, event):
3737
x = event.mouseevent.xdata
3838
y = event.mouseevent.ydata
3939

40-
4140
distances = np.hypot(x-xs[event.ind], y-ys[event.ind])
4241
indmin = distances.argmin()
4342
dataind = event.ind[indmin]

examples/event_handling/figure_axes_enter_leave.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,25 @@
55
from __future__ import print_function
66
import matplotlib.pyplot as plt
77

8+
89
def enter_axes(event):
910
print('enter_axes', event.inaxes)
1011
event.inaxes.patch.set_facecolor('yellow')
1112
event.canvas.draw()
1213

14+
1315
def leave_axes(event):
1416
print('leave_axes', event.inaxes)
1517
event.inaxes.patch.set_facecolor('white')
1618
event.canvas.draw()
1719

20+
1821
def enter_figure(event):
1922
print('enter_figure', event.canvas.figure)
2023
event.canvas.figure.patch.set_facecolor('red')
2124
event.canvas.draw()
2225

26+
2327
def leave_figure(event):
2428
print('leave_figure', event.canvas.figure)
2529
event.canvas.figure.patch.set_facecolor('grey')

examples/event_handling/idle_and_timeout.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
line2, = ax.plot(y2)
1717

1818
N = 100
19+
20+
1921
def on_idle(event):
2022
on_idle.count +=1
2123
print('idle', on_idle.count)

examples/event_handling/lasso_demo.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,11 @@
1515
from numpy import nonzero
1616
from numpy.random import rand
1717

18+
1819
class Datum(object):
1920
colorin = colorConverter.to_rgba('red')
2021
colorout = colorConverter.to_rgba('blue')
22+
2123
def __init__(self, x, y, include=False):
2224
self.x = x
2325
self.y = y

examples/event_handling/looking_glass.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
ax.plot(x, y, alpha=0.2)
1212
line, = ax.plot(x, y, alpha=1.0, clip_path=circ)
1313

14+
1415
class EventHandler:
1516
def __init__(self):
1617
fig.canvas.mpl_connect('button_press_event', self.onpress)

examples/event_handling/path_editor.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ def __init__(self, pathpatch):
6060
canvas.mpl_connect('motion_notify_event', self.motion_notify_callback)
6161
self.canvas = canvas
6262

63-
6463
def draw_callback(self, event):
6564
self.background = self.canvas.copy_from_bbox(self.ax.bbox)
6665
self.ax.draw_artist(self.pathpatch)
@@ -74,7 +73,6 @@ def pathpatch_changed(self, pathpatch):
7473
plt.Artist.update_from(self.line, pathpatch)
7574
self.line.set_visible(vis) # don't use the pathpatch visibility state
7675

77-
7876
def get_ind_under_point(self, event):
7977
'get the index of the vertex under point if within epsilon tolerance'
8078

examples/event_handling/pick_event_demo.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,6 @@ def pick_handler(event):
8484
for label in ax2.get_xticklabels(): # make the xtick labels pickable
8585
label.set_picker(True)
8686

87-
8887
def onpick1(event):
8988
if isinstance(event.artist, Line2D):
9089
thisline = event.artist
@@ -99,8 +98,6 @@ def onpick1(event):
9998
text = event.artist
10099
print('onpick1 text:', text.get_text())
101100

102-
103-
104101
fig.canvas.mpl_connect('pick_event', onpick1)
105102

106103
if 1: # picking with a custom hit test function
@@ -146,6 +143,7 @@ def onpick2(event):
146143
if 1: # picking on a scatter plot (matplotlib.collections.RegularPolyCollection)
147144

148145
x, y, c, s = rand(4, 100)
146+
149147
def onpick3(event):
150148
ind = event.ind
151149
print('onpick3 scatter:', ind, np.take(x, ind), np.take(y, ind))

examples/event_handling/pick_event_demo2.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ def onpick(event):
2323
N = len(event.ind)
2424
if not N: return True
2525

26-
2726
figi = plt.figure()
2827
for subplotnum, dataind in enumerate(event.ind):
2928
ax = figi.add_subplot(N,1,subplotnum+1)

examples/event_handling/pipong.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
2929
"""
3030

31+
3132
class Pad(object):
3233
def __init__(self, disp,x,y,type='l'):
3334
self.disp = disp
@@ -46,15 +47,18 @@ def __init__(self, disp,x,y,type='l'):
4647
else:
4748
self.signx = 1.0
4849
self.signy = -1.0
50+
4951
def contains(self, loc):
5052
return self.disp.get_bbox().contains(loc.x,loc.y)
5153

54+
5255
class Puck(object):
5356
def __init__(self, disp, pad, field):
5457
self.vmax= .2
5558
self.disp = disp
5659
self.field = field
5760
self._reset(pad)
61+
5862
def _reset(self,pad):
5963
self.x = pad.x + pad.xoffset
6064
if pad.y < 0:
@@ -66,6 +70,7 @@ def _reset(self,pad):
6670
self._speedlimit()
6771
self._slower()
6872
self._slower()
73+
6974
def update(self,pads):
7075
self.x += self.vx
7176
self.y += self.vy
@@ -91,12 +96,15 @@ def update(self,pads):
9196
self.vy -= (randn()/300.0 + 1/300.0) * np.sign(self.vy)
9297
self._speedlimit()
9398
return False
99+
94100
def _slower(self):
95101
self.vx /= 5.0
96102
self.vy /= 5.0
103+
97104
def _faster(self):
98105
self.vx *= 5.0
99106
self.vy *= 5.0
107+
100108
def _speedlimit(self):
101109
if self.vx > self.vmax:
102110
self.vx = self.vmax
@@ -108,8 +116,8 @@ def _speedlimit(self):
108116
if self.vy < -self.vmax:
109117
self.vy = -self.vmax
110118

111-
class Game(object):
112119

120+
class Game(object):
113121
def __init__(self, ax):
114122
# create the initial line
115123
self.ax = ax
@@ -196,7 +204,6 @@ def draw(self, evt):
196204
puck.disp.set_offsets([puck.x,puck.y])
197205
self.ax.draw_artist(puck.disp)
198206

199-
200207
# just redraw the axes rectangle
201208
self.canvas.blit(self.ax.bbox)
202209

examples/event_handling/poly_editor.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ def __init__(self, ax, poly):
5050
canvas.mpl_connect('motion_notify_event', self.motion_notify_callback)
5151
self.canvas = canvas
5252

53-
5453
def draw_callback(self, event):
5554
self.background = self.canvas.copy_from_bbox(self.ax.bbox)
5655
self.ax.draw_artist(self.poly)
@@ -64,7 +63,6 @@ def poly_changed(self, poly):
6463
Artist.update_from(self.line, poly)
6564
self.line.set_visible(vis) # don't use the poly visibility state
6665

67-
6866
def get_ind_under_point(self, event):
6967
'get the index of the vertex under point if within epsilon tolerance'
7068

@@ -121,7 +119,6 @@ def key_press_callback(self, event):
121119
self.line.set_data(zip(*self.poly.xy))
122120
break
123121

124-
125122
self.canvas.draw()
126123

127124
def motion_notify_callback(self, event):

examples/event_handling/resample.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import matplotlib.pyplot as plt
33
from scikits.audiolab import wavread
44

5+
56
# A class that will downsample the data and recompute when zoomed.
67
class DataDisplayDownsampler(object):
78
def __init__(self, xdata, ydata):

examples/event_handling/timers.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import numpy as np
55
from datetime import datetime
66

7+
78
def update_title(axes):
89
axes.set_title(datetime.now())
910
axes.figure.canvas.draw()

examples/event_handling/viewlims.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import matplotlib.pyplot as plt
55
from matplotlib.patches import Rectangle
66

7+
78
# We just subclass Rectangle so that it can be called with an Axes
89
# instance, causing the rectangle to update its shape to match the
910
# bounds of the Axes
@@ -12,6 +13,7 @@ def __call__(self, ax):
1213
self.set_bounds(*ax.viewLim.bounds)
1314
ax.figure.canvas.draw_idle()
1415

16+
1517
# A class that will regenerate a fractal set as we zoom in, so that you
1618
# can actually see the increasing detail. A box in the left panel will show
1719
# the area to which we are zoomed.

examples/event_handling/zoom_window.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
axsrc.scatter(x,y,s,c)
2727
axzoom.scatter(x,y,s,c)
2828

29+
2930
def onpress(event):
3031
if event.button!=1: return
3132
x,y = event.xdata, event.ydata

examples/images_contours_and_fields/pcolormesh_levels.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@
3939
plt.title('pcolormesh with levels')
4040

4141

42-
4342
plt.subplot(2, 1, 2)
4443
# contours are *point* based plots, so convert our bound into point
4544
# centers
@@ -50,4 +49,4 @@
5049
plt.title('contourf with levels')
5150

5251

53-
plt.show()
52+
plt.show()

examples/misc/contour_manual.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232
plt.title('User-specified contours')
3333

3434

35-
3635
# Multiple filled contour lines can be specified in a single list of polygon
3736
# vertices along with a list of vertex kinds (code types) as described in the
3837
# Path class. This is particularly useful for polygons with holes.
@@ -47,4 +46,4 @@
4746
plt.axis([-0.5, 3.5, -0.5, 3.5])
4847
plt.title('User specified filled contours with holes')
4948

50-
plt.show()
49+
plt.show()

examples/misc/font_indexing.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
from matplotlib.ft2font import FT2Font, KERNING_DEFAULT, KERNING_UNFITTED, KERNING_UNSCALED
99

1010

11-
1211
#fname = '/usr/share/fonts/sfd/FreeSans.ttf'
1312
fname = matplotlib.get_data_path() + '/fonts/ttf/Vera.ttf'
1413
font = FT2Font(fname)
@@ -23,7 +22,6 @@
2322
# else: print '% 4d % 4d %s %s'%(glyphind, ccode, hex(int(ccode)), name)
2423

2524

26-
2725
# make a charname to charcode and glyphind dictionary
2826
coded = {}
2927
glyphd = {}

examples/misc/multiprocess.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717
import matplotlib.pyplot as plt
1818
import gobject
1919

20-
class ProcessPlotter(object):
2120

21+
class ProcessPlotter(object):
2222
def __init__(self):
2323
self.x = []
2424
self.y = []
@@ -77,6 +77,7 @@ def plot(self, finished=False):
7777
data = np.random.random(2)
7878
send(data)
7979

80+
8081
def main():
8182
pl = NBPlot()
8283
for ii in range(10):

0 commit comments

Comments
 (0)