diff --git a/.coveragerc b/.coveragerc index d0a0d16d..63f0ec9c 100644 --- a/.coveragerc +++ b/.coveragerc @@ -3,14 +3,14 @@ [report] # RE patterns for lines to be excluded from consideration. exclude_lines = - ## Have to re-enable the standard pragma + # Have to re-enable the standard pragma pragma: no cover - ## Don't complain if tests don't hit defensive assertion code: + # Don't complain if tests don't hit defensive assertion code: raise AssertionError raise NotImplementedError ^[ ]*assert False - ## Don't complain if non-runnable code isn't run: + # Don't complain if non-runnable code isn't run: ^[ ]*@unittest.skip\b ^[ ]{4}unittest.main() if __name__ == .__main__.: @@ -18,5 +18,5 @@ exclude_lines = [run] omit = - ## exclude debug.py from codecov report + # exclude debug.py from codecov report */tests/debug.py diff --git a/src/diffpy/pdfgui/gui/bondangledialog.py b/src/diffpy/pdfgui/gui/bondangledialog.py index c7b05aeb..a58c8df4 100644 --- a/src/diffpy/pdfgui/gui/bondangledialog.py +++ b/src/diffpy/pdfgui/gui/bondangledialog.py @@ -79,7 +79,7 @@ def __do_layout(self): self.Layout() # end wxGlade - ########################################################################### + # ######################################################################### def __customProperties(self): """Set the custom properties.""" @@ -138,8 +138,8 @@ def onSpin(self, event): loop = True while loop: loop = False - for l in letters: - if newval == getattr(self, l): + for letter in letters: + if newval == getattr(self, letter): loop = True if increasing: newval += 1 diff --git a/src/diffpy/pdfgui/gui/parameterspanel.py b/src/diffpy/pdfgui/gui/parameterspanel.py index ff043ff5..e00c76e8 100644 --- a/src/diffpy/pdfgui/gui/parameterspanel.py +++ b/src/diffpy/pdfgui/gui/parameterspanel.py @@ -98,7 +98,7 @@ def __do_layout(self): self.Layout() # end wxGlade - ########################################################################## + # ######################################################################## # Misc Methods def __customProperties(self): diff --git a/src/diffpy/pdfgui/gui/phaseconfigurepanel.py b/src/diffpy/pdfgui/gui/phaseconfigurepanel.py index 5f294162..d5d44ed4 100644 --- a/src/diffpy/pdfgui/gui/phaseconfigurepanel.py +++ b/src/diffpy/pdfgui/gui/phaseconfigurepanel.py @@ -221,7 +221,7 @@ def __init__(self, *args, **kwds): # end wxGlade self.__customProperties() - ########################################################################## + # ######################################################################## # Misc Methods def __customProperties(self): @@ -319,7 +319,7 @@ def restrictConstrainedParameters(self): """Set 'read-only' boxes that correspond to constrained parameters.""" self.setToolTips(tooltips.phasepanel) - txtbg = self.textCtrlA.DefaultStyle.BackgroundColour + self.textCtrlA.DefaultStyle.BackgroundColour # First the TextCtrls for key, var in self.lConstraintsMap.items(): @@ -447,7 +447,7 @@ def applyCellChange(self, i, j, value): except ValueError: return - ########################################################################## + # ######################################################################## # Event Handlers # TextCtrl Events @@ -629,7 +629,7 @@ def onKey(self, event): return - ########################################################################## + # ######################################################################## # Grid popup menu and handlers def popupMenu(self, window, x, y): diff --git a/src/diffpy/pdfgui/gui/phaseconstraintspanel.py b/src/diffpy/pdfgui/gui/phaseconstraintspanel.py index 352e92ea..0506b9c6 100644 --- a/src/diffpy/pdfgui/gui/phaseconstraintspanel.py +++ b/src/diffpy/pdfgui/gui/phaseconstraintspanel.py @@ -210,7 +210,7 @@ def __init__(self, *args, **kwds): # end wxGlade self.__customProperties() - ########################################################################## + # ######################################################################## # Misc Methods def __customProperties(self): @@ -314,7 +314,7 @@ def refresh(self): self.refreshTextCtrls() - ### update the grid ### + # # update the grid ### natoms = len(self.structure) nrows = self.gridAtoms.GetNumberRows() self.gridAtoms.BeginBatch() @@ -339,7 +339,7 @@ def refresh(self): if not m: continue barevar = m.group(1) - if not barevar in bareAtomVarColumn: + if barevar not in bareAtomVarColumn: continue column = bareAtomVarColumn[barevar] row = int(m.group(2)) - 1 @@ -348,7 +348,7 @@ def refresh(self): raise ControlValueError(emsg) self.gridAtoms.SetCellValue(row, column, con.formula) barevar = re.sub(r"\(\d+\)$", "", var) - if not barevar in bareAtomVarColumn: + if barevar not in bareAtomVarColumn: continue self.gridAtoms.AutosizeLabels() @@ -411,7 +411,7 @@ def applyCellChange(self, i, j, value): return "" return - ########################################################################## + # ######################################################################## # Event Handlers # TextCtrl Events @@ -554,12 +554,12 @@ def onKey(self, event): self.mainFrame.needsSave() # Can't get these to work. Maybe later. - ## Copy - Ctrl+C / Ctrl+Insert + # Copy - Ctrl+C / Ctrl+Insert # if event.ControlDown() and (key == 67 or key == wx.WXK_INSERT): # if phasepanelutils.canCopySelectedCells(self): # phasepanelutils.copySelectedCells(self) - ## Paste - Ctrl+V / Shift+Insert + # Paste - Ctrl+V / Shift+Insert # if (event.ControlDown() and key == 86) or\ # (event.ShiftDown() and key == wx.WXK_INSERT): # if phasepanelutils.canPasteIntoCells(self): @@ -569,7 +569,7 @@ def onKey(self, event): event.Skip() return - ########################################################################## + # ######################################################################## # Grid popup menu and handlers def popupMenu(self, window, x, y): diff --git a/src/diffpy/pdfgui/gui/phaseresultspanel.py b/src/diffpy/pdfgui/gui/phaseresultspanel.py index cf806767..5b063994 100644 --- a/src/diffpy/pdfgui/gui/phaseresultspanel.py +++ b/src/diffpy/pdfgui/gui/phaseresultspanel.py @@ -198,7 +198,7 @@ def __init__(self, *args, **kwds): self.__customProperties() return - ########################################################################## + # ######################################################################## # Misc Methods def __customProperties(self): diff --git a/src/diffpy/pdfgui/gui/rseriespanel.py b/src/diffpy/pdfgui/gui/rseriespanel.py index c1afe397..5c733d2c 100644 --- a/src/diffpy/pdfgui/gui/rseriespanel.py +++ b/src/diffpy/pdfgui/gui/rseriespanel.py @@ -32,7 +32,7 @@ def __init__(self, *args, **kwds): self.instructionsLabel = wx.StaticText( self, wx.ID_ANY, - "Select a fit from the tree on the left and set the first value, last value, \nand the step size of the maximum and/or minimum of the fit range\nbelow. If you have not set up a fit to be the template for the series, hit\ncancel and rerun this macro once a fit has been created.", + "Select a fit from the tree on the left and set the first value, last value, \nand the step size of the maximum and/or minimum of the fit range\nbelow. If you have not set up a fit to be the template for the series, hit\ncancel and rerun this macro once a fit has been created.", # noqa: E501 ) self.maxFirstLabel = wx.StaticText(self, wx.ID_ANY, "first") self.maxFirstTextCtrl = wx.TextCtrl(self, wx.ID_ANY, "") @@ -101,7 +101,7 @@ def __do_layout(self): self.Layout() # end wxGlade - ################################################## + # ################################################ def __customProperties(self): """Set the custom properties of this panel.""" self.fit = None diff --git a/src/diffpy/pdfgui/gui/sgconstraindialog.py b/src/diffpy/pdfgui/gui/sgconstraindialog.py index 1d9bb606..5c8ecbc3 100644 --- a/src/diffpy/pdfgui/gui/sgconstraindialog.py +++ b/src/diffpy/pdfgui/gui/sgconstraindialog.py @@ -101,7 +101,7 @@ def __init__(self, *args, **kwds): # end wxGlade self.__customProperties() - ########################################################################### + # ######################################################################### def __customProperties(self): """Set the custom properties.""" @@ -204,7 +204,7 @@ def updateWidgets(self): raise ControlValueError(error) return - ### Events + # # Events def onKillFocus(self, event): """Check value of widgets and update the dialog message.""" diff --git a/src/diffpy/pdfgui/gui/sgstructuredialog.py b/src/diffpy/pdfgui/gui/sgstructuredialog.py index f8a6336f..7819579a 100644 --- a/src/diffpy/pdfgui/gui/sgstructuredialog.py +++ b/src/diffpy/pdfgui/gui/sgstructuredialog.py @@ -91,7 +91,7 @@ def __init__(self, *args, **kwds): # end wxGlade self.__customProperties() - ########################################################################### + # ######################################################################### def __customProperties(self): """Set the custom properties.""" @@ -195,7 +195,7 @@ def updateWidgets(self): raise ControlValueError(error) return - ### Events + # # Events def onKillFocus(self, event): """Check value of widgets and update the dialog message.""" self.updateWidgets() diff --git a/src/diffpy/pdfgui/gui/supercelldialog.py b/src/diffpy/pdfgui/gui/supercelldialog.py index 8070a82c..2e34b2c7 100644 --- a/src/diffpy/pdfgui/gui/supercelldialog.py +++ b/src/diffpy/pdfgui/gui/supercelldialog.py @@ -74,7 +74,7 @@ def __do_layout(self): self.Layout() # end wxGlade - ############################################################################ + # ########################################################################## def __customProperties(self): """Set custom properties.""" diff --git a/src/diffpy/pdfgui/gui/temperatureseriespanel.py b/src/diffpy/pdfgui/gui/temperatureseriespanel.py index d1cc6ae1..66956fc2 100644 --- a/src/diffpy/pdfgui/gui/temperatureseriespanel.py +++ b/src/diffpy/pdfgui/gui/temperatureseriespanel.py @@ -18,7 +18,6 @@ import os.path import re -import sys import wx @@ -41,7 +40,7 @@ def __init__(self, *args, **kwds): self.instructionsLabel = wx.StaticText( self, wx.ID_ANY, - "Select a fit from the tree on the left then add datasets and assign\ntemperatues below. If you have not set up a fit to be the template\nfor the series, hit cancel and rerun this macro once a fit has been\ncreated.", + "Select a fit from the tree on the left then add datasets and assign\ntemperatues below. If you have not set up a fit to be the template\nfor the series, hit cancel and rerun this macro once a fit has been\ncreated.", # noqa: E501 ) self.instructionsLabel.SetFont( wx.Font( @@ -201,7 +200,7 @@ def onAdd(self, event): # wxGlade: TemperatureSeriesPanel. if not dir: dir = self.mainFrame.workpath - matchstring = "PDF data files (*.gr)|*.gr|PDF fit files (*.fgr)|*.fgr|PDF fit files (*.fit)|*.fit|PDF calculation files (*.cgr)|*.cgr|PDF calculation files (*.calc)|*.calc|All Files|*" + matchstring = "PDF data files (*.gr)|*.gr|PDF fit files (*.fgr)|*.fgr|PDF fit files (*.fit)|*.fit|PDF calculation files (*.cgr)|*.cgr|PDF calculation files (*.calc)|*.calc|All Files|*" # noqa: E501 d = wx.FileDialog( None, "Choose files", @@ -293,13 +292,13 @@ def onColClick(self, event): # wxGlade: TemperatureSeriesPanel. column = event.GetColumn() # sort by temperature if column == 0: - sortkey = lambda tf: float(tf[0]) + sortkey = lambda tf: float(tf[0]) # noqa: E731 # sort by filename with numerical comparison of digits elif column == 1: filenames = [f for t, f in self.datasets] numericStringSort(filenames) order = dict(zip(filenames, range(len(filenames)))) - sortkey = lambda tf: order[tf[1]] + sortkey = lambda tf: order[tf[1]] # noqa: E731 # ignore unhandled columns else: return @@ -308,7 +307,7 @@ def onColClick(self, event): # wxGlade: TemperatureSeriesPanel. self.fillList() return - ## Utility functions + # Utility functions def fillList(self): """Fill the list with the datasets.""" self.listCtrlFiles.DeleteAllItems() @@ -325,7 +324,7 @@ def fillList(self): self.listCtrlFiles.SetItem(index, 1, shortname) return - ## Needed by mainframe + # Needed by mainframe def treeSelectionUpdate(self, node): """Set the current fit when the tree selection changes.""" nodetype = self.treeCtrlMain.GetNodeType(node) @@ -334,7 +333,7 @@ def treeSelectionUpdate(self, node): self.refresh() return - ## Required by PDFPanel + # Required by PDFPanel def refresh(self): """Block out OK button if there is no fit.