Skip to content
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

checks: Flake8 F841 fixes in the wxpython directory part 1 #4244

Merged
merged 5 commits into from
Sep 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions .flake8
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,11 @@ per-file-ignores =
locale/grass_po_stats.py: E122, E128, E231, E401, E722
gui/scripts/d.wms.py: E501
gui/wxpython/core/gcmd.py: E402
gui/wxpython/core/gthread.py: F841
gui/wxpython/core/gconsole.py: E722
gui/wxpython/core/toolboxes.py: E722
gui/wxpython/core/utils.py: E722, F841
gui/wxpython/core/utils.py: E722
gui/wxpython/core/workspace.py: E722
gui/wxpython/core/render.py: E722, F841
gui/wxpython/core/ws.py: F841
gui/wxpython/core/render.py: E722
gui/wxpython/core/settings.py: E722
gui/wxpython/core/watchdog.py: E402
gui/wxpython/datacatalog/tree.py: E731, E402
Expand Down Expand Up @@ -71,8 +69,6 @@ per-file-ignores =
gui/wxpython/vnet/*: F841
gui/wxpython/wxgui.py: F841
gui/wxpython/animation/g.gui.animation.py: E501
gui/wxpython/animation/mapwindow.py: F841
gui/wxpython/animation/provider.py: F841
gui/wxpython/tplot/frame.py: F841, E722
gui/wxpython/tplot/g.gui.tplot.py: E501
gui/wxpython/rdigit/g.gui.rdigit.py: F841
Expand Down
2 changes: 1 addition & 1 deletion gui/wxpython/animation/mapwindow.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def Draw(self, dc):
def OnPaint(self, event):
Debug.msg(5, "BufferedWindow.OnPaint()")
# All that is needed here is to draw the buffer to screen
dc = wx.BufferedPaintDC(self, self._Buffer)
wx.BufferedPaintDC(self, self._Buffer)

def OnSize(self, event):
Debug.msg(5, "BufferedWindow.OnSize()")
Expand Down
2 changes: 1 addition & 1 deletion gui/wxpython/animation/provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -924,7 +924,7 @@ def test():
prov.mapsLoaded.connect(lambda: sys.stdout.write("Maps loading finished\n"))
cmdMatrix = layerListToCmdsMatrix(layerList)
prov.SetCmds(cmdMatrix, [layer.opacity for layer in layerList])
app = wx.App()
wx.App()

prov.Load(bgcolor=(13, 156, 230), nprocs=4)

Expand Down
2 changes: 0 additions & 2 deletions gui/wxpython/core/gthread.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,6 @@ def run(self):
else:
vars()[key] = None

requestTime = time.time()

ret = None
exception = None
time.sleep(0.01)
Expand Down
2 changes: 0 additions & 2 deletions gui/wxpython/core/render.py
Original file line number Diff line number Diff line change
Expand Up @@ -666,8 +666,6 @@ def OnRenderDone(self, env):

Make image composiotion, emits updateMap event.
"""
stopTime = time.time()

maps = []
masks = []
opacities = []
Expand Down
16 changes: 12 additions & 4 deletions gui/wxpython/core/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -827,8 +827,12 @@ def StoreEnvVariable(key, value=None, envFile=None):
if os.path.exists(envFile):
try:
fd = open(envFile)
except OSError as e:
sys.stderr.write(_("Unable to open file '%s'\n") % envFile)
except OSError as error:
sys.stderr.write(
_("Unable to open file '{name}': {error}\n").format(
name=envFile, error=error
)
)
return
for line in fd:
line = line.rstrip(os.linesep)
Expand Down Expand Up @@ -857,8 +861,12 @@ def StoreEnvVariable(key, value=None, envFile=None):
# write update env file
try:
fd = open(envFile, "w")
except OSError as e:
sys.stderr.write(_("Unable to create file '%s'\n") % envFile)
except OSError as error:
sys.stderr.write(
_("Unable to create file '{name}': {error}\n").format(
name=envFile, error=error
)
)
return
if windows:
expCmd = "set"
Expand Down
2 changes: 0 additions & 2 deletions gui/wxpython/core/ws.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ def Render(self, cmd, env):

self.updateMap = True
fetchData = True # changed to True when calling Render()
zoomChanged = False

if self.renderedRegion is None or cmd != self.fetched_data_cmd:
fetchData = True
Expand All @@ -111,7 +110,6 @@ def Render(self, cmd, env):

for c in ["e-w resol", "n-s resol"]:
if self.renderedRegion and region[c] != self.renderedRegion[c]:
zoomChanged = True
break

if fetchData:
Expand Down
Loading