Skip to content

Commit

Permalink
style: Fix unnecessary-paren-on-raise-exception (RSE102)
Browse files Browse the repository at this point in the history
  • Loading branch information
echoix committed Oct 5, 2024
1 parent a16a02f commit d074e21
Show file tree
Hide file tree
Showing 9 changed files with 35 additions and 36 deletions.
40 changes: 20 additions & 20 deletions gui/wxpython/core/giface.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def GetSelectedLayers(self, checkedOnly=True):
However, this may be the same for some implementations
(e.g. it d.mon has all layers checked and selected).
"""
raise NotImplementedError()
raise NotImplementedError

def GetSelectedLayer(self, checkedOnly=False):
"""Returns selected layer or None when there is no selected layer.
Expand All @@ -69,7 +69,7 @@ def GetSelectedLayer(self, checkedOnly=False):
Parameter checkedOnly is here False by default. This might
change if we find the right way of handling unchecked layers.
"""
raise NotImplementedError()
raise NotImplementedError

def AddLayer(self, ltype, name=None, checked=None, opacity=1.0, cmd=None):
"""Adds a new layer to the layer list.
Expand All @@ -82,7 +82,7 @@ def AddLayer(self, ltype, name=None, checked=None, opacity=1.0, cmd=None):
:param opacity: layer opacity level
:param cmd: command (given as a list)
"""
raise NotImplementedError()
raise NotImplementedError

def GetLayersByName(self, name):
"""Returns list of layers with a given name.
Expand All @@ -93,7 +93,7 @@ def GetLayersByName(self, name):
if common usage is just to check the presence of layer,
intoroduce a new method ContainsLayerByName(name)
"""
raise NotImplementedError()
raise NotImplementedError

def GetLayerByData(self, key, value):
"""Returns layer with specified.
Expand All @@ -104,7 +104,7 @@ def GetLayerByData(self, key, value):
.. warning::
Avoid using this method, it might be removed in the future.
"""
raise NotImplementedError()
raise NotImplementedError


class GrassInterface:
Expand All @@ -118,43 +118,43 @@ class GrassInterface:

def RunCmd(self, *args, **kwargs):
"""Executes a command."""
raise NotImplementedError()
raise NotImplementedError

def Help(self, entry):
"""Shows a manual page for a given entry."""
raise NotImplementedError()
raise NotImplementedError

def WriteLog(self, text, wrap=None, notification=Notification.HIGHLIGHT):
"""Writes log message."""
raise NotImplementedError()
raise NotImplementedError

def WriteCmdLog(self, text, pid=None, notification=Notification.MAKE_VISIBLE):
"""Writes message related to start or end of the command."""
raise NotImplementedError()
raise NotImplementedError

def WriteWarning(self, text):
"""Writes warning message for the user."""
raise NotImplementedError()
raise NotImplementedError

def WriteError(self, text):
"""Writes error message for the user."""
raise NotImplementedError()
raise NotImplementedError

def GetLog(self, err=False):
"""Returns file-like object for writing."""
raise NotImplementedError()
raise NotImplementedError

def GetLayerTree(self):
"""Returns LayerManager's tree GUI object.
.. note::
Will be removed from the interface.
"""
raise NotImplementedError()
raise NotImplementedError

def GetLayerList(self):
"""Returns a layer management object."""
raise NotImplementedError()
raise NotImplementedError

def GetMapDisplay(self):
"""Returns current map display.
Expand All @@ -166,7 +166,7 @@ def GetMapDisplay(self):
:return: MapFrame instance
:return: None when no mapdisplay open
"""
raise NotImplementedError()
raise NotImplementedError

def GetAllMapDisplays(self):
"""Get list of all map displays.
Expand All @@ -177,7 +177,7 @@ def GetAllMapDisplays(self):
:return: list of MapFrame instances
"""
raise NotImplementedError()
raise NotImplementedError

def GetMapWindow(self):
"""Returns current map window.
Expand All @@ -186,7 +186,7 @@ def GetMapWindow(self):
For layer related tasks use GetLayerList().
"""
raise NotImplementedError()
raise NotImplementedError

def GetProgress(self):
"""Returns object which shows the progress.
Expand All @@ -195,7 +195,7 @@ def GetProgress(self):
Some implementations may not implement this method.
"""
raise NotImplementedError()
raise NotImplementedError


class StandaloneGrassInterface(GrassInterface):
Expand Down Expand Up @@ -343,9 +343,9 @@ def GetAllMapDisplays(self):
return []

def GetMapWindow(self):
raise NotImplementedError()
raise NotImplementedError

def GetProgress(self):
# TODO: implement some progress with same inface as gui one
# (probably using g.message or similarly to Write... functions)
raise NotImplementedError()
raise NotImplementedError
2 changes: 1 addition & 1 deletion gui/wxpython/core/gthread.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ def localtrace(self, frame, event, arg):
if event == "line":
# Send event
wx.PostEvent(self, self._terminate_evt)
raise SystemExit()
raise SystemExit
return self.localtrace

def OnTerminate(self, event):
Expand Down
2 changes: 1 addition & 1 deletion gui/wxpython/core/layerlist.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ def GetLayerByData(self, key, value):
.. warning::
Avoid using this method, it might be removed in the future.
"""
raise NotImplementedError()
raise NotImplementedError

