Skip to content

Commit 7b35fa0

Browse files
committed
[examples] switch to print function everywhere + fix E211
Signed-off-by: Thomas Hisch <t.hisch@gmail.com>
1 parent f5e923f commit 7b35fa0

20 files changed

+32
-32
lines changed

examples/api/date_index_formatter.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
import matplotlib.ticker as ticker
1212

1313
datafile = cbook.get_sample_data('aapl.csv', asfileobj=False)
14-
print ('loading %s' % datafile)
14+
print('loading %s' % datafile)
1515
r = mlab.csv2rec(datafile)
1616

1717
r.sort()

examples/api/watermark_image.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import matplotlib.pyplot as plt
99

1010
datafile = cbook.get_sample_data('logo2.png', asfileobj=False)
11-
print ('loading %s' % datafile)
11+
print('loading %s' % datafile)
1212
im = image.imread(datafile)
1313
im[:, :, -1] = 0.5 # set the alpha channel
1414

examples/event_handling/pipong.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,12 +81,12 @@ def update(self,pads):
8181
fudge = .001
8282
# probably cleaner with something like...if not self.field.contains(self.x, self.y):
8383
if self.x < 0+fudge:
84-
#print "player A loses"
84+
#print("player A loses")
8585
pads[1].score += 1;
8686
self._reset(pads[0])
8787
return True
8888
if self.x > 7-fudge:
89-
#print "player B loses"
89+
#print("player B loses")
9090
pads[0].score += 1;
9191
self._reset(pads[1])
9292
return True

examples/misc/font_indexing.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
#for ccode, glyphind in dsu:
2020
# try: name = font.get_glyph_name(glyphind)
2121
# except RuntimeError: pass
22-
# else: print '% 4d % 4d %s %s'%(glyphind, ccode, hex(int(ccode)), name)
22+
# else: print('% 4d % 4d %s %s' % (glyphind, ccode, hex(int(ccode)), name))
2323

2424

2525
# make a charname to charcode and glyphind dictionary
@@ -32,7 +32,7 @@
3232

3333
code = coded['A']
3434
glyph = font.load_char(code)
35-
#print glyph.bbox
35+
#print(glyph.bbox)
3636
print(glyphd['A'], glyphd['V'], coded['A'], coded['V'])
3737
print('AV', font.get_kerning(glyphd['A'], glyphd['V'], KERNING_DEFAULT))
3838
print('AV', font.get_kerning(glyphd['A'], glyphd['V'], KERNING_UNFITTED))

examples/misc/svg_filter_pie.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,5 +91,5 @@
9191
shadow.set("filter",'url(#dropshadow)')
9292

9393
fn = "svg_filter_pie.svg"
94-
print "Saving '%s'" % fn
94+
print("Saving '%s'" % fn)
9595
ET.ElementTree(tree).write(fn)

examples/mplot3d/wire3d_animation_demo.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,4 @@ def generate(X, Y, phi):
3636

3737
plt.pause(.001)
3838

39-
print ('FPS: %f' % (100 / (time.time() - tstart)))
39+
print('FPS: %f' % (100 / (time.time() - tstart)))

examples/pylab_examples/anscombe.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,6 @@ def fit(x):
5454
# verify the stats
5555
pairs = (x,y1), (x,y2), (x,y3), (x4,y4)
5656
for x,y in pairs:
57-
print ('mean=%1.2f, std=%1.2f, r=%1.2f'%(mean(y), std(y), corrcoef(x,y)[0][1]))
57+
print('mean=%1.2f, std=%1.2f, r=%1.2f'%(mean(y), std(y), corrcoef(x,y)[0][1]))
5858

5959
show()

examples/pylab_examples/coords_demo.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,21 +20,21 @@ def on_move(event):
2020

2121
if event.inaxes:
2222
ax = event.inaxes # the axes instance
23-
print ('data coords %f %f' % (event.xdata, event.ydata))
23+
print('data coords %f %f' % (event.xdata, event.ydata))
2424

2525

2626
def on_click(event):
2727
# get the x and y coords, flip y from top to bottom
2828
x, y = event.x, event.y
2929
if event.button==1:
3030
if event.inaxes is not None:
31-
print ('data coords %f %f' % (event.xdata, event.ydata))
31+
print('data coords %f %f' % (event.xdata, event.ydata))
3232

3333
binding_id = connect('motion_notify_event', on_move)
3434
connect('button_press_event', on_click)
3535

3636
if "test_disconnect" in sys.argv:
37-
print ("disconnecting console coordinate printout...")
37+
print("disconnecting console coordinate printout...")
3838
disconnect(binding_id)
3939

4040
show()

examples/pylab_examples/cursor_demo.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ def mouse_move(self, event):
6464
self.ly.set_xdata(x)
6565

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

7070
t = arange(0.0, 1.0, 0.01)

examples/pylab_examples/dashpointlabel.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
for i in range(len(DATA)):
2323
(x,y) = DATA[i]
2424
(dd, dl, r, dr, dp) = dash_style[i]
25-
#print 'dashlen call', dl
25+
#print('dashlen call %d' % dl)
2626
t = ax.text(x, y, str((x,y)), withdash=True,
2727
dashdirection=dd,
2828
dashlength=dl,

0 commit comments

Comments
 (0)