Преглед на файлове

wxGUI: Enable unused var warning (#1502)

Enable Flake8 unused variable warning (F841) mostly by ignoring it for files and directories using per-file-ignores.
Vaclav Petras преди 4 години
родител
ревизия
0e5144f80c
променени са 4 файла, в които са добавени 39 реда и са изтрити 8 реда
  1. 30 1
      gui/wxpython/.flake8
  2. 2 2
      gui/wxpython/iclass/toolbars.py
  3. 6 4
      gui/wxpython/location_wizard/wizard.py
  4. 1 1
      gui/wxpython/mapswipe/frame.py

+ 30 - 1
gui/wxpython/.flake8

@@ -9,7 +9,6 @@ ignore =
     E741, # ambiguous variable name 'l'
     F403, # 'from gmodeler.model import *' used; unable to detect undefined names
     F405, # '_' may be undefined, or defined from star imports: gmodeler.model
-    F841, # local variable 'dc' is assigned to but never used
     E117, # over-indented
     E122, # continuation line missing indentation or outdented
     E123, # closing bracket does not match indentation of opening bracket's line
@@ -41,6 +40,36 @@ ignore =
     W503, # line break before binary operator
     W504, # line break after binary operator
 
+per-file-ignores =
+    # Many of these ignores can and should be removed and the problem fixed.
+    # F841 local variable is assigned to but never used
+    core/*: F841
+    dbmgr/*: F841
+    gcp/*: F841
+    gmodeler/*: F841
+    gui_core/*: F841
+    image2target/*: F841
+    iscatt/*: F841
+    lmgr/*: F841
+    modules/*: F841
+    nviz/*: F841
+    photo2image/*: F841
+    psmap/*: F841
+    vdigit/*: F841
+    vnet/*: F841
+    wxgui.py: F841
+    animation/mapwindow.py: F841
+    animation/provider.py: F841
+    tplot/frame.py: F841
+    rdigit/g.gui.rdigit.py: F841
+    iclass/statistics.py: F841
+    wxplot/profile.py: F841
+    wxplot/base.py: F841
+    location_wizard/dialogs.py: F841
+    mapdisp/statusbar.py: F841
+    web_services/widgets.py: F841
+    rlisetup/sampling_frame.py: F841
+
 max-line-length = 88
 exclude =
     .git,

+ 2 - 2
gui/wxpython/iclass/toolbars.py

@@ -148,7 +148,7 @@ class IClassToolbar(BaseToolbar):
         self.InitToolbar(self._toolbarData())
 
         self.choice = wx.Choice(parent=self, id=wx.ID_ANY, size=(110, -1))
-        choiceid = self.InsertControl(3, self.choice)
+        self.InsertControl(3, self.choice)
 
         self.choice.Bind(wx.EVT_CHOICE, self.OnSelectCategory)
 
@@ -158,7 +158,7 @@ class IClassToolbar(BaseToolbar):
         self.combo = wx.ComboBox(self, id=wx.ID_ANY, size=(130, -1),
                                  style=wx.TE_PROCESS_ENTER)
         self.InitStddev()
-        comboid = self.InsertControl(5, self.combo)
+        self.InsertControl(5, self.combo)
 
         self.EnableControls(False)
 

+ 6 - 4
gui/wxpython/location_wizard/wizard.py

@@ -2548,10 +2548,12 @@ class LocationWizard(wx.Object):
                 try:
                     os.mkdir(database)
                 except OSError as error:
-                    GError(parent=self.wizard,
-                           message="%s <%s>" %
-                           (_("Unable to create new GRASS Database"),
-                            database))
+                    GError(
+                        parent=self.wizard,
+                        message=_(
+                            "Unable to create new GRASS Database <{path}>: {error}"
+                        ).format(path=database, error=error),
+                    )
                     return None
 
             # location created in alternate GISDbase

+ 1 - 1
gui/wxpython/mapswipe/frame.py

@@ -455,7 +455,7 @@ class SwipeMapFrame(DoubleMapFrame):
         mapInstance.DeleteAllLayers()
         cmdlist = ['d.rast', 'map=%s' % name]
         # add layer to Map instance (core.render)
-        newLayer = mapInstance.AddLayer(
+        mapInstance.AddLayer(
             ltype='raster',
             command=cmdlist,
             active=True,