Skip to content

Flake fixes pt4 #127

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 12 commits into from
2 changes: 1 addition & 1 deletion src/diffpy/pdfgui/gui/errorwrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def _f(*args, **kwargs):
return rvpass

# Everything else
except:
except Exception:
if pdfguiglobals.dbopts.pythondebugger:
import pdb

Expand Down
18 changes: 9 additions & 9 deletions src/diffpy/pdfgui/gui/fittree.py
Original file line number Diff line number Diff line change
Expand Up @@ -356,9 +356,9 @@ def AddFit(self, fitname="Fit 1", cdata=None, paste=False):
cdata = self.control.paste(cdata, None, fitname, pos)
self.SetControlData(newfit, cdata)
return newfit
except:
except Exception:
self.Delete(newfit)
raise
raise Exception
return

def AddPhase(self, node, label, insertafter=None, filename=None, makedata=True, cdata=None):
Expand Down Expand Up @@ -427,9 +427,9 @@ def AddPhase(self, node, label, insertafter=None, filename=None, makedata=True,
elif cdata is not None:
self.control.paste(cdata, pdata, label, pos)
return newphase
except:
except Exception:
self.Delete(newphase)
raise
raise Exception
return

def AddDataSet(self, node, label, insertafter=None, filename=None, makedata=True, cdata=None):
Expand Down Expand Up @@ -492,9 +492,9 @@ def AddDataSet(self, node, label, insertafter=None, filename=None, makedata=True
elif cdata is not None:
self.control.paste(cdata, pdata, label, pos)
return newset
except:
except Exception:
self.Delete(newset)
raise
raise Exception
return

def AddCalc(self, node, label, insertafter=None, makedata=True, cdata=None):
Expand Down Expand Up @@ -553,9 +553,9 @@ def AddCalc(self, node, label, insertafter=None, makedata=True, cdata=None):
elif cdata is not None:
self.control.paste(cdata, pdata, label, pos)
return newcalc
except:
except Exception:
self.Delete(newcalc)
raise
raise Exception
return

def CopyBranch(self, startnode):
Expand Down Expand Up @@ -611,7 +611,7 @@ def GetClipboard(self):
if cdatabytes[:16] == "pdfgui_cliboard=".encode():
cdatabytes = cdatabytes[16:]
cdata = pickle_loads(cdatabytes)
except:
except Exception:
pass
return cdata

Expand Down
2 changes: 1 addition & 1 deletion src/diffpy/pdfgui/gui/phasepanelutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ def canPasteIntoCells(panel):
# Strip any trailing tabs
rowlist = [r.rstrip("\t") for r in rowlist]
celllist = [r.split("\t") for r in rowlist]
except:
except wx.PyDeadObjectError:
return False

if len(celllist) == 0:
Expand Down
4 changes: 1 addition & 3 deletions src/diffpy/pdfgui/gui/plotpanel.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@

# generated by wxGlade 0.9.3 on Fri Jul 19 16:05:24 2019

import sys

import wx

from diffpy.pdfgui.control.controlerrors import ControlConfigError
Expand Down Expand Up @@ -167,7 +165,7 @@ def _represent(mixedNames):
xvals = _represent(xdata)
try:
xvals.remove("rw")
except:
except ValueError:
pass
numericStringSort(xvals)

Expand Down
18 changes: 12 additions & 6 deletions src/diffpy/pdfgui/gui/wxextensions/wx12.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@ def Append(self, *args, **kwargs):


if WX4:
Menu = wx.Menu
RealMenu = wx.Menu
else:
RealMenu = Menu

# ----------------------------------------------------------------------------

Expand All @@ -58,7 +60,9 @@ class ListCtrl(wx.ListCtrl):


if WX4:
ListCtrl = wx.ListCtrl
RealListCtrl = wx.ListCtrl
else:
RealListCtrl = ListCtrl

# ----------------------------------------------------------------------------

Expand All @@ -70,7 +74,9 @@ class TreeCtrl(wx.TreeCtrl):


if WX4:
TreeCtrl = wx.TreeCtrl
RealTreeCtrl = wx.TreeCtrl
else:
RealTreeCtrl = TreeCtrl

# wx.ToolBar -----------------------------------------------------------------

Expand All @@ -92,6 +98,6 @@ def patchToolBarMethods(toolbar):

# Final checks ---------------------------------------------------------------

assert WX3 ^ (Menu is wx.Menu)
assert WX3 ^ (TreeCtrl is wx.TreeCtrl)
assert WX3 ^ (ListCtrl is wx.ListCtrl)
assert WX3 ^ (RealMenu is wx.Menu)
assert WX3 ^ (RealTreeCtrl is wx.TreeCtrl)
assert WX3 ^ (RealListCtrl is wx.ListCtrl)