diff --git a/general/g.remove/testsuite/test_g_remove.py b/general/g.remove/testsuite/test_g_remove.py index 955466f29ca..10c3018f67a 100644 --- a/general/g.remove/testsuite/test_g_remove.py +++ b/general/g.remove/testsuite/test_g_remove.py @@ -52,7 +52,7 @@ def tearDownClass(cls): def test_remove_procedure(self): """Test that maps are removed only with -f""" - for i in range(0, 10): + for i in range(10): rmapcalc("test_map_%i = 100" % i) rmapcalc("test_two = 2") diff --git a/gui/wxpython/core/workspace.py b/gui/wxpython/core/workspace.py index be4eb1fda37..22aa56bfe62 100644 --- a/gui/wxpython/core/workspace.py +++ b/gui/wxpython/core/workspace.py @@ -933,7 +933,7 @@ def __init__(self, lmgr, file): file.write("{indent}\n".format(indent=" " * self.indent)) # list of displays - for page in range(0, self.lmgr.GetLayerNotebook().GetPageCount()): + for page in range(self.lmgr.GetLayerNotebook().GetPageCount()): dispName = self.lmgr.GetLayerNotebook().GetPageText(page) mapTree = self.lmgr.GetLayerNotebook().GetPage(page).maptree region = mapTree.GetMap().GetCurrentRegion() diff --git a/gui/wxpython/gui_core/gselect.py b/gui/wxpython/gui_core/gselect.py index ec873f60eb4..86683476c2e 100644 --- a/gui/wxpython/gui_core/gselect.py +++ b/gui/wxpython/gui_core/gselect.py @@ -2745,7 +2745,7 @@ def __init__( if elements: values = [] valuesDesc = [] - for idx in range(0, len(self.values)): + for idx in range(len(self.values)): value = self.values[idx] if value in elements: values.append(value) diff --git a/gui/wxpython/gui_core/menu.py b/gui/wxpython/gui_core/menu.py index de6b49b7e93..b284461af0a 100644 --- a/gui/wxpython/gui_core/menu.py +++ b/gui/wxpython/gui_core/menu.py @@ -444,7 +444,7 @@ def RemoveFileFromHistory(self, file_index): def RemoveNonExistentFiles(self): """Remove non existent files from the history""" - for i in reversed(range(0, self._filehistory.GetCount())): + for i in reversed(range(self._filehistory.GetCount())): file = self._filehistory.GetHistoryFile(index=i) if not os.path.exists(file): self._filehistory.RemoveFileFromHistory(i=i) diff --git a/gui/wxpython/lmgr/frame.py b/gui/wxpython/lmgr/frame.py index f9ce45c813b..9673ab0f1e5 100644 --- a/gui/wxpython/lmgr/frame.py +++ b/gui/wxpython/lmgr/frame.py @@ -1093,7 +1093,7 @@ def GetMapDisplay(self, onlyCurrent=True): return None else: # -> return list of all mapdisplays mlist = [] - for idx in range(0, self.notebookLayers.GetPageCount()): + for idx in range(self.notebookLayers.GetPageCount()): mlist.append(self.notebookLayers.GetPage(idx).maptree.GetMapDisplay()) return mlist @@ -1906,7 +1906,7 @@ def _onMapDisplayStarting3dMode(self, mapDisplayPage): """Disables 3D mode for all map displays except for @p mapDisplay""" # TODO: it should be disabled also for newly created map windows # moreover mapdisp.Disable3dMode() does not work properly - for page in range(0, self.GetLayerNotebook().GetPageCount()): + for page in range(self.GetLayerNotebook().GetPageCount()): mapdisp = self.GetLayerNotebook().GetPage(page).maptree.GetMapDisplay() if self.GetLayerNotebook().GetPage(page) != mapDisplayPage: mapdisp.Disable3dMode() diff --git a/gui/wxpython/main_window/frame.py b/gui/wxpython/main_window/frame.py index 8fc8dc8dde7..0bb28afd883 100644 --- a/gui/wxpython/main_window/frame.py +++ b/gui/wxpython/main_window/frame.py @@ -1244,7 +1244,7 @@ def GetMapDisplay(self, onlyCurrent=True): return None else: # -> return list of all mapdisplays mlist = [] - for idx in range(0, self.notebookLayers.GetPageCount()): + for idx in range(self.notebookLayers.GetPageCount()): mlist.append(self.notebookLayers.GetPage(idx).maptree.GetMapDisplay()) return mlist @@ -2054,7 +2054,7 @@ def _onStarting3dMode(self, mapDisplayPage): """Disables 3D mode for all map displays except for @p mapDisplay""" # TODO: it should be disabled also for newly created map windows # moreover mapdisp.Disable3dMode() does not work properly - for page in range(0, self.GetLayerNotebook().GetPageCount()): + for page in range(self.GetLayerNotebook().GetPageCount()): mapdisp = self.GetLayerNotebook().GetPage(page).maptree.GetMapDisplay() if self.GetLayerNotebook().GetPage(page) != mapDisplayPage: mapdisp.Disable3dMode() diff --git a/gui/wxpython/mapdisp/statusbar.py b/gui/wxpython/mapdisp/statusbar.py index 72e9d0afdbc..649baebc18d 100644 --- a/gui/wxpython/mapdisp/statusbar.py +++ b/gui/wxpython/mapdisp/statusbar.py @@ -138,7 +138,7 @@ def DisableStatusbarItemsByClass(self, itemClasses): :param itemClasses list of classes of items to be disabled """ for itemClass in itemClasses: - for i in range(0, len(self.statusbarItems.values())): + for i in range(len(self.statusbarItems.values())): item = list(self.statusbarItems.values())[i] if item.__class__ == itemClass: self.disabledItems[i] = item diff --git a/gui/wxpython/vdigit/wxdisplay.py b/gui/wxpython/vdigit/wxdisplay.py index 9085aae8caf..d8e4d0a14bf 100644 --- a/gui/wxpython/vdigit/wxdisplay.py +++ b/gui/wxpython/vdigit/wxdisplay.py @@ -824,7 +824,7 @@ def SetSelected(self, ids, layer=-1): found = False cats = self.poCats.contents - for i in range(0, cats.n_cats): + for i in range(cats.n_cats): for cat in self.selected["cats"]: if cats.cat[i] == cat: found = True diff --git a/pyproject.toml b/pyproject.toml index 18dbdd75067..7b9d6761d36 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -152,7 +152,6 @@ ignore = [ "PERF402", # manual-list-copy "PERF403", # manual-dict-comprehension "PIE794", # duplicate-class-field-definition - "PIE808", # unnecessary-range-start "PLC0415", # import-outside-top-level "PLC1901", # compare-to-empty-string "PLC2701", # import-private-name diff --git a/python/grass/experimental/tests/grass_script_tmp_mapset_session_test.py b/python/grass/experimental/tests/grass_script_tmp_mapset_session_test.py index 744becc1e7b..f7098004527 100644 --- a/python/grass/experimental/tests/grass_script_tmp_mapset_session_test.py +++ b/python/grass/experimental/tests/grass_script_tmp_mapset_session_test.py @@ -74,7 +74,7 @@ def test_without_context_manager(xy_session): def test_multiple_sequential_with_context_manager(xy_session): """Session creates, starts, and finishes""" session_file = xy_session.env["GISRC"] - for i in range(0, 5): + for i in range(5): with experimental.TemporaryMapsetSession(env=xy_session.env) as session: assert session.active gs.run_command("g.region", flags="p", env=session.env) @@ -104,7 +104,7 @@ def test_multiple_parallel_without_context_manager(xy_session): """Session creates, starts, and finishes""" session_file = xy_session.env["GISRC"] sessions = [] - for i in range(0, 5): + for i in range(5): session_file = xy_session.env["GISRC"] session = experimental.TemporaryMapsetSession(env=xy_session.env) gs.run_command("g.region", flags="p", env=session.env) diff --git a/scripts/d.polar/d.polar.py b/scripts/d.polar/d.polar.py index 915177e94d4..d7e67486a0e 100755 --- a/scripts/d.polar/d.polar.py +++ b/scripts/d.polar/d.polar.py @@ -112,7 +112,7 @@ def plot_dgraph(): 50 * (1 + ring * math.sin(math.radians(i))), 50 * (1 + ring * math.cos(math.radians(i))), ) - for i in range(0, 361) + for i in range(361) ] # trend vector @@ -512,7 +512,7 @@ def main(): outercircle = [] outercircle.append('"All Data incl. NULLs') scale = 1.0 * totalnumber / totalvalidnumber * maxradius - for i in range(0, 361): + for i in range(361): a = math.radians(i) x = math.cos(a) * scale y = math.sin(a) * scale diff --git a/scripts/i.oif/i.oif.py b/scripts/i.oif/i.oif.py index aea65197954..64dffcf70b9 100755 --- a/scripts/i.oif/i.oif.py +++ b/scripts/i.oif/i.oif.py @@ -63,7 +63,7 @@ def oifcalc(sdev, corr, k1, k2, k3): def perms(bands): n = len(bands) - for i in range(0, n - 2): + for i in range(n - 2): for j in range(i + 1, n - 1): for k in range(j + 1, n): yield (bands[i], bands[j], bands[k]) diff --git a/scripts/i.pansharpen/i.pansharpen.py b/scripts/i.pansharpen/i.pansharpen.py index c62a53a536a..bb271c07deb 100755 --- a/scripts/i.pansharpen/i.pansharpen.py +++ b/scripts/i.pansharpen/i.pansharpen.py @@ -749,7 +749,7 @@ def matchhist(original, target, matched): 0 # cumulative total of cells for sum of current and all lower grey values ) - for n in range(0, 256): + for n in range(256): if str(n) in stats_dict: num_cells = stats_dict[str(n)] else: diff --git a/scripts/i.tasscap/i.tasscap.py b/scripts/i.tasscap/i.tasscap.py index 4c68c234c73..dc767fd3f19 100755 --- a/scripts/i.tasscap/i.tasscap.py +++ b/scripts/i.tasscap/i.tasscap.py @@ -352,7 +352,7 @@ def main(): # assign "Data Description" field in all four component maps num_comp = len(parms[satellites.index(satellite)]) - for i in range(0, num_comp): + for i in range(num_comp): comp = names[i] gs.run_command( "r.support", diff --git a/scripts/v.report/v.report.py b/scripts/v.report/v.report.py index 9da9a8b1de7..cec84582155 100755 --- a/scripts/v.report/v.report.py +++ b/scripts/v.report/v.report.py @@ -116,7 +116,7 @@ def main(): cols = decode(line).rstrip("\r\n").split("|") if catcol == -1: ncols = len(cols) - for i in range(0, ncols): + for i in range(ncols): if cols[i] == f["key"]: catcol = i break