From fb5c18e737f453adfbead8056df07a710f48cd3f Mon Sep 17 00:00:00 2001 From: Makiko Shukunobe Date: Wed, 4 Sep 2024 15:57:38 -0400 Subject: [PATCH] checks: Flake8 F841 fixes in the wxpython directory part 2 (#4253) --- .flake8 | 7 +++---- gui/wxpython/dbmgr/base.py | 8 +++----- gui/wxpython/dbmgr/dialogs.py | 1 - gui/wxpython/dbmgr/sqlbuilder.py | 7 ------- gui/wxpython/dbmgr/vinfo.py | 3 --- 5 files changed, 6 insertions(+), 20 deletions(-) diff --git a/.flake8 b/.flake8 index 573debabe1c..18cea9165ce 100644 --- a/.flake8 +++ b/.flake8 @@ -52,11 +52,10 @@ per-file-ignores = gui/wxpython/core/settings.py: E722 gui/wxpython/core/watchdog.py: E402 gui/wxpython/datacatalog/tree.py: E731, E402 - gui/wxpython/dbmgr/base.py: E722, F841 - gui/wxpython/dbmgr/dialogs.py: F841, E722 - gui/wxpython/dbmgr/sqlbuilder.py: E722, F841 + gui/wxpython/dbmgr/base.py: E722 + gui/wxpython/dbmgr/dialogs.py: E722 + gui/wxpython/dbmgr/sqlbuilder.py: E722 gui/wxpython/dbmgr/manager.py: E722 - gui/wxpython/dbmgr/vinfo.py: F841 gui/wxpython/docs/wxgui_sphinx/conf.py: E402, W291 gui/wxpython/gcp/g.gui.gcp.py: F841 gui/wxpython/gcp/manager.py: F841, E722 diff --git a/gui/wxpython/dbmgr/base.py b/gui/wxpython/dbmgr/base.py index 1c4349bdd8c..66321fcafda 100644 --- a/gui/wxpython/dbmgr/base.py +++ b/gui/wxpython/dbmgr/base.py @@ -228,7 +228,7 @@ def LoadData(self, layer, columns=None, where=None, sql=None): if sql: cmdParams.update({"sql": sql, "output": outFile.name, "overwrite": True}) - ret = RunCommand("db.select", **cmdParams) + RunCommand("db.select", **cmdParams) self.sqlFilter = {"sql": sql} else: cmdParams.update( @@ -246,7 +246,7 @@ def LoadData(self, layer, columns=None, where=None, sql=None): # Enclose column name with SQL standard double quotes cmdParams.update({"columns": ",".join([f'"{col}"' for col in columns])}) - ret = RunCommand("v.db.select", **cmdParams) + RunCommand("v.db.select", **cmdParams) # These two should probably be passed to init more cleanly # setting the numbers of items = number of elements in the dictionary @@ -296,7 +296,7 @@ def LoadData(self, layer, columns=None, where=None, sql=None): record = ( decode(outFile.readline(), encoding=enc).strip().replace("\n", "") ) - except UnicodeDecodeError as e: + except UnicodeDecodeError: record = ( outFile.readline() .decode(encoding=enc, errors="replace") @@ -965,7 +965,6 @@ def OnLayerPageChanged(self, event): pass if idCol: - winCol = self.FindWindowById(idCol) table = self.dbMgrData["mapDBInfo"].layers[self.selLayer]["table"] self.dbMgrData["mapDBInfo"].GetColumns(table) @@ -2687,7 +2686,6 @@ def OnTableItemDelete(self, event): tlist = self.FindWindowById(self.layerPage[self.selLayer]["tableData"]) item = tlist.GetFirstSelected() - countSelected = tlist.GetSelectedItemCount() if UserSettings.Get(group="atm", key="askOnDeleteRec", subkey="enabled"): # if the user select more columns to delete, all the columns name # will appear the the warning dialog diff --git a/gui/wxpython/dbmgr/dialogs.py b/gui/wxpython/dbmgr/dialogs.py index 757fde03cbf..26e6d876371 100644 --- a/gui/wxpython/dbmgr/dialogs.py +++ b/gui/wxpython/dbmgr/dialogs.py @@ -305,7 +305,6 @@ def OnReset(self, event=None): columns = self.mapDBInfo.tables[table] for idx in range(len(columns[key]["values"])): for name in columns.keys(): - type = columns[name]["type"] value = columns[name]["values"][idx] if value is None: value = "" diff --git a/gui/wxpython/dbmgr/sqlbuilder.py b/gui/wxpython/dbmgr/sqlbuilder.py index 92867b9ec82..36827698efc 100644 --- a/gui/wxpython/dbmgr/sqlbuilder.py +++ b/gui/wxpython/dbmgr/sqlbuilder.py @@ -356,7 +356,6 @@ def _doLayout(self, modeChoices, showDbInfo=False): def OnUniqueValues(self, event, justsample=False): """Get unique values""" - vals = [] try: idx = self.list_columns.GetSelections()[0] column = self.list_columns.GetString(idx) @@ -415,12 +414,6 @@ def OnAddValue(self, event): idx = selection[0] value = self.list_values.GetString(idx) - idx = self.list_columns.GetSelections()[0] - column = self.list_columns.GetString(idx) - - ctype = self.dbInfo.GetTableDesc(self.dbInfo.GetTable(self.layer))[column][ - "type" - ] self._add(element="value", value=value) diff --git a/gui/wxpython/dbmgr/vinfo.py b/gui/wxpython/dbmgr/vinfo.py index afb0a716063..6b04ee7a64e 100644 --- a/gui/wxpython/dbmgr/vinfo.py +++ b/gui/wxpython/dbmgr/vinfo.py @@ -102,9 +102,6 @@ def SelectByPoint(self, queryCoords, qdist): """Get attributes by coordinates (all available layers) Return line id or None if no line is found""" - line = None - nselected = 0 - try: data = gs.vector_what( map=self.map,