Skip to content

Commit

Permalink
checks: Flake8 F841 fixes in the wxpython directory part 2 (OSGeo#4253)
Browse files Browse the repository at this point in the history
  • Loading branch information
mshukuno authored and Mahesh1998 committed Sep 19, 2024
1 parent 1cc88cb commit fb5c18e
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 20 deletions.
7 changes: 3 additions & 4 deletions .flake8
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 3 additions & 5 deletions gui/wxpython/dbmgr/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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
Expand Down Expand Up @@ -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")
Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion gui/wxpython/dbmgr/dialogs.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = ""
Expand Down
7 changes: 0 additions & 7 deletions gui/wxpython/dbmgr/sqlbuilder.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)

Expand Down
3 changes: 0 additions & 3 deletions gui/wxpython/dbmgr/vinfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit fb5c18e

Please sign in to comment.