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

Skip to content

Commit 5756fbf

Browse files
committed
Merge pull request matplotlib#3629 from thisch/examples_pep8_e211
examples: fix pep8 error class E211
2 parents f5d2f45 + 2f8d539 commit 5756fbf

File tree

5 files changed

+23
-23
lines changed

5 files changed

+23
-23
lines changed

examples/tests/backend_driver.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@ def report_missing(dir, flist):
330330
missing = list(pyfiles-flist-exclude)
331331
missing.sort()
332332
if missing:
333-
print ('%s files not tested: %s'%(dir, ', '.join(missing)))
333+
print('%s files not tested: %s'%(dir, ', '.join(missing)))
334334

335335

336336
def report_all_missing(directories):
@@ -381,12 +381,12 @@ def drive(backend, directories, python=['python'], switches = []):
381381
for fname in files[d]]
382382

383383
for fullpath in testcases:
384-
print ('\tdriving %-40s' % (fullpath)),
384+
print('\tdriving %-40s' % (fullpath))
385385
sys.stdout.flush()
386386
fpath, fname = os.path.split(fullpath)
387387

388388
if fname in exclude:
389-
print ('\tSkipping %s, known to fail on backend: %s'%backend)
389+
print('\tSkipping %s, known to fail on backend: %s'%backend)
390390
continue
391391

392392
basename, ext = os.path.splitext(fname)
@@ -430,7 +430,7 @@ def drive(backend, directories, python=['python'], switches = []):
430430
program = [x % {'name': basename} for x in python]
431431
ret = run(program + [tmpfile_name] + switches)
432432
end_time = time.time()
433-
print ("%s %s" % ((end_time - start_time), ret))
433+
print("%s %s" % ((end_time - start_time), ret))
434434
#os.system('%s %s %s' % (python, tmpfile_name, ' '.join(switches)))
435435
os.remove(tmpfile_name)
436436
if ret:
@@ -478,7 +478,7 @@ def parse_options():
478478
switches = switches)
479479
if 'pylab_examples' in result.dirs:
480480
result.dirs[result.dirs.index('pylab_examples')] = 'pylab'
481-
#print result
481+
#print(result)
482482
return (result)
483483

484484
if __name__ == '__main__':
@@ -492,14 +492,14 @@ def parse_options():
492492
for d in localdirs:
493493
if d.lower() not in all_backends_set:
494494
continue
495-
print ('removing %s'%d)
495+
print('removing %s'%d)
496496
for fname in glob.glob(os.path.join(d, '*')):
497497
os.remove(fname)
498498
os.rmdir(d)
499499
for fname in glob.glob('_tmp*.py'):
500500
os.remove(fname)
501501

502-
print ('all clean...')
502+
print('all clean...')
503503
raise SystemExit
504504
if options.coverage:
505505
python = ['coverage.py', '-x']
@@ -513,19 +513,19 @@ def parse_options():
513513

514514
report_all_missing(options.dirs)
515515
for backend in options.backends:
516-
print ('testing %s %s' % (backend, ' '.join(options.switches)))
516+
print('testing %s %s' % (backend, ' '.join(options.switches)))
517517
t0 = time.time()
518518
failures[backend] = \
519519
drive(backend, options.dirs, python, options.switches)
520520
t1 = time.time()
521521
times[backend] = (t1-t0)/60.0
522522

523-
# print times
523+
#print(times)
524524
for backend, elapsed in times.items():
525-
print ('Backend %s took %1.2f minutes to complete' % (backend, elapsed))
525+
print('Backend %s took %1.2f minutes to complete' % (backend, elapsed))
526526
failed = failures[backend]
527527
if failed:
528-
print (' Failures: %s' % failed)
528+
print(' Failures: %s' % failed)
529529
if 'template' in times:
530-
print ('\ttemplate ratio %1.3f, template residual %1.3f' % (
530+
print('\ttemplate ratio %1.3f, template residual %1.3f' % (
531531
elapsed/times['template'], elapsed-times['template']))

examples/user_interfaces/embedding_in_gtk3.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@
2222
a.plot(t,s)
2323

2424
sw = Gtk.ScrolledWindow()
25-
win.add (sw)
25+
win.add(sw)
2626
# A scrolled window border goes outside the scrollbars and viewport
27-
sw.set_border_width (10)
27+
sw.set_border_width(10)
2828

2929
canvas = FigureCanvas(f) # a Gtk.DrawingArea
3030
canvas.set_size_request(800,600)
31-
sw.add_with_viewport (canvas)
31+
sw.add_with_viewport(canvas)
3232

3333
win.show_all()
3434
Gtk.main()

examples/user_interfaces/interactive.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ def runcode(self):
141141
self.ready.release()
142142
return True
143143

144-
def kill (self):
144+
def kill(self):
145145
"""Kill the thread, returning when it has been shut down."""
146146
self.ready.acquire()
147147
self._kill = True

examples/user_interfaces/interactive2.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ class GTKInterpreterConsole(gtk.ScrolledWindow):
147147

148148
def __init__(self):
149149
gtk.ScrolledWindow.__init__(self)
150-
self.set_policy (gtk.POLICY_AUTOMATIC,gtk.POLICY_AUTOMATIC)
150+
self.set_policy(gtk.POLICY_AUTOMATIC,gtk.POLICY_AUTOMATIC)
151151

152152
self.text = gtk.TextView()
153153
self.text.set_wrap_mode(True)

examples/widgets/rectangle_selector.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,17 @@ def line_select_callback(eclick, erelease):
1717
'eclick and erelease are the press and release events'
1818
x1, y1 = eclick.xdata, eclick.ydata
1919
x2, y2 = erelease.xdata, erelease.ydata
20-
print ("(%3.2f, %3.2f) --> (%3.2f, %3.2f)" % (x1, y1, x2, y2))
21-
print (" The button you used were: %s %s" % (eclick.button, erelease.button))
20+
print("(%3.2f, %3.2f) --> (%3.2f, %3.2f)" % (x1, y1, x2, y2))
21+
print(" The button you used were: %s %s" % (eclick.button, erelease.button))
2222

2323

2424
def toggle_selector(event):
25-
print (' Key pressed.')
25+
print(' Key pressed.')
2626
if event.key in ['Q', 'q'] and toggle_selector.RS.active:
27-
print (' RectangleSelector deactivated.')
27+
print(' RectangleSelector deactivated.')
2828
toggle_selector.RS.set_active(False)
2929
if event.key in ['A', 'a'] and not toggle_selector.RS.active:
30-
print (' RectangleSelector activated.')
30+
print(' RectangleSelector activated.')
3131
toggle_selector.RS.set_active(True)
3232

3333

@@ -39,7 +39,7 @@ def toggle_selector(event):
3939
plt.plot(x, +np.cos(.2*np.pi*x), lw=3.5, c='r', alpha=.5)
4040
plt.plot(x, -np.sin(.2*np.pi*x), lw=3.5, c='g', alpha=.3)
4141

42-
print ("\n click --> release")
42+
print("\n click --> release")
4343

4444
# drawtype is 'box' or 'line' or 'none'
4545
toggle_selector.RS = RectangleSelector(current_ax, line_select_callback,

0 commit comments

Comments
 (0)