def GetLayerIndex(self, layer):
"""Get index of layer."""
Expand Down
8 changes: 4 additions & 4 deletions gui/wxpython/mapwin/analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,20 +93,20 @@ def _doAnalysis(self, coords):
:param coords: EN coordinates
"""
raise NotImplementedError()
raise NotImplementedError

def _disconnectAll(self):
"""Disconnect all mouse signals
to stop drawing."""
raise NotImplementedError()
raise NotImplementedError

def _connectAll(self):
"""Connect all mouse signals to draw."""
raise NotImplementedError()
raise NotImplementedError

def _getPen(self):
"""Returns wx.Pen instance."""
raise NotImplementedError()
raise NotImplementedError

def Stop(self, restore=True):
"""Analysis mode is stopped.
Expand Down
8 changes: 4 additions & 4 deletions gui/wxpython/mapwin/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -370,10 +370,10 @@ def UnregisterMouseEventHandler(self, event, handler):
return True

def Pixel2Cell(self, xyCoords):
raise NotImplementedError()
raise NotImplementedError

def Cell2Pixel(self, enCoords):
raise NotImplementedError()
raise NotImplementedError

def OnMotion(self, event):
"""Tracks mouse motion and update statusbar
Expand Down Expand Up @@ -453,8 +453,8 @@ def SetModeQuery(self):

def DisactivateWin(self):
"""Use when the class instance is hidden in MapFrame."""
raise NotImplementedError()
raise NotImplementedError

def ActivateWin(self):
"""Used when the class instance is activated in MapFrame."""
raise NotImplementedError()
raise NotImplementedError
6 changes: 3 additions & 3 deletions gui/wxpython/modules/import_export.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,15 +236,15 @@ def doLayout(self):

def _getCommand(self):
"""Get command"""
raise NotImplementedError()
raise NotImplementedError

def _getBlackListedParameters(self):
"""Get parameters which will not be showed in Settings page"""
raise NotImplementedError()
raise NotImplementedError

def _getBlackListedFlags(self):
"""Get flags which will not be showed in Settings page"""
raise NotImplementedError()
raise NotImplementedError

def _nameValidationFailed(self, layers_list):
"""Output map name validation callback
Expand Down
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,6 @@ ignore = [
"RET506", # superfluous-else-raise
"RET507", # superfluous-else-continue
"RET508", # superfluous-else-break
"RSE102", # unnecessary-paren-on-raise-exception
"RUF003", # ambiguous-unicode-character-comment
"RUF005", # collection-literal-concatenation
"RUF012", # mutable-class-default
Expand Down
2 changes: 1 addition & 1 deletion python/grass/imaging/images2swf.py
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ def __init__(self):

def ProcessTag(self):
"""Implement this to create the tag."""
raise NotImplementedError()
raise NotImplementedError

def GetTag(self):
"""Calls processTag and attaches the header."""
Expand Down
2 changes: 1 addition & 1 deletion python/grass/pygrass/vector/geometry.py
Original file line number Diff line number Diff line change
Expand Up @@ -1869,7 +1869,7 @@ def c_read_next_line(c_mapinfo, c_points, c_cats):
v_id = v_id if v_id != 0 else None
ftype = libvect.Vect_read_next_line(c_mapinfo, c_points, c_cats)
if ftype == -2:
raise StopIteration()
raise StopIteration
if ftype == -1:
raise
return ftype, v_id, c_points, c_cats
Expand Down

0 comments on commit d074e21

Please sign in to comment.