Skip to content

Commit ea8617d

Browse files
committed
fix E201 and E202 pep8 errors
Signed-off-by: Thomas Hisch <t.hisch@gmail.com>
1 parent ed31fee commit ea8617d

Some content is hidden

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

52 files changed

+160
-160
lines changed

examples/event_handling/looking_glass.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
x, y = np.random.rand(2, 200)
55

66
fig, ax = plt.subplots()
7-
circ = patches.Circle( (0.5, 0.5), 0.25, alpha=0.8, fc='yellow')
7+
circ = patches.Circle((0.5, 0.5), 0.25, alpha=0.8, fc='yellow')
88
ax.add_patch(circ)
99

1010

examples/event_handling/pipong.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -145,15 +145,15 @@ def __init__(self, ax):
145145
self.inst = True # show instructions from the beginning
146146
self.background = None
147147
self.pads = []
148-
self.pads.append( Pad(pA,0,padAy))
149-
self.pads.append( Pad(pB,padBx,padBy,'r'))
148+
self.pads.append(Pad(pA,0,padAy))
149+
self.pads.append(Pad(pB,padBx,padBy,'r'))
150150
self.pucks =[]
151151
self.i = self.ax.annotate(instructions,(.5,0.5),
152152
name='monospace',
153153
verticalalignment='center',
154154
horizontalalignment='center',
155155
multialignment='left',
156-
textcoords='axes fraction',animated=True )
156+
textcoords='axes fraction',animated=True)
157157
self.canvas.mpl_connect('key_press_event', self.key_press)
158158

159159
def draw(self, evt):

examples/misc/contour_manual.py

+8-8
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@
66
import matplotlib.cm as cm
77

88
# Contour lines for each level are a list/tuple of polygons.
9-
lines0 = [ [[0,0],[0,4]] ]
10-
lines1 = [ [[2,0],[1,2],[1,3]] ]
11-
lines2 = [ [[3,0],[3,2]], [[3,3],[3,4]] ] # Note two lines.
9+
lines0 = [[[0,0],[0,4]]]
10+
lines1 = [[[2,0],[1,2],[1,3]]]
11+
lines2 = [[[3,0],[3,2]], [[3,3],[3,4]]] # Note two lines.
1212

1313
# Filled contours between two levels are also a list/tuple of polygons.
1414
# Points can be ordered clockwise or anticlockwise.
15-
filled01 = [ [[0,0],[0,4],[1,3],[1,2],[2,0]] ]
16-
filled12 = [ [[2,0],[3,0],[3,2],[1,3],[1,2]], # Note two polygons.
17-
[[1,4],[3,4],[3,3]] ]
15+
filled01 = [[[0,0],[0,4],[1,3],[1,2],[2,0]]]
16+
filled12 = [[[2,0],[3,0],[3,2],[1,3],[1,2]], # Note two polygons.
17+
[[1,4],[3,4],[3,3]]]
1818

1919

2020
plt.figure()
@@ -38,8 +38,8 @@
3838
# Here a code type of 1 is a MOVETO, and 2 is a LINETO.
3939

4040
plt.figure()
41-
filled01 = [ [[0,0],[3,0],[3,3],[0,3],[1,1],[1,2],[2,2],[2,1]] ]
42-
kinds01 = [ [1,2,2,2,1,2,2,2] ]
41+
filled01 = [[[0,0],[3,0],[3,3],[0,3],[1,1],[1,2],[2,2],[2,1]]]
42+
kinds01 = [[1,2,2,2,1,2,2,2]]
4343
cs = ContourSet(plt.gca(), [0,1], [filled01], [kinds01], filled=True)
4444
cbar = plt.colorbar(cs)
4545

examples/misc/rc_traits.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@
1313
doprint = True
1414
flexible_true_trait = traits.Trait(
1515
True,
16-
{ 'true': True, 't': True, 'yes': True, 'y': True, 'on': True, True: True,
16+
{'true': True, 't': True, 'yes': True, 'y': True, 'on': True, True: True,
1717
'false': False, 'f': False, 'no': False, 'n': False, 'off': False, False: False
18-
} )
19-
flexible_false_trait = traits.Trait( False, flexible_true_trait )
18+
})
19+
flexible_false_trait = traits.Trait(False, flexible_true_trait)
2020

