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

Skip to content

Commit 1e822e9

Browse files
committed
fix all issues in the output of the pep8 unit test
1 parent 16e1566 commit 1e822e9

File tree

12 files changed

+29
-26
lines changed

12 files changed

+29
-26
lines changed

examples/event_handling/path_editor.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ def button_press_callback(self, event):
9292
'whenever a mouse button is pressed'
9393
if not self.showverts:
9494
return
95-
if event.inaxes == None:
95+
if event.inaxes is None:
9696
return
9797
if event.button != 1:
9898
return

examples/event_handling/poly_editor.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ def button_press_callback(self, event):
8383
'whenever a mouse button is pressed'
8484
if not self.showverts:
8585
return
86-
if event.inaxes == None:
86+
if event.inaxes is None:
8787
return
8888
if event.button != 1:
8989
return

examples/pylab_examples/broken_axis.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@
66

77

88
# 30 points between 0 0.2] originally made using np.random.rand(30)*.2
9-
pts = np.array([0.015, 0.166, 0.133, 0.159, 0.041, 0.024, 0.195,
10-
0.039, 0.161, 0.018, 0.143, 0.056, 0.125, 0.096, 0.094, 0.051,
11-
0.043, 0.021, 0.138, 0.075, 0.109, 0.195, 0.05 , 0.074, 0.079,
12-
0.155, 0.02 , 0.01 , 0.061, 0.008])
9+
pts = np.array([
10+
0.015, 0.166, 0.133, 0.159, 0.041, 0.024, 0.195, 0.039, 0.161, 0.018,
11+
0.143, 0.056, 0.125, 0.096, 0.094, 0.051, 0.043, 0.021, 0.138, 0.075,
12+
0.109, 0.195, 0.050, 0.074, 0.079, 0.155, 0.020, 0.010, 0.061, 0.008])
1313

1414
# Now let's make two outlier points which are far away from everything.
1515
pts[[3, 14]] += .8

