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

style: Fix superfluous-else rules for raise, continue and break (RET506, RET507, RET508) #4565

Merged
merged 4 commits into from
Oct 27, 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
3 changes: 1 addition & 2 deletions doc/python/m.distance.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,7 @@ def main():
line = sys.stdin.readline().strip()
if not line: # EOF
break
else:
coords.append(line.split(","))
coords.append(line.split(","))
else:
# read from coord= command line option
p = None
Expand Down
7 changes: 3 additions & 4 deletions gui/wxpython/animation/temporal_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -297,10 +297,9 @@ def _getLabelsAndMaps(self, timeseries):
# skip this one, already there
followsPoint = False
continue
else:
# append the last one (of point time)
listOfMaps.append(lastTimeseries)
end = None
# append the last one (of point time)
listOfMaps.append(lastTimeseries)
end = None
else:
# append series which is None
listOfMaps.append(series)
Expand Down
9 changes: 4 additions & 5 deletions gui/wxpython/core/gcmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -311,9 +311,8 @@ def recv_some(p, t=0.1, e=1, tr=5, stderr=0):
if r is None:
if e:
raise Exception(message)
else:
break
elif r:
break
if r:
y.append(decode(r))
else:
time.sleep(max((x - time.time()) / tr, 0))
Expand Down Expand Up @@ -415,7 +414,7 @@ def __init__(
_("Error: ") + self.__GetError(),
)
)
elif rerr == sys.stderr: # redirect message to sys
if rerr == sys.stderr: # redirect message to sys
stderr.write("Execution failed: '%s'" % (" ".join(self.cmd)))
stderr.write(
"%sDetails:%s%s"
Expand Down Expand Up @@ -644,7 +643,7 @@ def _formatMsg(text):
for line in text.splitlines():
if len(line) == 0:
continue
elif (
if (
"GRASS_INFO_MESSAGE" in line
or "GRASS_INFO_WARNING" in line
or "GRASS_INFO_ERROR" in line
Expand Down
16 changes: 8 additions & 8 deletions gui/wxpython/core/render.py
Original file line number Diff line number Diff line change
Expand Up @@ -1184,32 +1184,32 @@ def SetRegion(self, windres=False, windres3=False):
if key == "north":
grass_region += "north: %s; " % (region["n"])
continue
elif key == "south":
if key == "south":
grass_region += "south: %s; " % (region["s"])
continue
elif key == "east":
if key == "east":
grass_region += "east: %s; " % (region["e"])
continue
elif key == "west":
if key == "west":
grass_region += "west: %s; " % (region["w"])
continue
elif key == "e-w resol":
if key == "e-w resol":
grass_region += "e-w resol: %.10f; " % (region["ewres"])
continue
elif key == "n-s resol":
if key == "n-s resol":
grass_region += "n-s resol: %.10f; " % (region["nsres"])
continue
elif key == "cols":
if key == "cols":
if windres:
continue
grass_region += "cols: %d; " % region["cols"]
continue
elif key == "rows":
if key == "rows":
if windres:
continue
grass_region += "rows: %d; " % region["rows"]
continue
elif key == "n-s resol3" and windres3:
if key == "n-s resol3" and windres3:
grass_region += "n-s resol3: %f; " % (region["nsres3"])
elif key == "e-w resol3" and windres3:
grass_region += "e-w resol3: %f; " % (region["ewres3"])
Expand Down
4 changes: 2 additions & 2 deletions gui/wxpython/dbmgr/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -1659,8 +1659,8 @@ def OnDataItemAdd(self, event):
raise ValueError(
_("Category number (column %s) is missing.") % keyColumn
)
else:
continue

continue

try:
if tlist.columns[columnName[i]]["ctype"] == int:
Expand Down
17 changes: 8 additions & 9 deletions gui/wxpython/dbmgr/dialogs.py
Original file line number Diff line number Diff line change
Expand Up @@ -648,15 +648,14 @@ def __init__(
self.boxSizer = wx.StaticBoxSizer(box, wx.VERTICAL)
cId += 1
continue
else:
valueWin = SpinCtrl(
parent=self.dataPanel,
id=wx.ID_ANY,
value=value,
min=-1e9,
max=1e9,
size=(250, -1),
)
valueWin = SpinCtrl(
parent=self.dataPanel,
id=wx.ID_ANY,
value=value,
min=-1e9,
max=1e9,
size=(250, -1),
)
else:
valueWin = TextCtrl(
parent=self.dataPanel, id=wx.ID_ANY, value=value, size=(250, -1)
Expand Down
2 changes: 1 addition & 1 deletion gui/wxpython/gui_core/widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -1603,7 +1603,7 @@ def _loadSettings_v2(self, fd_lines):
idx = line.find(";", i_last)
if idx < 0:
break
elif idx != 0:
if idx != 0:
# find out whether it is separator
# $$$$; - it is separator
# $$$$$; - it is not separator
Expand Down
5 changes: 2 additions & 3 deletions gui/wxpython/iclass/dialogs.py
Original file line number Diff line number Diff line change
Expand Up @@ -486,9 +486,8 @@ def GetSelectedIndices(self, state=wx.LIST_STATE_SELECTED):
index = self.GetNextItem(lastFound, wx.LIST_NEXT_ALL, state)
if index == -1:
break
else:
lastFound = index
indices.append(index)
lastFound = index
indices.append(index)
return indices

def OnEdit(self, event):
Expand Down
5 changes: 2 additions & 3 deletions gui/wxpython/iscatt/frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -501,9 +501,8 @@ def GetSelectedIndices(self, state=wx.LIST_STATE_SELECTED):
index = self.GetNextItem(lastFound, wx.LIST_NEXT_ALL, state)
if index == -1:
break
else:
lastFound = index
indices.append(index)
lastFound = index
indices.append(index)
return indices

def DeselectAll(self):
Expand Down
3 changes: 1 addition & 2 deletions gui/wxpython/location_wizard/wizard.py
Original file line number Diff line number Diff line change
Expand Up @@ -900,8 +900,7 @@ def OnPageChange(self, event=None):
if param["type"] == "bool":
if param["value"] is False:
continue
else:
self.p4projparams += " +" + param["proj4"]
self.p4projparams += " +" + param["proj4"]
elif param["value"] is None:
wx.MessageBox(
parent=self,
Expand Down
Loading
Loading