2121
colors = {
2222
'c' : '#00bfbf',

examples/pylab_examples/anscombe.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ def fit(x):
2323
return 3+0.5*x
2424

2525

26-
xfit = array( [amin(x), amax(x) ] )
26+
xfit = array([amin(x), amax(x)])
2727

2828
subplot(221)
2929
plot(x,y1,'ks', xfit, fit(xfit), 'r-', lw=2)

examples/pylab_examples/axes_demo.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
# the main axes is subplot(111) by default
1313
plot(t, s)
14-
axis([0, 1, 1.1*amin(s), 2*amax(s) ])
14+
axis([0, 1, 1.1*amin(s), 2*amax(s)])
1515
xlabel('time (s)')
1616
ylabel('current (nA)')
1717
title('Gaussian colored noise')

examples/pylab_examples/axis_equal_demo.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -7,22 +7,22 @@
77
an = linspace(0,2*pi,100)
88

99
subplot(221)
10-
plot( 3*cos(an), 3*sin(an) )
10+
plot(3*cos(an), 3*sin(an))
1111
title('not equal, looks like ellipse',fontsize=10)
1212

1313
subplot(222)
14-
plot( 3*cos(an), 3*sin(an) )
14+
plot(3*cos(an), 3*sin(an))
1515
axis('equal')
1616
title('equal, looks like circle',fontsize=10)
1717

1818
subplot(223)
19-
plot( 3*cos(an), 3*sin(an) )
19+
plot(3*cos(an), 3*sin(an))
2020
axis('equal')
2121
axis([-3,3,-3,3])
2222
title('looks like circle, even after changing limits',fontsize=10)
2323

2424
subplot(224)
25-
plot( 3*cos(an), 3*sin(an) )
25+
plot(3*cos(an), 3*sin(an))
2626
axis('equal')
2727
axis([-3,3,-3,3])
2828
plot([0,4],[0,4])

examples/pylab_examples/bar_stacked.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818

1919
plt.ylabel('Scores')
2020
plt.title('Scores by group and gender')
21-
plt.xticks(ind+width/2., ('G1', 'G2', 'G3', 'G4', 'G5') )
21+
plt.xticks(ind+width/2., ('G1', 'G2', 'G3', 'G4', 'G5'))
2222
plt.yticks(np.arange(0,81,10))
23-
plt.legend( (p1[0], p2[0]), ('Men', 'Women') )
23+
plt.legend((p1[0], p2[0]), ('Men', 'Women'))
2424

2525
plt.show()

examples/pylab_examples/boxplot_demo.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
center = ones(25) * 40
4242
flier_high = rand(10) * 100 + 100
4343
flier_low = rand(10) * -100
44-
d2 = concatenate( (spread, center, flier_high, flier_low), 0 )
44+
d2 = concatenate((spread, center, flier_high, flier_low), 0)
4545
data.shape = (-1, 1)
4646
d2.shape = (-1, 1)
4747
#data = concatenate( (data, d2), 1 )

examples/pylab_examples/boxplot_demo3.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,6 @@ def fakeBootStrapper(n):
4242

4343
ax.set_xlabel('treatment')
4444
ax.set_ylabel('response')
45-
plt.setp(bp['whiskers'], color='k', linestyle='-' )
45+
plt.setp(bp['whiskers'], color='k', linestyle='-')
4646
plt.setp(bp['fliers'], markersize=3.0)
4747
plt.show()

examples/pylab_examples/broken_axis.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
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,
9+
pts = np.array([0.015, 0.166, 0.133, 0.159, 0.041, 0.024, 0.195,
1010
0.039, 0.161, 0.018, 0.143, 0.056, 0.125, 0.096, 0.094, 0.051,
1111
0.043, 0.021, 0.138, 0.075, 0.109, 0.195, 0.05 , 0.074, 0.079,
1212
0.155, 0.02 , 0.01 , 0.061, 0.008])

examples/pylab_examples/broken_barh.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
import matplotlib.pyplot as plt
55

66
fig, ax = plt.subplots()
7-
ax.broken_barh([ (110, 30), (150, 10) ] , (10, 9), facecolors='blue')
8-
ax.broken_barh([ (10, 50), (100, 20), (130, 10)] , (20, 9),
7+
ax.broken_barh([(110, 30), (150, 10)] , (10, 9), facecolors='blue')
8+
ax.broken_barh([(10, 50), (100, 20), (130, 10)] , (20, 9),
99
facecolors=('red', 'yellow', 'green'))
1010
ax.set_ylim(5,35)
1111
ax.set_xlim(0,200)

examples/pylab_examples/contour_label_demo.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ def __repr__(self):
4848
return '%.1f' % self.__float__()
4949

5050
# Recast levels to new class
51-
CS.levels = [nf(val) for val in CS.levels ]
51+
CS.levels = [nf(val) for val in CS.levels]
5252

5353
# Label levels with specially formatted floats
5454
if plt.rcParams["text.usetex"]:
@@ -67,8 +67,8 @@ def __repr__(self):
6767
CS = plt.contour(X, Y, Z)
6868

6969
fmt = {}
70-
strs = [ 'first', 'second', 'third', 'fourth', 'fifth', 'sixth', 'seventh' ]
71-
for l,s in zip( CS.levels, strs ):
70+
strs = ['first', 'second', 'third', 'fourth', 'fifth', 'sixth', 'seventh']
71+
for l,s in zip(CS.levels, strs):
7272
fmt[l] = s
7373

7474
# Label every other level using strings

examples/pylab_examples/cursor_demo.py

+8-8
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,17 @@ def __init__(self, ax):
2121
self.ly = ax.axvline(color='k') # the vert line
2222

2323
# text location in axes coords
24-
self.txt = ax.text( 0.7, 0.9, '', transform=ax.transAxes)
24+
self.txt = ax.text(0.7, 0.9, '', transform=ax.transAxes)
2525

2626
def mouse_move(self, event):
2727
if not event.inaxes: return
2828

2929
x, y = event.xdata, event.ydata
3030
# update the line positions
31-
self.lx.set_ydata(y )
32-
self.ly.set_xdata(x )
31+
self.lx.set_ydata(y)
32+
self.ly.set_xdata(x)
3333

34-
self.txt.set_text( 'x=%1.2f, y=%1.2f'%(x,y) )
34+
self.txt.set_text('x=%1.2f, y=%1.2f'%(x,y))
3535
draw()
3636

3737

@@ -48,7 +48,7 @@ def __init__(self, ax, x, y):
4848
self.x = x
4949
self.y = y
5050
# text location in axes coords
51-
self.txt = ax.text( 0.7, 0.9, '', transform=ax.transAxes)
51+
self.txt = ax.text(0.7, 0.9, '', transform=ax.transAxes)
5252

5353
def mouse_move(self, event):
5454

@@ -60,10 +60,10 @@ def mouse_move(self, event):
6060
x = self.x[indx]
6161
y = self.y[indx]
6262
# update the line positions
63-
self.lx.set_ydata(y )
64-
self.ly.set_xdata(x )
63+
self.lx.set_ydata(y)
64+
self.ly.set_xdata(x)
6565

66-
self.txt.set_text( 'x=%1.2f, y=%1.2f'%(x,y) )
66+
self.txt.set_text('x=%1.2f, y=%1.2f'%(x,y))
6767
print ('x=%1.2f, y=%1.2f'%(x,y))
6868
draw()
6969

examples/pylab_examples/custom_ticker1.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,5 @@ def millions(x, pos):
2727
fig, ax = plt.subplots()
2828
ax.yaxis.set_major_formatter(formatter)
2929
plt.bar(x, money)
30-
plt.xticks( x + 0.5, ('Bill', 'Fred', 'Mary', 'Sue') )
30+
plt.xticks(x + 0.5, ('Bill', 'Fred', 'Mary', 'Sue'))
3131
plt.show()

examples/pylab_examples/data_helper.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@ def get_two_stock_data():
1515

1616
file1 = cbook.get_sample_data('INTC.dat.gz')
1717
file2 = cbook.get_sample_data('AAPL.dat.gz')
18-
M1 = fromstring( file1.read(), '<d')
18+
M1 = fromstring(file1.read(), '<d')
1919

20-
M1 = resize(M1, (M1.shape[0]/2,2) )
20+
M1 = resize(M1, (M1.shape[0]/2,2))
2121

22-
M2 = fromstring( file2.read(), '<d')
23-
M2 = resize(M2, (M2.shape[0]/2,2) )
22+
M2 = fromstring(file2.read(), '<d')
23+
M2 = resize(M2, (M2.shape[0]/2,2))
2424

2525
d1, p1 = M1[:,0], M1[:,1]
2626
d2, p2 = M2[:,0], M2[:,1]

examples/pylab_examples/date_demo_convert.py

+7-7
Original file line numberDiff line numberDiff line change
@@ -5,27 +5,27 @@
55
from matplotlib.dates import DayLocator, HourLocator, DateFormatter, drange
66
from numpy import arange
77

8-
date1 = datetime.datetime( 2000, 3, 2)
9-
date2 = datetime.datetime( 2000, 3, 6)
8+
date1 = datetime.datetime(2000, 3, 2)
9+
date2 = datetime.datetime(2000, 3, 6)
1010
delta = datetime.timedelta(hours=6)
1111
dates = drange(date1, date2, delta)
1212

13-
y = arange( len(dates)*1.0)
13+
y = arange(len(dates)*1.0)
1414

1515
fig, ax = plt.subplots()
1616
ax.plot_date(dates, y*y)
1717

1818
# this is superfluous, since the autoscaler should get it right, but
1919
# use date2num and num2date to convert between dates and floats if
2020
# you want; both date2num and num2date convert an instance or sequence
21-
ax.set_xlim( dates[0], dates[-1] )
21+
ax.set_xlim(dates[0], dates[-1])
2222

2323
# The hour locator takes the hour or sequence of hours you want to
2424
# tick, not the base multiple
2525

26-
ax.xaxis.set_major_locator( DayLocator() )
27-
ax.xaxis.set_minor_locator( HourLocator(arange(0,25,6)) )
28-
ax.xaxis.set_major_formatter( DateFormatter('%Y-%m-%d') )
26+
ax.xaxis.set_major_locator(DayLocator())
27+
ax.xaxis.set_minor_locator(HourLocator(arange(0,25,6)))
28+
ax.xaxis.set_major_formatter(DateFormatter('%Y-%m-%d'))
2929

3030
ax.fmt_xdata = DateFormatter('%Y-%m-%d %H:%M:%S')
3131
fig.autofmt_xdate()

examples/pylab_examples/date_demo_rrule.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
rule = rrulewrapper(YEARLY, byeaster=1, interval=5)
1515
loc = RRuleLocator(rule)
1616
formatter = DateFormatter('%m/%d/%y')
17-
date1 = datetime.date( 1952, 1, 1 )
18-
date2 = datetime.date( 2004, 4, 12 )
17+
date1 = datetime.date(1952, 1, 1)
18+
date2 = datetime.date(2004, 4, 12)
1919
delta = datetime.timedelta(days=100)
2020

2121
dates = drange(date1, date2, delta)

examples/pylab_examples/demo_text_rotation_mode.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ def test_rotation_mode(fig, mode, subplot_location):
3838

3939
if 1:
4040
import matplotlib.pyplot as plt
41-
fig = plt.figure(1, figsize=(5.5,4 ))
41+
fig = plt.figure(1, figsize=(5.5,4))
4242
fig.clf()
4343

4444
test_rotation_mode(fig, "default", 121)

examples/pylab_examples/fill_spiral.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,16 @@
88

99
for dt in arange(0,2*pi,pi/2.0):
1010

11-
x = a*cos( theta+dt )*exp(b*theta)
12-
y = a*sin( theta+dt )*exp(b*theta)
11+
x = a*cos(theta+dt)*exp(b*theta)
12+
y = a*sin(theta+dt)*exp(b*theta)
1313

1414
dt = dt+pi/4.0
1515

16-
x2 = a*cos( theta+dt )*exp(b*theta)
17-
y2 = a*sin( theta+dt )*exp(b*theta)
16+
x2 = a*cos(theta+dt)*exp(b*theta)
17+
y2 = a*sin(theta+dt)*exp(b*theta)
1818

19-
xf = concatenate( (x,x2[::-1]) )
20-
yf = concatenate( (y,y2[::-1]) )
19+
xf = concatenate((x,x2[::-1]))
20+
yf = concatenate((y,y2[::-1]))
2121

2222
p1=fill(xf,yf)
2323

examples/pylab_examples/finance_work2.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ def moving_average_convergence(x, nslow=26, nfast=12):
144144
last.open, last.high,
145145
last.low, last.close,
146146
last.volume*1e-6,
147-
last.close-last.open )
147+
last.close-last.open)
148148
t4 = ax2.text(0.3, 0.9, s, transform=ax2.transAxes, fontsize=textsize)
149149