examples/pylab_examples/data_helper.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ def get_daily_data():
3838
"""
3939
class C:
4040
pass
41+
4142
def get_ticker(ticker):
4243
vals = []
4344

examples/pylab_examples/date_demo1.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,7 @@
2525
months = MonthLocator() # every month
2626
yearsFmt = DateFormatter('%Y')
2727

28-
quotes = quotes_historical_yahoo_ochl(
29-
'INTC', date1, date2)
28+
quotes = quotes_historical_yahoo_ochl('INTC', date1, date2)
3029
if len(quotes) == 0:
3130
raise SystemExit
3231

@@ -44,7 +43,8 @@
4443

4544

4645
# format the coords message box
47-
def price(x): return '$%1.2f' % x
46+
def price(x):
47+
return '$%1.2f' % x
4848
ax.fmt_xdata = DateFormatter('%Y-%m-%d')
4949
ax.fmt_ydata = price
5050
ax.grid(True)

examples/pylab_examples/histogram_percent_demo.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ def to_percent(y, position):
1010
s = str(100 * y)
1111

1212
# The percent symbol needs escaping in latex
13-
if matplotlib.rcParams['text.usetex'] == True:
13+
if matplotlib.rcParams['text.usetex'] is True:
1414
return s + r'$\%$'
1515
else:
1616
return s + '%'

examples/pylab_examples/line_collection.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,9 @@
3232
# See matplotlib.collections.LineCollection for more information
3333
line_segments = LineCollection(segs,
3434
linewidths=(0.5, 1, 1.5, 2),
35-
colors = [colorConverter.to_rgba(i)
36-
for i in ('b', 'g', 'r', 'c', 'm', 'y', 'k')],
35+
colors=[colorConverter.to_rgba(i)
36+
for i in ('b', 'g', 'r', 'c',
37+
'm', 'y', 'k')],
3738
linestyle = 'solid')
3839
ax.add_collection(line_segments)
3940
ax.set_title('Line collection with masked arrays')

examples/user_interfaces/embedding_in_tk_canvas.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,18 @@
77
import matplotlib.backends.tkagg as tkagg
88
from matplotlib.backends.backend_agg import FigureCanvasAgg
99

10-
def draw_figure(canvas, figure, loc=[0,0]):
10+
11+
def draw_figure(canvas, figure, loc=[0, 0]):
1112
""" Draw a matplotlib figure onto a Tk canvas
12-
13+
1314
loc: location of top-left corner of figure on canvas in pixels.
1415
1516
Inspired by matplotlib source: lib/matplotlib/backends/backend_tkagg.py
1617
"""
1718
figure_canvas_agg = FigureCanvasAgg(figure)
1819
figure_canvas_agg.draw()
1920
figure_x, figure_y, figure_w, figure_h = figure.bbox.bounds
20-
figure_w, figure_h = int(figure_w), int(figure_h)
21+
figure_w, figure_h = int(figure_w), int(figure_h)
2122
photo = tk.PhotoImage(master=canvas, width=figure_w, height=figure_h)
2223

2324
# Position: convert from top-left anchor to center anchor
@@ -43,7 +44,7 @@ def draw_figure(canvas, figure, loc=[0,0]):
4344

4445
# Create the figure we desire to add to an existing canvas
4546
fig = mpl.figure.Figure(figsize=(2, 1))
46-
ax = fig.add_axes([0,0,1,1])
47+
ax = fig.add_axes([0, 0, 1, 1])
4748
ax.plot(X, Y)
4849

4950
# Keep this handle alive, or else figure will disappear

examples/user_interfaces/interactive.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ def __init__(self, on_kill=None, *args, **kw):
5454
# Check that all things to kill are callable:
5555
for _ in on_kill:
5656
if not callable(_):
57-
raise TypeError, 'on_kill must be a list of callables'
57+
raise TypeError('on_kill must be a list of callables')
5858
self.on_kill = on_kill
5959
# Set up tab-completer
6060
if has_readline:

examples/user_interfaces/interactive2.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ def write(self, text):
134134

135135
end = self.buffer.get_end_iter()
136136

137-
if not self.view == None:
137+
if self.view is not None:
138138
self.view.scroll_to_mark(self.mark, 0, True, 1, 1)
139139

140140
self.buffer.insert_with_tags(end, text, self.style)
@@ -225,7 +225,7 @@ def prompt_ps2(self):
225225

226226
def write_line(self, text, style=None):
227227
start, end = self.text.get_buffer().get_bounds()
228-
if style == None:
228+
if style is None:
229229
self.text.get_buffer().insert(end, text)
230230
else:
231231
self.text.get_buffer().insert_with_tags(end, text, style)
@@ -325,7 +325,7 @@ def complete_line(self):
325325

326326
completions = []
327327
p = self.completer.complete(token, len(completions))
328-
while p != None:
328+
while p is not None:
329329
completions.append(p)
330330
p = self.completer.complete(token, len(completions))
331331

@@ -353,7 +353,7 @@ def destroy(arg=None):
353353
gtk.main_quit()
354354

355355
def key_event(widget, event):
356-
if gtk.gdk.keyval_name( event.keyval) == 'd' and \
356+
if gtk.gdk.keyval_name(event.keyval) == 'd' and \
357357
event.state & gtk.gdk.CONTROL_MASK:
358358
destroy()
359359
return False

examples/user_interfaces/mathtext_wx.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,10 @@ def mathtext_to_wxbitmap(s):
3030
############################################################
3131

3232
functions = [
33-
(r'$\sin(2 \pi x)$', lambda x: sin(2*pi*x)),
34-
(r'$\frac{4}{3}\pi x^3$', lambda x: (4.0 / 3.0) * pi * x**3),
35-
(r'$\cos(2 \pi x)$', lambda x: cos(2*pi*x)),
36-
(r'$\log(x)$', lambda x: log(x))
33+
(r'$\sin(2 \pi x)$', lambda x: sin(2*pi*x)),
34+
(r'$\frac{4}{3}\pi x^3$', lambda x: (4.0/3.0)*pi*x**3),
35+
(r'$\cos(2 \pi x)$', lambda x: cos(2*pi*x)),
36+
(r'$\log(x)$', lambda x: log(x))
3737
]
3838

3939

lib/matplotlib/tests/test_coding_standards.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ def test_pep8_conformance_examples():
276276
assert_pep8_conformance(dirname=exdir,
277277
extra_exclude_directories=blacklist,
278278
pep8_additional_ignore=PEP8_ADDITIONAL_IGNORE +
279-
['E501'],
279+
['E203', 'E228', 'E261', 'E262', 'E501'],
280280
expected_bad_files=())
281281

282282

0 commit comments

Comments
 (0)