From 87ddfa5fa2420b66213a4cfeb35669839a1ad405 Mon Sep 17 00:00:00 2001 From: Arohan Ajit Date: Wed, 15 Jan 2025 11:08:45 -0500 Subject: [PATCH 1/2] update --- .flake8 | 1 - gui/wxpython/location_wizard/wizard.py | 20 ++++++++++---------- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/.flake8 b/.flake8 index 20fa84370c1..5af56cc7374 100644 --- a/.flake8 +++ b/.flake8 @@ -29,7 +29,6 @@ per-file-ignores = gui/wxpython/animation/g.gui.animation.py: E501 gui/wxpython/tplot/g.gui.tplot.py: E501 gui/wxpython/iclass/g.gui.iclass.py: E501 - gui/wxpython/location_wizard/wizard.py: E722 gui/wxpython/mapdisp/main.py: E722 gui/wxpython/mapdisp/test_mapdisp.py: E501 gui/wxpython/mapswipe/g.gui.mapswipe.py: E501 diff --git a/gui/wxpython/location_wizard/wizard.py b/gui/wxpython/location_wizard/wizard.py index c12fb22860f..0ed9de4a79c 100644 --- a/gui/wxpython/location_wizard/wizard.py +++ b/gui/wxpython/location_wizard/wizard.py @@ -618,7 +618,7 @@ def OnSearch(self, event): self.proj, self.projdesc = self.projlist.Search( index=[0, 1], pattern=search_str ) - except: + except (IndexError, ValueError): self.proj = self.projdesc = "" event.Skip() @@ -1188,15 +1188,15 @@ def OnDText(self, event): self.datumparams = self.parent.datums[self.datum][2] try: self.datumparams.remove("dx=0.0") - except: + except ValueError: pass try: self.datumparams.remove("dy=0.0") - except: + except ValueError: pass try: self.datumparams.remove("dz=0.0") - except: + except ValueError: pass nextButton.Enable(True) @@ -1211,7 +1211,7 @@ def OnDSearch(self, event): self.datum, self.ellipsoid, self.datumdesc = self.datumlist.Search( index=[0, 1, 2], pattern=search_str ) - except: + except (IndexError, ValueError): self.datum = self.datumdesc = self.ellipsoid = "" event.Skip() @@ -1392,7 +1392,7 @@ def OnSearch(self, event): self.ellipseparams = self.parent.ellipsoids[self.ellipse][1] else: self.ellipseparams = self.parent.planetary_ellipsoids[self.ellipse][1] - except: + except (IndexError, ValueError, KeyError): self.ellipse = self.ellipsedesc = self.ellipseparams = "" event.Skip() @@ -1935,7 +1935,7 @@ def OnText(self, event): self.epsgcode = event.GetString() try: self.epsgcode = int(self.epsgcode) - except: + except ValueError: self.epsgcode = None nextButton = wx.FindWindowById(wx.ID_FORWARD) @@ -1966,7 +1966,7 @@ def OnSearch(self, event): self.epsgcode, self.epsgdesc, self.epsgparams = self.epsglist.Search( index=[0, 1, 2], pattern=value ) - except (IndexError, ValueError): # -> no item found + except (IndexError, ValueError): self.epsgcode = None self.epsgdesc = self.epsgparams = "" self.tcode.SetValue("") @@ -2558,7 +2558,7 @@ def __readData(self): plist.append(p) self.projections[proj.lower().strip()] = (projdesc.strip(), plist) self.projdesc[proj.lower().strip()] = projdesc.strip() - except: + except (ValueError, IndexError): continue f.close() @@ -2620,7 +2620,7 @@ def __readData(self): try: pparam, datatype, proj4term, desc = line.split(":") self.paramdesc[pparam] = (datatype, proj4term, desc) - except: + except ValueError: continue f.close() From 73acfccb90f7799ca7550d022d3b60a8f7cc8ac3 Mon Sep 17 00:00:00 2001 From: Arohan Ajit Date: Fri, 17 Jan 2025 12:52:37 -0500 Subject: [PATCH 2/2] update --- gui/wxpython/location_wizard/wizard.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gui/wxpython/location_wizard/wizard.py b/gui/wxpython/location_wizard/wizard.py index 0ed9de4a79c..52b8a87270d 100644 --- a/gui/wxpython/location_wizard/wizard.py +++ b/gui/wxpython/location_wizard/wizard.py @@ -1966,7 +1966,7 @@ def OnSearch(self, event): self.epsgcode, self.epsgdesc, self.epsgparams = self.epsglist.Search( index=[0, 1, 2], pattern=value ) - except (IndexError, ValueError): + except (IndexError, ValueError): # -> no item found self.epsgcode = None self.epsgdesc = self.epsgparams = "" self.tcode.SetValue("")