150150
props = font_manager.FontProperties(size=10)

examples/pylab_examples/fonts_demo.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -57,34 +57,34 @@
5757
font = font0.copy()
5858
font.set_family('serif')
5959
font.set_variant(variant[k])
60-
t = text( 0.0, yp[k], variant[k], fontproperties=font,
60+
t = text(0.0, yp[k], variant[k], fontproperties=font,
6161
**alignment)
6262

6363
### Show weight options
6464

6565
weight = ['light', 'normal', 'medium', 'semibold', 'bold', 'heavy', 'black']
6666

67-
t = text( 0.4, 0.9, 'weight', fontproperties=font1,
67+
t = text(0.4, 0.9, 'weight', fontproperties=font1,
6868
**alignment)
6969

7070
for k in range(7):
7171
font = font0.copy()
7272
font.set_weight(weight[k])
73-
t = text( 0.4, yp[k], weight[k], fontproperties=font,
73+
t = text(0.4, yp[k], weight[k], fontproperties=font,
7474
**alignment)
7575

7676
### Show size options
7777

7878
size = ['xx-small', 'x-small', 'small', 'medium', 'large',
7979
'x-large', 'xx-large']
8080

81-
t = text( 0.8, 0.9, 'size', fontproperties=font1,
81+
t = text(0.8, 0.9, 'size', fontproperties=font1,
8282
**alignment)
8383

8484
for k in range(7):
8585
font = font0.copy()
8686
font.set_size(size[k])
87-
t = text( 0.8, yp[k], size[k], fontproperties=font,
87+
t = text(0.8, yp[k], size[k], fontproperties=font,
8888
**alignment)
8989

9090
### Show bold italic

0 commit comments

Comments
 (0)