diff --git a/gui/wxpython/animation/controller.py b/gui/wxpython/animation/controller.py index 3e914e68112..abb5ef202ea 100644 --- a/gui/wxpython/animation/controller.py +++ b/gui/wxpython/animation/controller.py @@ -36,6 +36,7 @@ HashCmds, ) from animation.data import AnimationData +from itertools import starmap class AnimationController(wx.EvtHandler): @@ -368,10 +369,7 @@ def _updateAnimations(self, activeIndices, mapNamesDict=None): if anim.viewMode == "3d": regions = [None] * len(regions) self.animations[i].SetFrames( - [ - HashCmds(cmdList, region) - for cmdList, region in zip(anim.cmdMatrix, regions) - ] + list(starmap(HashCmds, zip(anim.cmdMatrix, regions))) ) self.animations[i].SetActive(True) else: diff --git a/gui/wxpython/animation/temporal_manager.py b/gui/wxpython/animation/temporal_manager.py index 4c1816fea19..2e7b14cefa5 100644 --- a/gui/wxpython/animation/temporal_manager.py +++ b/gui/wxpython/animation/temporal_manager.py @@ -116,8 +116,7 @@ def _setTemporalState(self): # check for units for relative type if relative: units = set() - for infoDict in self.timeseriesInfo.values(): - units.add(infoDict["unit"]) + units.update(infoDict["unit"] for infoDict in self.timeseriesInfo.values()) if len(units) > 1: message = _( "It is not allowed to display data with different units (%s)." diff --git a/gui/wxpython/animation/utils.py b/gui/wxpython/animation/utils.py index 7f20c74f4cc..9e5f685545e 100644 --- a/gui/wxpython/animation/utils.py +++ b/gui/wxpython/animation/utils.py @@ -214,8 +214,7 @@ def checkSeriesCompatibility(mapSeriesList=None, timeseriesList=None): if mapSeriesList: count = set() - for mapSeries in mapSeriesList: - count.add(len(mapSeries)) + count.update(len(mapSeries) for mapSeries in mapSeriesList) if len(count) > 1: raise GException( _( diff --git a/gui/wxpython/core/render.py b/gui/wxpython/core/render.py index f9fcb4fd4d4..6fe9d7f4592 100644 --- a/gui/wxpython/core/render.py +++ b/gui/wxpython/core/render.py @@ -883,7 +883,7 @@ def _projInfo(self): for line in ret.splitlines(): if ":" in line: key, val = (x.strip() for x in line.split(":", 1)) - if key in {"units"}: + if key == "units": val = val.lower() projinfo[key] = val elif "XY location (unprojected)" in line: diff --git a/gui/wxpython/core/toolboxes.py b/gui/wxpython/core/toolboxes.py index c10167b639a..e9960ac2e62 100644 --- a/gui/wxpython/core/toolboxes.py +++ b/gui/wxpython/core/toolboxes.py @@ -82,7 +82,7 @@ def getMessages(): def clearMessages(): - del _MESSAGES[:] + _MESSAGES.clear() def _debug(level, message): diff --git a/gui/wxpython/mapwin/buffered.py b/gui/wxpython/mapwin/buffered.py index d8d7a3fb667..6ce7f98731e 100644 --- a/gui/wxpython/mapwin/buffered.py +++ b/gui/wxpython/mapwin/buffered.py @@ -1530,7 +1530,7 @@ def OnDragging(self, event): self.mouse["end"] = event.GetPosition() if event.LeftIsDown() and not ( digitToolbar - and digitToolbar.GetAction() in {"moveLine"} + and digitToolbar.GetAction() == "moveLine" and len(self.digit.GetDisplay().GetSelected()) > 0 ): self.MouseDraw(pdc=self.pdcTmp) diff --git a/gui/wxpython/psmap/dialogs.py b/gui/wxpython/psmap/dialogs.py index 8ee3661d8b5..cfc9f85bed8 100644 --- a/gui/wxpython/psmap/dialogs.py +++ b/gui/wxpython/psmap/dialogs.py @@ -3978,7 +3978,7 @@ def OnIsLegend(self, event): if page == 0 or event is None: children = self.panelRaster.GetChildren() if self.isRLegend.GetValue(): - for i, widget in enumerate(children): + for widget in children: widget.Enable() self.OnRaster(None) self.OnRange(None) @@ -3990,7 +3990,7 @@ def OnIsLegend(self, event): if page == 1 or event is None: children = self.panelVector.GetChildren() if self.isVLegend.GetValue(): - for i, widget in enumerate(children): + for widget in children: widget.Enable() self.OnSpan(None) self.OnBorder(None) diff --git a/lib/init/grass.py b/lib/init/grass.py index 00baa12f1b3..3548eab2b08 100755 --- a/lib/init/grass.py +++ b/lib/init/grass.py @@ -2520,7 +2520,7 @@ def main(): ) if sh in {"csh", "tcsh"}: shell_process = csh_startup(mapset_settings.full_mapset, grass_env_file) - elif sh in {"zsh"}: + elif sh == "zsh": shell_process = sh_like_startup( mapset_settings.full_mapset, mapset_settings.location, diff --git a/pyproject.toml b/pyproject.toml index 50e9f651b0f..4cc2f9a3d8d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -154,13 +154,8 @@ ignore = [ "FURB101", # read-whole-file "FURB103", # write-whole-file. "FURB118", # reimplemented-operator - "FURB131", # delete-full-slice - "FURB140", # reimplemented-starmap - "FURB142", # for-loop-set-mutations - "FURB148", # unnecessary-enumerate "FURB152", # math-constant "FURB154", # repeated-global - "FURB171", # single-item-membership-test "I001", # unsorted-imports "ISC003", # explicit-string-concatenation "PERF203", # try-except-in-loop diff --git a/python/grass/grassdb/history.py b/python/grass/grassdb/history.py index ba9ed818f36..85ebdb5b452 100644 --- a/python/grass/grassdb/history.py +++ b/python/grass/grassdb/history.py @@ -162,7 +162,7 @@ def filter(json_data, command, timestamp): return None -def _remove_entry_from_plain_text(history_path, index): +def _remove_entry_from_plain_text(history_path, index: int): """Remove entry from plain text history file. :param str history_path: path to the history log file @@ -174,7 +174,7 @@ def _remove_entry_from_plain_text(history_path, index): file_history.seek(0) file_history.truncate() for number, line in enumerate(lines): - if number not in [index]: + if number != index: file_history.write(line) except OSError as e: raise OSError( @@ -184,7 +184,7 @@ def _remove_entry_from_plain_text(history_path, index): ) from e -def _remove_entry_from_JSON(history_path, index): +def _remove_entry_from_JSON(history_path, index: int): """Remove entry from JSON history file. :param str history_path: path to the history log file @@ -214,7 +214,7 @@ def _remove_entry_from_JSON(history_path, index): ) from e -def remove_entry(history_path, index): +def remove_entry(history_path, index: int): """Remove entry from history file. :param str history_path: path to the history log file diff --git a/scripts/g.extension/g.extension.py b/scripts/g.extension/g.extension.py index a944701f77a..7103a9e4f15 100644 --- a/scripts/g.extension/g.extension.py +++ b/scripts/g.extension/g.extension.py @@ -1900,7 +1900,7 @@ def download_source_code( ) ) download_source_code_svn(url, name, outdev, directory) - elif source in {"remote_zip"}: + elif source == "remote_zip": gs.message( _("Fetching <{name}> from <{url}> (be patient)...").format( name=name, url=url