Skip to content

Commit c0fbfbd

Browse files
author
Martin Fitzpatrick
committed
Fix PEP8 compliance
1 parent 515b57c commit c0fbfbd

File tree

2 files changed

+13
-12
lines changed

2 files changed

+13
-12
lines changed

lib/matplotlib/backends/backend_qt5.py

+7-8
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
from matplotlib._pylab_helpers import Gcf
2323
from matplotlib.figure import Figure
2424

25-
2625
from matplotlib.widgets import SubplotTool
2726
try:
2827
import matplotlib.backends.qt_editor.figureoptions as figureoptions
@@ -184,6 +183,7 @@ class TimerQT(TimerBase):
184183
upon timer events. This list can be manipulated directly, or the
185184
functions add_callback and remove_callback can be used.
186185
'''
186+
187187
def __init__(self, *args, **kwargs):
188188
TimerBase.__init__(self, *args, **kwargs)
189189

@@ -331,8 +331,8 @@ def resizeEvent(self, event):
331331
print('resize (%d x %d)' % (w, h))
332332
print("FigureCanvasQt.resizeEvent(%d, %d)" % (w, h))
333333
dpival = self.figure.dpi
334-
winch = w/dpival
335-
hinch = h/dpival
334+
winch = w / dpival
335+
hinch = h / dpival
336336
self.figure.set_size_inches(winch, hinch)
337337
FigureCanvasBase.resize_event(self)
338338
self.draw()
@@ -551,9 +551,9 @@ def destroy(self, *args):
551551
self.window.destroyed.connect(self._widgetclosed)
552552

553553
if self.toolbar:
554-
self.toolbar.destroy()
554+
self.toolbar.destroy()
555555
if DEBUG:
556-
print("destroy figure manager")
556+
print("destroy figure manager")
557557
self.window.close()
558558

559559
def get_window_title(self):
@@ -750,7 +750,7 @@ def __init__(self, targetfig, parent):
750750
self.slidertop.valueChanged.connect(self.sliderbottom.setMaximum)
751751

752752
self.defaults = {}
753-
for attr in ('left', 'bottom', 'right', 'top', 'wspace', 'hspace',):
753+
for attr in ('left', 'bottom', 'right', 'top', 'wspace', 'hspace', ):
754754
self.defaults[attr] = getattr(self.targetfig.subplotpars, attr)
755755
slider = getattr(self, 'slider' + attr)
756756
slider.setMinimum(0)
@@ -761,7 +761,7 @@ def __init__(self, targetfig, parent):
761761
self._setSliderPositions()
762762

763763
def _setSliderPositions(self):
764-
for attr in ('left', 'bottom', 'right', 'top', 'wspace', 'hspace',):
764+
for attr in ('left', 'bottom', 'right', 'top', 'wspace', 'hspace', ):
765765
slider = getattr(self, 'slider' + attr)
766766
slider.setSliderPosition(int(self.defaults[attr] * 1000))
767767

@@ -850,6 +850,5 @@ def exception_handler(type, value, tb):
850850
if len(msg):
851851
error_msg_qt(msg)
852852

853-
854853
FigureCanvas = FigureCanvasQT
855854
FigureManager = FigureManagerQT

lib/matplotlib/backends/qt_compat.py

+6-4
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
QT_API_PYQT5 = 'PyQt5' # use PyQt5 API; Version 2 with module shim
1616

1717
ETS = dict(pyqt=QT_API_PYQTv2, pyside=QT_API_PYSIDE, pyqt5=QT_API_PYQT5)
18-
1918
# If the ETS QT_API environment variable is set, use it. Note that
2019
# ETS requires the version 2 of PyQt4, which is not the platform
2120
# default for Python 2.x.
@@ -62,14 +61,14 @@
6261
sip.setapi('QString', 2)
6362
except:
6463
res = 'QString API v2 specification failed. Defaulting to v1.'
65-
verbose.report(cond+res, 'helpful')
64+
verbose.report(cond + res, 'helpful')
6665
# condition has now been reported, no need to repeat it:
6766
cond = ""
6867
try:
6968
sip.setapi('QVariant', 2)
7069
except:
7170
res = 'QVariant API v2 specification failed. Defaulting to v1.'
72-
verbose.report(cond+res, 'helpful')
71+
verbose.report(cond + res, 'helpful')
7372

7473
if QT_API in [QT_API_PYQT, QT_API_PYQTv2]: # PyQt4 API
7574

@@ -80,11 +79,15 @@
8079
# Use new getSaveFileNameAndFilter()
8180
_getSaveFileName = QtGui.QFileDialog.getSaveFileNameAndFilter
8281
else:
82+
83+
8384
# Use old getSaveFileName()
8485
def _getSaveFileName(*args, **kwargs):
8586
return QtGui.QFileDialog.getSaveFileName(*args, **kwargs), None
8687

8788
except (AttributeError, KeyError):
89+
90+
8891
# call to getapi() can fail in older versions of sip
8992
def _getSaveFileName(*args, **kwargs):
9093
return QtGui.QFileDialog.getSaveFileName(*args, **kwargs), None
@@ -123,4 +126,3 @@ def _getSaveFileName(*args, **kwargs):
123126
124127
'''
125128
QtWidgets = QtGui
126-

0 commit comments

Comments
 (0)