diff --git a/display/d.text/test.py b/display/d.text/test.py index d1b476990dc..ffc50cfc8aa 100755 --- a/display/d.text/test.py +++ b/display/d.text/test.py @@ -51,7 +51,7 @@ def text(in_text): for i in range(36): font(fonts[int(i % len(fonts))]) - size(((36 - i if (i >= 9 and i <= 18 or i > 27) else i) % 9)) + size((36 - i if (i >= 9 and i <= 18 or i > 27) else i) % 9) rotate(i * 10) color(colors[i % len(colors)]) xy( diff --git a/doc/gui/wxpython/example/frame.py b/doc/gui/wxpython/example/frame.py index 3c5f27e0231..01a5442789f 100644 --- a/doc/gui/wxpython/example/frame.py +++ b/doc/gui/wxpython/example/frame.py @@ -222,7 +222,7 @@ def AddToolbar(self, name): .CloseButton(False) .Layer(1) .Row(1) - .BestSize((self.toolbars[name].GetBestSize())), + .BestSize(self.toolbars[name].GetBestSize()), ) if name == "MiscToolbar": @@ -243,7 +243,7 @@ def AddToolbar(self, name): .CloseButton(False) .Layer(1) .Row(1) - .BestSize((self.toolbars[name].GetBestSize())), + .BestSize(self.toolbars[name].GetBestSize()), ) if name == "MainToolbar": @@ -264,7 +264,7 @@ def AddToolbar(self, name): .CloseButton(False) .Layer(1) .Row(1) - .BestSize((self.toolbars[name].GetBestSize())), + .BestSize(self.toolbars[name].GetBestSize()), ) def GetMapToolbar(self): diff --git a/gui/wxpython/animation/frame.py b/gui/wxpython/animation/frame.py index 1f46e827c1b..38f07866264 100644 --- a/gui/wxpython/animation/frame.py +++ b/gui/wxpython/animation/frame.py @@ -181,7 +181,7 @@ def _addToolbars(self): .Layer(2) .Row(1) .Position(0) - .BestSize((self.toolbars["mainToolbar"].GetBestSize())), + .BestSize(self.toolbars["mainToolbar"].GetBestSize()), ) self.toolbars["animationToolbar"] = AnimationToolbar(self) @@ -200,7 +200,7 @@ def _addToolbars(self): .Layer(2) .Row(1) .Position(1) - .BestSize((self.toolbars["animationToolbar"].GetBestSize())), + .BestSize(self.toolbars["animationToolbar"].GetBestSize()), ) self.controller.SetAnimationToolbar(self.toolbars["animationToolbar"]) @@ -220,7 +220,7 @@ def _addToolbars(self): .Layer(2) .Row(1) .Position(2) - .BestSize((self.toolbars["miscToolbar"].GetBestSize())), + .BestSize(self.toolbars["miscToolbar"].GetBestSize()), ) def SetAnimations(self, layerLists): diff --git a/gui/wxpython/core/globalvar.py b/gui/wxpython/core/globalvar.py index 7b57023a289..08d61b6b3d7 100644 --- a/gui/wxpython/core/globalvar.py +++ b/gui/wxpython/core/globalvar.py @@ -257,8 +257,8 @@ def UpdateGRASSAddOnCommands(eList=None): os.environ["PATH"] = os.path.join(GUIDIR, "scripts") + os.pathsep + os.environ["PATH"] ignoredCmdPattern = ( - "^d\..*|^r[3]?\.mapcalc$|^i.group$|^r.import$|" - "^r.external$|^r.external.out$|" - "^v.import$|^v.external$|^v.external.out$|" - "^cd$|^cd .*" + r"^d\..*|^r[3]?\.mapcalc$|^i.group$|^r.import$|" + r"^r.external$|^r.external.out$|" + r"^v.import$|^v.external$|^v.external.out$|" + r"^cd$|^cd .*" ) diff --git a/gui/wxpython/core/layerlist.py b/gui/wxpython/core/layerlist.py index 886abf2d5f5..b1a9448227d 100644 --- a/gui/wxpython/core/layerlist.py +++ b/gui/wxpython/core/layerlist.py @@ -146,8 +146,7 @@ def MoveLayerDown(self, layer): self._list.insert(idx + 1, lr) def __iter__(self): - for layer in self._list: - yield layer + yield from self._list def __getitem__(self, index): return self._list[index] diff --git a/gui/wxpython/core/render.py b/gui/wxpython/core/render.py index 6be32c34c61..2bab7806bab 100644 --- a/gui/wxpython/core/render.py +++ b/gui/wxpython/core/render.py @@ -816,7 +816,7 @@ def RenderingFailed(self, cmd, error): self.renderingFailed.emit(cmd=cmd, error=error) -class Map(object): +class Map: def __init__(self, gisrc=None): """Map composition (stack of map layers and overlays) diff --git a/gui/wxpython/gcp/mapdisplay.py b/gui/wxpython/gcp/mapdisplay.py index 31c501bdd64..318100ee1cd 100644 --- a/gui/wxpython/gcp/mapdisplay.py +++ b/gui/wxpython/gcp/mapdisplay.py @@ -253,7 +253,7 @@ def AddToolbar(self, name): .TopDockable(True) .CloseButton(False) .Layer(2) - .BestSize((self.toolbars["map"].GetSize())), + .BestSize(self.toolbars["map"].GetSize()), ) # GCP display diff --git a/gui/wxpython/gui_core/menu.py b/gui/wxpython/gui_core/menu.py index 8070e49feeb..d616b73235c 100644 --- a/gui/wxpython/gui_core/menu.py +++ b/gui/wxpython/gui_core/menu.py @@ -105,7 +105,7 @@ def _createMenuItem( try: cmd = utils.split(str(command)) except UnicodeError: - cmd = utils.split(EncodeString((command))) + cmd = utils.split(EncodeString(command)) # disable only grass commands which are not present (e.g. # r.in.lidar) if ( diff --git a/gui/wxpython/gui_core/preferences.py b/gui/wxpython/gui_core/preferences.py index c9f74cb25af..030c946ebb1 100644 --- a/gui/wxpython/gui_core/preferences.py +++ b/gui/wxpython/gui_core/preferences.py @@ -1930,7 +1930,7 @@ def OnLoadEpsgCodes(self, event): ) return - if isinstance(self.epsgCodeDict, type("")): + if isinstance(self.epsgCodeDict, str): wx.MessageBox( parent=self, message=_("Unable to read EPSG codes: %s") % self.epsgCodeDict, diff --git a/gui/wxpython/gui_core/prompt.py b/gui/wxpython/gui_core/prompt.py index 714b5a7ac1a..92b478f842f 100644 --- a/gui/wxpython/gui_core/prompt.py +++ b/gui/wxpython/gui_core/prompt.py @@ -93,7 +93,7 @@ def _runCmd(self, cmdString): try: cmd = utils.split(str(cmdString)) except UnicodeError: - cmd = utils.split(EncodeString((cmdString))) + cmd = utils.split(EncodeString(cmdString)) cmd = list(map(DecodeString, cmd)) self.promptRunCmd.emit(cmd={"cmd": cmd, "cmdString": str(cmdString)}) diff --git a/gui/wxpython/gui_core/simplelmgr.py b/gui/wxpython/gui_core/simplelmgr.py index 1b321a812f0..d59a443c9b0 100644 --- a/gui/wxpython/gui_core/simplelmgr.py +++ b/gui/wxpython/gui_core/simplelmgr.py @@ -104,7 +104,7 @@ def _layout(self): .Name("checklist") .CenterPane() .CloseButton(False) - .BestSize((self._checkList.GetBestSize())), + .BestSize(self._checkList.GetBestSize()), ) paneInfo = ( wx.aui.AuiPaneInfo() @@ -114,7 +114,7 @@ def _layout(self): .CloseButton(False) .Layer(1) .Gripper(False) - .BestSize((self._toolbar.GetBestSize())) + .BestSize(self._toolbar.GetBestSize()) ) if self._style & SIMPLE_LMGR_TB_LEFT: paneInfo.Left() diff --git a/gui/wxpython/iclass/frame.py b/gui/wxpython/iclass/frame.py index 846d60e3d4b..9a53317694c 100644 --- a/gui/wxpython/iclass/frame.py +++ b/gui/wxpython/iclass/frame.py @@ -313,7 +313,7 @@ def AddToolbar(self, name): .Layer(2) .Row(1) .Position(0) - .BestSize((self.toolbars[name].GetBestSize())), + .BestSize(self.toolbars[name].GetBestSize()), ) if name == "iClass": @@ -335,7 +335,7 @@ def AddToolbar(self, name): .Layer(2) .Row(2) .Position(0) - .BestSize((self.toolbars[name].GetBestSize())), + .BestSize(self.toolbars[name].GetBestSize()), ) if name == "iClassMisc": @@ -357,7 +357,7 @@ def AddToolbar(self, name): .Layer(2) .Row(1) .Position(1) - .BestSize((self.toolbars[name].GetBestSize())), + .BestSize(self.toolbars[name].GetBestSize()), ) if name == "vdigit": @@ -397,7 +397,7 @@ def AddToolbar(self, name): .Layer(2) .Row(2) .Position(1) - .BestSize((self.toolbars[name].GetBestSize())), + .BestSize(self.toolbars[name].GetBestSize()), ) self._mgr.Update() @@ -445,7 +445,7 @@ def _addPaneToolbar(self, name, position): .Center() .Layer(0) .Position(position) - .BestSize((self.toolbars[name].GetBestSize())), + .BestSize(self.toolbars[name].GetBestSize()), ) def _addPaneMapWindow(self, name, position): @@ -496,7 +496,7 @@ def UpdateActive(self, win): mapTb.Enable("zoomBack", enable=(len(self.MapWindow.zoomhistory) > 1)) if mapTb.GetActiveMap() != (win == self.secondMapWindow): - mapTb.SetActiveMap((win == self.secondMapWindow)) + mapTb.SetActiveMap(win == self.secondMapWindow) self.StatusbarUpdate() def ActivateFirstMap(self, event=None): diff --git a/gui/wxpython/image2target/ii2t_mapdisplay.py b/gui/wxpython/image2target/ii2t_mapdisplay.py index b0f0cd5fa94..2543309cbf3 100644 --- a/gui/wxpython/image2target/ii2t_mapdisplay.py +++ b/gui/wxpython/image2target/ii2t_mapdisplay.py @@ -257,7 +257,7 @@ def AddToolbar(self, name): .TopDockable(True) .CloseButton(False) .Layer(2) - .BestSize((self.toolbars["map"].GetSize())), + .BestSize(self.toolbars["map"].GetSize()), ) # GCP display diff --git a/gui/wxpython/iscatt/iscatt_core.py b/gui/wxpython/iscatt/iscatt_core.py index e0fe7bad182..d97cdb84a56 100644 --- a/gui/wxpython/iscatt/iscatt_core.py +++ b/gui/wxpython/iscatt/iscatt_core.py @@ -764,7 +764,7 @@ def idScattToidBands(scatt_id, n_bands): n_b1 = n_bands - 1 band_1 = (int)( - (2 * n_b1 + 1 - sqrt(((2 * n_b1 + 1) * (2 * n_b1 + 1) - 8 * scatt_id))) / 2 + (2 * n_b1 + 1 - sqrt((2 * n_b1 + 1) * (2 * n_b1 + 1) - 8 * scatt_id)) / 2 ) band_2 = int( diff --git a/gui/wxpython/lmgr/frame.py b/gui/wxpython/lmgr/frame.py index adf4ccc15bf..b30b30c25fa 100644 --- a/gui/wxpython/lmgr/frame.py +++ b/gui/wxpython/lmgr/frame.py @@ -203,7 +203,7 @@ def show_menu_errors(messages): .TopDockable(True) .CloseButton(False) .Layer(2) - .BestSize((self.toolbars[toolbar].GetBestSize())), + .BestSize(self.toolbars[toolbar].GetBestSize()), ) self._auimgr.GetPane("toolbarNviz").Hide() @@ -947,9 +947,9 @@ def _switchPage(self, notification): def RunSpecialCmd(self, command): """Run command from command line, check for GUI wrappers""" - if re.compile("^d\..*").search(command[0]): + if re.compile(r"^d\..*").search(command[0]): self.RunDisplayCmd(command) - elif re.compile("r[3]?\.mapcalc").search(command[0]): + elif re.compile(r"r[3]?\.mapcalc").search(command[0]): self.OnMapCalculator(event=None, cmd=command) elif command[0] == "i.group": self.OnEditImageryGroups(event=None, cmd=command) diff --git a/gui/wxpython/location_wizard/wizard.py b/gui/wxpython/location_wizard/wizard.py index c25e09b5ab6..9d83af72f04 100644 --- a/gui/wxpython/location_wizard/wizard.py +++ b/gui/wxpython/location_wizard/wizard.py @@ -763,7 +763,7 @@ def Sorter(self, key1, key2): item1 = self.itemDataMap[key1][self._col] item2 = self.itemDataMap[key2][self._col] - if isinstance(item1, type("")) or isinstance(item2, type("")): + if isinstance(item1, str) or isinstance(item2, str): cmpVal = locale.strcoll(str(item1), str(item2)) else: cmpVal = cmp(item1, item2) @@ -1700,7 +1700,7 @@ def EnableNext(self, enable=True): def OnTextChange(self, event): value = self.searchb.GetValue() if value == "": - self.tlink.SetURL(str("https://epsg.io/")) + self.tlink.SetURL("https://epsg.io/") self.epsgcode = None self.epsgdesc = self.epsgparams = "" self.searchb.ChangeValue("") @@ -2392,9 +2392,7 @@ def OnEnterPage(self, event): self.parent.custompage.customstring + self.parent.custompage.custom_dtrans_string ) - self.lproj4string.SetLabel( - ("%s" % combo_str.replace(" +", os.linesep + "+")) - ) + self.lproj4string.SetLabel("%s" % combo_str.replace(" +", os.linesep + "+")) self.lprojection.SetLabel(label) diff --git a/gui/wxpython/main_window/frame.py b/gui/wxpython/main_window/frame.py index 942cb86645f..5e8ce4213b8 100644 --- a/gui/wxpython/main_window/frame.py +++ b/gui/wxpython/main_window/frame.py @@ -616,7 +616,7 @@ def BuildPanes(self): .TopDockable(True) .CloseButton(False) .Layer(2) - .BestSize((self.toolbars[toolbar].GetBestSize())), + .BestSize(self.toolbars[toolbar].GetBestSize()), ) self._auimgr.AddPane( diff --git a/gui/wxpython/mapdisp/frame.py b/gui/wxpython/mapdisp/frame.py index bcb59f74994..6359068aa3d 100644 --- a/gui/wxpython/mapdisp/frame.py +++ b/gui/wxpython/mapdisp/frame.py @@ -398,7 +398,7 @@ def openATM(selection): .TopDockable(True) .CloseButton(False) .Layer(2) - .BestSize((self.toolbars["vdigit"].GetBestSize())), + .BestSize(self.toolbars["vdigit"].GetBestSize()), ) # change mouse to draw digitized line self.MapWindow.mouse["box"] = "point" @@ -628,7 +628,7 @@ def AddToolbar(self, name, fixed=False): .TopDockable(True) .CloseButton(False) .Layer(2) - .BestSize((self.toolbars["map"].GetBestSize())), + .BestSize(self.toolbars["map"].GetBestSize()), ) # nviz @@ -1683,7 +1683,7 @@ def AddRDigit(self): .CloseButton(False) .Layer(2) .DestroyOnClose() - .BestSize((self.toolbars["rdigit"].GetBestSize())), + .BestSize(self.toolbars["rdigit"].GetBestSize()), ) self._mgr.Update() diff --git a/gui/wxpython/mapswipe/frame.py b/gui/wxpython/mapswipe/frame.py index 27d6c2280ba..908da5fc6a1 100644 --- a/gui/wxpython/mapswipe/frame.py +++ b/gui/wxpython/mapswipe/frame.py @@ -273,7 +273,7 @@ def AddToolbar(self, name): .Layer(2) .Row(1) .Position(0) - .BestSize((self.toolbars["swipeMain"].GetBestSize())), + .BestSize(self.toolbars["swipeMain"].GetBestSize()), ) if name == "swipeMap": @@ -295,7 +295,7 @@ def AddToolbar(self, name): .Layer(2) .Row(1) .Position(1) - .BestSize((self.toolbars["swipeMap"].GetBestSize())), + .BestSize(self.toolbars["swipeMap"].GetBestSize()), ) if name == "swipeMisc": @@ -317,7 +317,7 @@ def AddToolbar(self, name): .Layer(2) .Row(1) .Position(2) - .BestSize((self.toolbars["swipeMisc"].GetBestSize())), + .BestSize(self.toolbars["swipeMisc"].GetBestSize()), ) def _addPanes(self): @@ -334,7 +334,7 @@ def _addPanes(self): .CloseButton(False) .Center() .Layer(1) - .BestSize((self.splitter.GetBestSize())), + .BestSize(self.splitter.GetBestSize()), ) # sliders @@ -353,7 +353,7 @@ def _addPanes(self): .RightDockable(False) .Bottom() .Layer(1) - .BestSize((self.sliderH.GetBestSize())), + .BestSize(self.sliderH.GetBestSize()), ) self._mgr.AddPane( @@ -371,7 +371,7 @@ def _addPanes(self): .RightDockable(True) .Right() .Layer(1) - .BestSize((self.sliderV.GetBestSize())), + .BestSize(self.sliderV.GetBestSize()), ) # statusbar diff --git a/gui/wxpython/mapwin/decorations.py b/gui/wxpython/mapwin/decorations.py index ef8824f185b..5ead9c5f0e7 100644 --- a/gui/wxpython/mapwin/decorations.py +++ b/gui/wxpython/mapwin/decorations.py @@ -190,7 +190,7 @@ def GetPlacement(self, screensize): for param in self._cmd: if not param.startswith("at"): continue - x, y = [float(number) for number in param.split("=")[1].split(",")] + x, y = (float(number) for number in param.split("=")[1].split(",")) x = int((x / 100.0) * screensize[0]) y = int((1 - y / 100.0) * screensize[1]) @@ -304,9 +304,9 @@ def GetPlacement(self, screensize): if param == self._defaultAt: b, t, l, r = 5, 50, 7, 10 else: - b, t, l, r = [ + b, t, l, r = ( float(number) for number in param.split("=")[1].split(",") - ] # pylint: disable-msg=W0612 + ) # pylint: disable-msg=W0612 x = int((l / 100.0) * screensize[0]) y = int((1 - t / 100.0) * screensize[1]) diff --git a/gui/wxpython/photo2image/ip2i_mapdisplay.py b/gui/wxpython/photo2image/ip2i_mapdisplay.py index 2a86274a9f7..90499a94277 100644 --- a/gui/wxpython/photo2image/ip2i_mapdisplay.py +++ b/gui/wxpython/photo2image/ip2i_mapdisplay.py @@ -249,7 +249,7 @@ def AddToolbar(self, name): .TopDockable(True) .CloseButton(False) .Layer(2) - .BestSize((self.toolbars["map"].GetSize())), + .BestSize(self.toolbars["map"].GetSize()), ) # GCP display diff --git a/gui/wxpython/psmap/instructions.py b/gui/wxpython/psmap/instructions.py index 28efb8970c6..0b36a2ae7ab 100644 --- a/gui/wxpython/psmap/instructions.py +++ b/gui/wxpython/psmap/instructions.py @@ -36,7 +36,6 @@ import string from math import ceil from time import strftime, localtime -from io import open import wx import grass.script as grass @@ -179,7 +178,7 @@ def Read(self, filename): toM = float(proj["meters"]) units = UnitConversion(self.parent) w = units.convert(value=mapRect.Get()[2], fromUnit="inch", toUnit="meter") / toM - map["scale"] = w / abs((region["w"] - region["e"])) + map["scale"] = w / abs(region["w"] - region["e"]) SetResolution( dpi=300, width=map["rect"].width, height=map["rect"].height, env=self.env diff --git a/gui/wxpython/rlisetup/sampling_frame.py b/gui/wxpython/rlisetup/sampling_frame.py index c69adcb26e8..0fa7c5242df 100644 --- a/gui/wxpython/rlisetup/sampling_frame.py +++ b/gui/wxpython/rlisetup/sampling_frame.py @@ -107,7 +107,7 @@ def __init__(self, parent, samplingType, icon=None, map_=None): .CloseButton(False) .Layer(1) .Gripper(False) - .BestSize((self.toolbar.GetBestSize())), + .BestSize(self.toolbar.GetBestSize()), ) self._mgr.Update() diff --git a/gui/wxpython/web_services/cap_interface.py b/gui/wxpython/web_services/cap_interface.py index 9b484ea2a1e..44de7b6056a 100644 --- a/gui/wxpython/web_services/cap_interface.py +++ b/gui/wxpython/web_services/cap_interface.py @@ -92,7 +92,7 @@ def _initializeLayerTree(self, parent_layer, id=0): self.layers_by_id[id] = parent_layer id += 1 - layer_nodes = parent_layer.GetLayerNode().findall((self.xml_ns.Ns("Layer"))) + layer_nodes = parent_layer.GetLayerNode().findall(self.xml_ns.Ns("Layer")) for node in layer_nodes: layer = WMSLayer(node, id, self) diff --git a/lib/init/grass.py b/lib/init/grass.py index be78eb00a81..55242c34361 100755 --- a/lib/init/grass.py +++ b/lib/init/grass.py @@ -280,7 +280,7 @@ def f(fmt, *args): matches = [] # https://docs.python.org/3/library/stdtypes.html#old-string-formatting for m in re.finditer( - "%([#0 +-]*)([0-9]*)(\.[0-9]*)?([hlL]?[diouxXeEfFgGcrsa%])", fmt + r"%([#0 +-]*)([0-9]*)(\.[0-9]*)?([hlL]?[diouxXeEfFgGcrsa%])", fmt ): matches.append(m) diff --git a/man/parser_standard_options.py b/man/parser_standard_options.py index 9635adccbb0..3454084f330 100644 --- a/man/parser_standard_options.py +++ b/man/parser_standard_options.py @@ -64,7 +64,7 @@ def parse_glines(glines): if line.startswith("/*"): continue if line.startswith(startswith) and line.endswith(";"): - key, default = [w.strip() for w in split_opt_line(line[5:])] + key, default = (w.strip() for w in split_opt_line(line[5:])) res[key] = default elif line.startswith(startswith): key, default = split_opt_line(line[5:]) diff --git a/python/grass/pydispatch/dispatcher.py b/python/grass/pydispatch/dispatcher.py index 2106494b5d8..a34706f8cf7 100644 --- a/python/grass/pydispatch/dispatcher.py +++ b/python/grass/pydispatch/dispatcher.py @@ -442,8 +442,7 @@ def _removeBackrefs(senderkey): def allReceivers(): for signal, set in items: - for item in set: - yield item + yield from set for receiver in allReceivers(): _killBackref(receiver, senderkey) diff --git a/python/grass/pygrass/gis/__init__.py b/python/grass/pygrass/gis/__init__.py index 90703194646..3f380368d28 100644 --- a/python/grass/pygrass/gis/__init__.py +++ b/python/grass/pygrass/gis/__init__.py @@ -425,8 +425,7 @@ def __repr__(self): return repr(self.read()) def __iter__(self): - for mapset in self.read(): - yield mapset + yield from self.read() def read(self): """Return the mapsets in the search path""" diff --git a/python/grass/pygrass/messages/__init__.py b/python/grass/pygrass/messages/__init__.py index b0aa324a812..c001e1641c1 100644 --- a/python/grass/pygrass/messages/__init__.py +++ b/python/grass/pygrass/messages/__init__.py @@ -78,7 +78,7 @@ def message_server(lock, conn): message = data[1] # libgis limitation - if isinstance(message, type(" ")): + if isinstance(message, str): if len(message) >= 2000: message = message[:1999] diff --git a/python/grass/pygrass/modules/grid/grid.py b/python/grass/pygrass/modules/grid/grid.py index 37b20e1458c..0fd6038a078 100644 --- a/python/grass/pygrass/modules/grid/grid.py +++ b/python/grass/pygrass/modules/grid/grid.py @@ -44,8 +44,7 @@ def select(parms, ptype): par = parms[k] if par.type == ptype or par.typedesc == ptype and par.value: if par.multiple: - for val in par.value: - yield val + yield from par.value else: yield par.value diff --git a/python/grass/pygrass/modules/interface/parameter.py b/python/grass/pygrass/modules/interface/parameter.py index a0bb1701dd5..8d58165d3ee 100644 --- a/python/grass/pygrass/modules/interface/parameter.py +++ b/python/grass/pygrass/modules/interface/parameter.py @@ -14,7 +14,7 @@ def _check_value(param, value): return the checked value and the original. """ req = "The Parameter <%s>, require: %s, get: %s instead: %r\n%s" - string = (type(b""), type("")) + string = (bytes, str) def raiseexcpet(exc, param, ptype, value): """Function to modifa the error message""" diff --git a/python/grass/pygrass/modules/testsuite/test_import_isolation.py b/python/grass/pygrass/modules/testsuite/test_import_isolation.py index 1426657d5a5..d91ae1a830b 100644 --- a/python/grass/pygrass/modules/testsuite/test_import_isolation.py +++ b/python/grass/pygrass/modules/testsuite/test_import_isolation.py @@ -9,8 +9,6 @@ Created on Wed Jul 15 11:34:32 2015 """ -from __future__ import absolute_import - import sys import fnmatch diff --git a/python/grass/pygrass/tests/benchmark.py b/python/grass/pygrass/tests/benchmark.py index bd46dfa79a3..a8212a04324 100644 --- a/python/grass/pygrass/tests/benchmark.py +++ b/python/grass/pygrass/tests/benchmark.py @@ -302,7 +302,7 @@ def run_benchmark(resolution_list, runs, testdict, profile): locals(), filename=filename, ) - print((" {0}: {1: 40.6f}s".format(oper, operdict["time"]))) + print(" {0}: {1: 40.6f}s".format(oper, operdict["time"])) del operdict["func"] regions.append(result) diff --git a/python/grass/script/vector.py b/python/grass/script/vector.py index ce7d1612efc..6b0c9efe2b2 100644 --- a/python/grass/script/vector.py +++ b/python/grass/script/vector.py @@ -17,7 +17,6 @@ .. sectionauthor:: Martin Landa """ import os -import sys from .utils import parse_key_val from .core import ( @@ -446,8 +445,7 @@ def vector_what( if encoding: kwargs["encoding"] = encoding - if sys.version_info[0:2] > (2, 6): - kwargs["object_pairs_hook"] = orderedDict + kwargs["object_pairs_hook"] = orderedDict try: result = json.loads(ret, **kwargs) diff --git a/python/grass/temporal/datetime_math.py b/python/grass/temporal/datetime_math.py index e79709302a6..66bee770ead 100644 --- a/python/grass/temporal/datetime_math.py +++ b/python/grass/temporal/datetime_math.py @@ -212,7 +212,7 @@ def increment_datetime_by_string(mydate, increment, mult=1): :param mult: A multiplier, default is 1 :return: The new datetime object or none in case of an error """ - return modify_datetime_by_string(mydate, increment, mult, sign=int(1)) + return modify_datetime_by_string(mydate, increment, mult, sign=1) ############################################################################### diff --git a/scripts/r.in.wms/wms_cap_parsers.py b/scripts/r.in.wms/wms_cap_parsers.py index d299349b18b..6846124efa3 100644 --- a/scripts/r.in.wms/wms_cap_parsers.py +++ b/scripts/r.in.wms/wms_cap_parsers.py @@ -136,7 +136,7 @@ def _checkLayerTree(self, parent_layer, first=True): if first: self._initLayer(parent_layer, None) - layers = parent_layer.findall((self.xml_ns.Ns("Layer"))) + layers = parent_layer.findall(self.xml_ns.Ns("Layer")) for l in layers: self._initLayer(l, parent_layer) diff --git a/scripts/r.in.wms/wms_drv.py b/scripts/r.in.wms/wms_drv.py index 747b0c94132..df592624031 100644 --- a/scripts/r.in.wms/wms_drv.py +++ b/scripts/r.in.wms/wms_drv.py @@ -774,7 +774,7 @@ def _getMatSize(self, tile_mat, mat_set_link): # get extend restriction in TileMatrixSetLink for the tile matrix, if exists tile_mat_set_limits = mat_set_link.find( - (self.xml_ns.NsWmts("TileMatrixSetLimits")) + self.xml_ns.NsWmts("TileMatrixSetLimits") ) if tile_mat_set_limits is None: return mat_num_bbox diff --git a/scripts/v.rast.stats/v.rast.stats.py b/scripts/v.rast.stats/v.rast.stats.py index bc16ab1a010..cea37e38cca 100644 --- a/scripts/v.rast.stats/v.rast.stats.py +++ b/scripts/v.rast.stats/v.rast.stats.py @@ -237,13 +237,11 @@ def main(): "db.execute", input=sqltmp, database=fi["database"], driver=fi["driver"] ) grass.verbose( - ( - _( - "Statistics calculated from raster map <{raster}>" - " and uploaded to attribute table" - " of vector map <{vector}>." - ).format(raster=raster, vector=vector) - ) + _( + "Statistics calculated from raster map <{raster}>" + " and uploaded to attribute table" + " of vector map <{vector}>." + ).format(raster=raster, vector=vector) ) except CalledModuleError: grass.warning( diff --git a/temporal/t.rast.aggregate/testsuite/test_aggregation_absolute_parallel.py b/temporal/t.rast.aggregate/testsuite/test_aggregation_absolute_parallel.py index 0148cdf7cd9..f70c150c7c0 100644 --- a/temporal/t.rast.aggregate/testsuite/test_aggregation_absolute_parallel.py +++ b/temporal/t.rast.aggregate/testsuite/test_aggregation_absolute_parallel.py @@ -7,8 +7,6 @@ :authors: Soeren Gebbert """ -from __future__ import print_function - import os import grass.pygrass.modules as pymod import grass.temporal as tgis