Skip to content

Commit

Permalink
checks: Flake8 F841 fixes in the wxpython directory part 1 (#4244)
Browse files Browse the repository at this point in the history
  • Loading branch information
mshukuno authored Sep 18, 2024
1 parent 9420d00 commit 0536351
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 18 deletions.
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

0 comments on commit 0536351

Please sign in to comment.