diff --git a/general/g.parser/test.py b/general/g.parser/test.py index 3b56230eb14..8166b354a37 100755 --- a/general/g.parser/test.py +++ b/general/g.parser/test.py @@ -53,10 +53,10 @@ def main(): # test if parameter present: if option1: - gs.message(_("Value of option1 option: '%s'" % option1)) + gs.message(_("Value of option1 option: '%s'") % option1) - gs.message(_("Value of raster option: '%s'" % raster)) - gs.message(_("Value of vector option: '%s'" % vector)) + gs.message(_("Value of raster option: '%s'") % raster) + gs.message(_("Value of vector option: '%s'") % vector) # End of your main code here diff --git a/gui/wxpython/animation/dialogs.py b/gui/wxpython/animation/dialogs.py index 154bdc9fce6..3d70dbd2639 100644 --- a/gui/wxpython/animation/dialogs.py +++ b/gui/wxpython/animation/dialogs.py @@ -1565,9 +1565,9 @@ def _export_file_validation(self, filebrowsebtn, file_path, file_postfix): self.GetParent(), message=_( "Exported animation file <{file}> exists. " - "Do you want to overwrite it?".format( - file=file_path, - ), + "Do you want to overwrite it?" + ).format( + file=file_path, ), caption=_("Overwrite?"), style=wx.YES_NO | wx.YES_DEFAULT | wx.ICON_QUESTION, diff --git a/gui/wxpython/animation/temporal_manager.py b/gui/wxpython/animation/temporal_manager.py index 9f9eafd41d0..150eeab510f 100644 --- a/gui/wxpython/animation/temporal_manager.py +++ b/gui/wxpython/animation/temporal_manager.py @@ -342,7 +342,7 @@ def _gatherInformation(self, timeseries, etype, timeseriesList, infoDict): maps = sp.get_registered_maps_as_objects() if not sp.check_temporal_topology(maps): - raise GException(_("Topology of Space time dataset %s is invalid." % id)) + raise GException(_("Topology of Space time dataset %s is invalid.") % id) timeseriesList.append(id) infoDict[id] = {} diff --git a/gui/wxpython/core/debug.py b/gui/wxpython/core/debug.py index cf642d1df4c..b6c12a60b62 100644 --- a/gui/wxpython/core/debug.py +++ b/gui/wxpython/core/debug.py @@ -49,8 +49,8 @@ def SetLevel(self): sys.stderr.write( _( "WARNING: Ignoring unsupported wx debug level (must be >=0 and " - "<=5). {0}\n".format(e) - ) + "<=5). {0}\n" + ).format(e) ) def msg(self, level, message, *args): diff --git a/gui/wxpython/core/render.py b/gui/wxpython/core/render.py index 021f3aa6500..3095cb47fc8 100644 --- a/gui/wxpython/core/render.py +++ b/gui/wxpython/core/render.py @@ -706,7 +706,7 @@ def OnRenderDone(self, env): self._rendering = False if wx.IsBusy(): wx.EndBusyCursor() - raise GException(_("Rendering failed: %s" % msg)) + raise GException(_("Rendering failed: %s") % msg) stop = time.time() Debug.msg( diff --git a/gui/wxpython/gcp/manager.py b/gui/wxpython/gcp/manager.py index 749cbf79efb..696bc53609f 100644 --- a/gui/wxpython/gcp/manager.py +++ b/gui/wxpython/gcp/manager.py @@ -1785,11 +1785,10 @@ def _getOverWriteDialog(self, maptype, overwrite): return wx.MessageDialog( self.GetParent(), message=_( - "The {map_type} map {map_name} exists. " - "Do you want to overwrite?".format( - map_type=maptype, - map_name=map_name, - ), + "The {map_type} map {map_name} exists. Do you want to overwrite?" + ).format( + map_type=maptype, + map_name=map_name, ), caption=_("Overwrite?"), style=wx.YES_NO | wx.YES_DEFAULT | wx.ICON_QUESTION, diff --git a/gui/wxpython/gmodeler/model.py b/gui/wxpython/gmodeler/model.py index 41fcfe6614f..a609a1c8bd8 100644 --- a/gui/wxpython/gmodeler/model.py +++ b/gui/wxpython/gmodeler/model.py @@ -2819,12 +2819,11 @@ def _getPythonActionCmd(self, item, task, cmdIndent, variables={}): dlg = wx.MessageDialog( self.model.canvas, message=_( - f"Module {task.get_name()} in your model contains " - f"parameterized flags. actinia does not support " - f"parameterized flags. The following flags are therefore " - f"not being written in the generated json: " - f"{itemParameterizedFlags}" - ), + "Module {task_name} in your model contains " + "parameterized flags. Actinia does not support " + "parameterized flags. The following flags are therefore " + "not being written in the generated JSON: {flags}" + ).format(task_name=task.get_name(), flags=itemParameterizedFlags), caption=_("Warning"), style=wx.OK_DEFAULT | wx.ICON_WARNING, ) diff --git a/gui/wxpython/gmodeler/panels.py b/gui/wxpython/gmodeler/panels.py index 300220b9f7c..93ef770efe1 100644 --- a/gui/wxpython/gmodeler/panels.py +++ b/gui/wxpython/gmodeler/panels.py @@ -268,19 +268,15 @@ def OnPageChanged(self, event): if self.pythonPanel.IsModified(): self.SetStatusText( - _( - "{} script contains local modifications".format( - self.pythonPanel.body.script_type - ) + _("{} script contains local modifications").format( + self.pythonPanel.body.script_type ), 0, ) else: self.SetStatusText( - _( - "{} script is up-to-date".format( - self.pythonPanel.body.script_type - ) + _("{} script is up-to-date").format( + self.pythonPanel.body.script_type ), 0, ) @@ -1261,7 +1257,7 @@ def OnDeleteData(self, event): dlg = wx.MessageDialog( parent=self, - message=_("Do you want to permanently delete data?%s" % msg), + message=_("Do you want to permanently delete data?%s") % msg, caption=_("Delete intermediate data?"), style=wx.YES_NO | wx.YES_DEFAULT | wx.ICON_QUESTION, ) @@ -1645,9 +1641,7 @@ def _layout(self): bodySizer.Add(self.body, proportion=1, flag=wx.EXPAND | wx.ALL, border=3) btnSizer.Add( - StaticText( - parent=self, id=wx.ID_ANY, label="%s:" % _("Python script type") - ), + StaticText(parent=self, id=wx.ID_ANY, label=_("Python script type:")), flag=wx.ALIGN_CENTER_VERTICAL, ) btnSizer.Add(self.script_type_box, proportion=0, flag=wx.RIGHT, border=5) @@ -1676,7 +1670,7 @@ def GetScriptExt(self): return ext def SetWriteObject(self, script_type): - """Set correct self.write_object dependng on the script type. + """Set correct self.write_object depending on the script type. :param script_type: script type name as a string """ if script_type == "PyWPS": @@ -1704,8 +1698,8 @@ def RefreshScript(self): message=_( "{} script is locally modified. " "Refresh will discard all changes. " - "Do you really want to continue?".format(self.body.script_type) - ), + "Do you really want to continue?" + ).format(self.body.script_type), caption=_("Update"), style=wx.YES_NO | wx.NO_DEFAULT | wx.ICON_QUESTION | wx.CENTRE, ) @@ -1835,7 +1829,7 @@ def OnChangeScriptType(self, event): if self.RefreshScript(): self.body.script_type = new_script_type self.parent.SetStatusText( - _("{} script is up-to-date".format(self.body.script_type)), + _("{} script is up-to-date").format(self.body.script_type), 0, ) @@ -1854,7 +1848,7 @@ def OnRefresh(self, event): """Refresh the script.""" if self.RefreshScript(): self.parent.SetStatusText( - _("{} script is up-to-date".format(self.body.script_type)), + _("{} script is up-to-date").format(self.body.script_type), 0, ) event.Skip() diff --git a/gui/wxpython/gui_core/ghelp.py b/gui/wxpython/gui_core/ghelp.py index 0602aeaea0c..93879998133 100644 --- a/gui/wxpython/gui_core/ghelp.py +++ b/gui/wxpython/gui_core/ghelp.py @@ -564,15 +564,15 @@ def _langString(self, k, v): """Return string for the status of translation""" allStr = "%s :" % k.upper() try: - allStr += _(" %d translated" % v["good"]) + allStr += _(" %d translated") % v["good"] except: pass try: - allStr += _(" %d fuzzy" % v["fuzzy"]) + allStr += _(" %d fuzzy") % v["fuzzy"] except: pass try: - allStr += _(" %d untranslated" % v["bad"]) + allStr += _(" %d untranslated") % v["bad"] except: pass return allStr @@ -584,7 +584,7 @@ def _langBox(self, par, k, v): langBox.Add(tkey) try: tgood = StaticText( - parent=par, id=wx.ID_ANY, label=_("%d translated" % v["good"]) + parent=par, id=wx.ID_ANY, label=_("%d translated") % v["good"] ) tgood.SetForegroundColour(wx.Colour(35, 142, 35)) langBox.Add(tgood) @@ -593,7 +593,7 @@ def _langBox(self, par, k, v): langBox.Add(tgood) try: tfuzzy = StaticText( - parent=par, id=wx.ID_ANY, label=_(" %d fuzzy" % v["fuzzy"]) + parent=par, id=wx.ID_ANY, label=_(" %d fuzzy") % v["fuzzy"] ) tfuzzy.SetForegroundColour(wx.Colour(255, 142, 0)) langBox.Add(tfuzzy) @@ -602,7 +602,7 @@ def _langBox(self, par, k, v): langBox.Add(tfuzzy) try: tbad = StaticText( - parent=par, id=wx.ID_ANY, label=_(" %d untranslated" % v["bad"]) + parent=par, id=wx.ID_ANY, label=_(" %d untranslated") % v["bad"] ) tbad.SetForegroundColour(wx.Colour(255, 0, 0)) langBox.Add(tbad) diff --git a/gui/wxpython/gui_core/gselect.py b/gui/wxpython/gui_core/gselect.py index 7dc51b75935..eae12085f92 100644 --- a/gui/wxpython/gui_core/gselect.py +++ b/gui/wxpython/gui_core/gselect.py @@ -921,7 +921,7 @@ def GetTable(self, layer): :param layer: vector layer number """ if layer not in self.layers: - raise GException(_("No table linked to layer <{}>.".format(layer))) + raise GException(_("No table linked to layer <{}>.").format(layer)) return self.layers[layer]["table"] def GetDbSettings(self, layer): @@ -2259,18 +2259,18 @@ def hasRastSameProjAsLocation(dsn, table=None): message=_( "Getting raster <{table}> SRID from PostgreSQL" " DB <{db}>, host <{host}> failed." - " {error}.".format( - table=table, - db=self._getPDDBConnectionParam( - dsn, - conn_param="dbname", - ), - host=self._getPDDBConnectionParam( - dsn, - conn_param="host", - ), - error=gs.utils.decode(error), + " {error}." + ).format( + table=table, + db=self._getPDDBConnectionParam( + dsn, + conn_param="dbname", ), + host=self._getPDDBConnectionParam( + dsn, + conn_param="host", + ), + error=gs.utils.decode(error), ), ) if ret: @@ -2522,17 +2522,17 @@ def _getPGDBtables(self, dsn): parent=self, message=_( "Getting list of tables from PostgreSQL DB <{db}>," - " host <{host}> failed. {error}.".format( - db=self._getPGDBConnectionParam( - dsn, - conn_param="dbname", - ), - host=self._getPGDBConnectionParam( - dsn, - conn_param="host", - ), - error=gs.utils.decode(error), + " host <{host}> failed. {error}." + ).format( + db=self._getPGDBConnectionParam( + dsn, + conn_param="dbname", ), + host=self._getPGDBConnectionParam( + dsn, + conn_param="host", + ), + error=gs.utils.decode(error), ), ) if ret: @@ -2614,17 +2614,17 @@ def _getPGDBRasters(self, dsn): message=_( "Getting list of tables columns data types" " from PostGIS DB <{db}>, host <{host}> failed." - " {error}.".format( - db=self._getPGDBConnectionParam( - dsn, - conn_param="dbname", - ), - host=self._getPGDBConnectionParam( - dsn, - conn_param="host", - ), - error=gs.utils.decode(error), + " {error}." + ).format( + db=self._getPGDBConnectionParam( + dsn, + conn_param="dbname", ), + host=self._getPGDBConnectionParam( + dsn, + conn_param="host", + ), + error=gs.utils.decode(error), ), ) if ret: @@ -2644,8 +2644,8 @@ def _getPGDBRasters(self, dsn): parent=self, message=_( "PostgreSQL DB <{psql}> program was not found." - " Please, install it.".format(psql=self._psql) - ), + " Please, install it." + ).format(psql=self._psql), ) Debug.msg(3, f"GdalSelect._getPGDBRasters(): return {rasters}") return rasters diff --git a/gui/wxpython/gui_core/pyedit.py b/gui/wxpython/gui_core/pyedit.py index 9fa75fa74c1..4974e0ce8f5 100644 --- a/gui/wxpython/gui_core/pyedit.py +++ b/gui/wxpython/gui_core/pyedit.py @@ -306,14 +306,14 @@ def _openFile(self, file_path): GError( message=_( "Permission denied <{}>. Please change file " - "permission for reading.".format(file_path) - ), + "permission for reading." + ).format(file_path), parent=self.guiparent, showTraceback=False, ) except OSError: GError( - message=_("Couldn't read file <{}>.".format(file_path)), + message=_("Couldn't read file <{}>.").format(file_path), parent=self.guiparent, ) @@ -333,20 +333,18 @@ def _writeFile(self, file_path, content, additional_err_message=""): GError( message=_( "Permission denied <{}>. Please change file " - "permission for writing.{}".format( - file_path, - additional_err_message, - ), + "permission for writing.{}" + ).format( + file_path, + additional_err_message, ), parent=self.guiparent, showTraceback=False, ) except OSError: GError( - message=_( - "Couldn't write file <{}>.{}".format( - file_path, additional_err_message - ), + message=_("Couldn't write file <{}>.{}").format( + file_path, additional_err_message ), parent=self.guiparent, ) @@ -359,7 +357,7 @@ def OnRun(self, event): file_is_written = self._writeFile( file_path=self.filename, content=self.body.GetText(), - additional_err_message=" Unable to launch Python script.", + additional_err_message=_(" Unable to launch Python script."), ) if file_is_written: mode = stat.S_IMODE(os.lstat(self.filename)[stat.ST_MODE]) @@ -369,7 +367,7 @@ def OnRun(self, event): file_is_written = self._writeFile( file_path=self.filename, content=self.body.GetText(), - additional_err_message=" Unable to launch Python script.", + additional_err_message=_(" Unable to launch Python script."), ) if file_is_written: # set executable file @@ -509,9 +507,8 @@ def OpenRecentFile(self, path, file_exists, file_history): if not file_exists: GError( _( - "File <{}> doesn't exist." - "It was probably moved or deleted.".format(path) - ), + "File <{path}> doesn't exist. It was probably moved or deleted." + ).format(path=path), parent=self.guiparent, ) return diff --git a/gui/wxpython/gui_core/pystc.py b/gui/wxpython/gui_core/pystc.py index a1dfc543320..33d5f03b5f9 100644 --- a/gui/wxpython/gui_core/pystc.py +++ b/gui/wxpython/gui_core/pystc.py @@ -262,10 +262,8 @@ def OnKeyPressed(self, event): self.modified = True if self.statusbar: self.statusbar.SetStatusText( - _( - "{} script contains local modifications".format( - self.script_type - ) + _("{} script contains local modifications").format( + self.script_type ), 0, ) diff --git a/gui/wxpython/gui_core/query.py b/gui/wxpython/gui_core/query.py index 6250095cb29..5e0f734fa6a 100644 --- a/gui/wxpython/gui_core/query.py +++ b/gui/wxpython/gui_core/query.py @@ -136,11 +136,11 @@ def ShowContextMenu(self, node): ) else: label1 = nodes[0].label - texts.append((_("Copy '%s'" % self._cutLabel(label1)), label1)) + texts.append((_("Copy '%s'") % self._cutLabel(label1), label1)) col1 = self._colNames[1] if nodes[0].data and col1 in nodes[0].data and nodes[0].data[col1]: label2 = nodes[0].data[col1] - texts.insert(0, (_("Copy '%s'" % self._cutLabel(label2)), label2)) + texts.insert(0, (_("Copy '%s'") % self._cutLabel(label2), label2)) texts.append((_("Copy line"), label1 + ": " + label2)) ids = [] diff --git a/gui/wxpython/history/browser.py b/gui/wxpython/history/browser.py index 6a31523d51f..422d6dcc9c2 100644 --- a/gui/wxpython/history/browser.py +++ b/gui/wxpython/history/browser.py @@ -60,7 +60,7 @@ def get_translated_value(key, value): exec_datetime = datetime.fromisoformat(value) return exec_datetime.strftime("%Y-%m-%d %H:%M:%S") elif key == "runtime": - return _("{} sec".format(value)) + return _("{} sec").format(value) elif key == "status": return _(value.capitalize()) elif key in {"mask2d", "mask3d"}: @@ -480,7 +480,7 @@ def OnCmdExportHistory(self, event): try: history.copy(history_path, target_path) self.showNotification.emit( - message=_("Command history saved to '{}'".format(target_path)) + message=_("Command history saved to '{}'").format(target_path) ) except OSError as e: GError(str(e)) diff --git a/gui/wxpython/iclass/dialogs.py b/gui/wxpython/iclass/dialogs.py index 8aaac14c4c8..322bfcf5721 100644 --- a/gui/wxpython/iclass/dialogs.py +++ b/gui/wxpython/iclass/dialogs.py @@ -835,10 +835,10 @@ def OnOK(self, event): qdlg = wx.MessageDialog( parent=self, message=_( - "Vector map <%s> already exists." - " Do you want to overwrite it?" % vName - ), - caption=_("Vector <%s> exists" % vName), + "Vector map <%s> already exists. Do you want to overwrite it?" + ) + % vName, + caption=_("Vector <%s> exists") % vName, style=wx.YES_NO | wx.NO_DEFAULT | wx.ICON_QUESTION | wx.CENTRE, ) if qdlg.ShowModal() == wx.ID_YES: diff --git a/gui/wxpython/iclass/frame.py b/gui/wxpython/iclass/frame.py index 52af10d85e0..69c18780249 100644 --- a/gui/wxpython/iclass/frame.py +++ b/gui/wxpython/iclass/frame.py @@ -646,11 +646,14 @@ def _checkImportedTopo(self, vector): warning = "" if topo["areas"] == 0: - warning = _("No areas in vector map <%s>.\n" % vector) + warning = _("No areas in vector map <%s>.\n") % vector if topo["points"] or topo["lines"]: - warning += _( - "Vector map <%s> contains points or lines, " - "these features are ignored." % vector + warning += ( + _( + "Vector map <%s> contains points or lines, " + "these features are ignored." + ) + % vector ) return warning diff --git a/gui/wxpython/iclass/plots.py b/gui/wxpython/iclass/plots.py index 786fa920d17..510953bb5b1 100644 --- a/gui/wxpython/iclass/plots.py +++ b/gui/wxpython/iclass/plots.py @@ -88,9 +88,12 @@ def _createScatterPlotPanel(self): ) self.iscatt_panel.Hide() except ImportError as e: - self.scatt_error = _( - "Scatter plot functionality is disabled.\n\nReason: " - "Unable to import packages needed for scatter plot.\n%s" % e + self.scatt_error = ( + _( + "Scatter plot functionality is disabled.\n\nReason: " + "Unable to import packages needed for scatter plot.\n%s" + ) + % e ) wx.CallAfter(GError, self.scatt_error, showTraceback=False, parent=self) self.iscatt_panel = None diff --git a/gui/wxpython/image2target/ii2t_gis_set.py b/gui/wxpython/image2target/ii2t_gis_set.py index e3cb0257af1..0f51d969e93 100644 --- a/gui/wxpython/image2target/ii2t_gis_set.py +++ b/gui/wxpython/image2target/ii2t_gis_set.py @@ -547,7 +547,7 @@ def _readGisRC(self): key, val = line.split(":", 1) except ValueError as e: sys.stderr.write( - _("Invalid line in GISRC file (%s):%s\n" % (e, line)) + _("Invalid line in GISRC file (%s):%s\n") % (e, line) ) grassrc[key.strip()] = DecodeString(val.strip()) finally: diff --git a/gui/wxpython/iscatt/controllers.py b/gui/wxpython/iscatt/controllers.py index 38e61e34133..e8884f4f78b 100644 --- a/gui/wxpython/iscatt/controllers.py +++ b/gui/wxpython/iscatt/controllers.py @@ -234,8 +234,9 @@ def AddScattPlot(self): "Number of cells (rows*cols) <%d> in current region" "is higher than maximum limit <%d>.\n\n" "You can reduce number of cells in current region using " - " command." % (ncells, MAX_NCELLS) - ), + " command." + ) + % (ncells, MAX_NCELLS), ) ) return @@ -250,8 +251,8 @@ def AddScattPlot(self): "It can be done by command.\n\n" "Do you want to continue using " "Interactive Scatter Plot Tool with this region?" - % (ncells, WARN_NCELLS) - ), + ) + % (ncells, WARN_NCELLS), style=wx.YES_NO | wx.NO_DEFAULT | wx.ICON_WARNING, ) ret = dlg.ShowModal() @@ -318,11 +319,11 @@ def CheckBands(self, b_1, b_2): err = "" for b in [b_1_name, b_2_name]: if self.bands_info[b] is None: - err += _("Band <%s> is not CELL (integer) type.\n" % b) + err += _("Band <%s> is not CELL (integer) type.\n") % b if err: GMessage( parent=self.guiparent, - message=_("Scatter plot cannot be added.\n" + err), + message=_("Scatter plot cannot be added.\n") + err, ) return False @@ -334,14 +335,14 @@ def CheckBands(self, b_1, b_2): "Scatter plot cannot be added.\n" "Multiple of bands ranges <%s:%d * %s:%d = %d> " "is higher than maximum limit <%d>.\n" - % ( - b_1_name, - b_1_i["range"], - b_1_name, - b_2_i["range"], - mrange, - MAX_SCATT_SIZE, - ) + ) + % ( + b_1_name, + b_1_i["range"], + b_1_name, + b_2_i["range"], + mrange, + MAX_SCATT_SIZE, ), ) return False @@ -354,14 +355,14 @@ def CheckBands(self, b_1, b_2): "It is strongly advised to reduce range extend of bands" "(e. g. using r.rescale) below recommended threshold.\n\n" "Do you really want to add this scatter plot?" - % ( - b_1_name, - b_1_i["range"], - b_1_name, - b_2_i["range"], - mrange, - WARN_SCATT_SIZE, - ) + ) + % ( + b_1_name, + b_1_i["range"], + b_1_name, + b_2_i["range"], + mrange, + WARN_SCATT_SIZE, ), style=wx.YES_NO | wx.NO_DEFAULT | wx.ICON_WARNING, ) diff --git a/gui/wxpython/iscatt/dialogs.py b/gui/wxpython/iscatt/dialogs.py index 4129015e88d..3e2d7fa7a59 100644 --- a/gui/wxpython/iscatt/dialogs.py +++ b/gui/wxpython/iscatt/dialogs.py @@ -327,10 +327,10 @@ def OnOK(self, event): qdlg = wx.MessageDialog( parent=self, message=_( - "Raster map <%s> already exists." - " Do you want to overwrite it?" % rast_name - ), - caption=_("Raster <%s> exists" % rast_name), + "Raster map <%s> already exists. Do you want to overwrite it?" + ) + % rast_name, + caption=_("Raster <%s> exists") % rast_name, style=wx.YES_NO | wx.NO_DEFAULT | wx.ICON_QUESTION | wx.CENTRE, ) if qdlg.ShowModal() == wx.ID_YES: diff --git a/gui/wxpython/iscatt/frame.py b/gui/wxpython/iscatt/frame.py index 6d87a90e273..45f50622d2f 100644 --- a/gui/wxpython/iscatt/frame.py +++ b/gui/wxpython/iscatt/frame.py @@ -681,7 +681,7 @@ def OnPopupOpacityLevel(self, event): name = cat_attrs["name"] dlg = SetOpacityDialog( - self, opacity=value, title=_("Change opacity of class <%s>" % name) + self, opacity=value, title=_("Change opacity of class <%s>") % name ) dlg.applyOpacity.connect( diff --git a/gui/wxpython/iscatt/iscatt_core.py b/gui/wxpython/iscatt/iscatt_core.py index 91ac00014a5..a881fab5845 100644 --- a/gui/wxpython/iscatt/iscatt_core.py +++ b/gui/wxpython/iscatt/iscatt_core.py @@ -295,7 +295,7 @@ def _rasterize(self, grass_region, layer, cat, out_rast): ) if ret != 0: - GException(_("v.build failed:\n%s" % msg)) + GException(_("v.build failed:\n%s") % msg) environs = os.environ.copy() environs["GRASS_REGION"] = grass_region["GRASS_REGION"] @@ -315,7 +315,7 @@ def _rasterize(self, grass_region, layer, cat, out_rast): ) if ret != 0: - GException(_("v.to.rast failed:\n%s" % msg)) + GException(_("v.to.rast failed:\n{messages}").format(messages=msg)) def _create_grass_region_env(self, bbox): r = self.an_data.GetRegion() diff --git a/gui/wxpython/lmgr/frame.py b/gui/wxpython/lmgr/frame.py index de06305086f..a17b168f747 100644 --- a/gui/wxpython/lmgr/frame.py +++ b/gui/wxpython/lmgr/frame.py @@ -1251,8 +1251,8 @@ def OnRunScript(self, event): "Do you want to set the permissions " "that allows you to run this script " "(note that you must be the owner of the file)?" - % os.path.basename(filename) - ), + ) + % os.path.basename(filename), caption=_("Set permission?"), style=wx.YES_NO | wx.YES_DEFAULT | wx.ICON_QUESTION, ) diff --git a/gui/wxpython/lmgr/workspace.py b/gui/wxpython/lmgr/workspace.py index febb3922dd7..bb40469fa56 100644 --- a/gui/wxpython/lmgr/workspace.py +++ b/gui/wxpython/lmgr/workspace.py @@ -548,9 +548,8 @@ def OpenRecentFile(self, path, file_exists, file_history): """ if not file_exists: GError( - _( - "File <{}> doesn't exist." - " It was probably moved or deleted.".format(path) + _("File <{}> doesn't exist. It was probably moved or deleted.").format( + path ), parent=self.lmgr, ) diff --git a/gui/wxpython/location_wizard/dialogs.py b/gui/wxpython/location_wizard/dialogs.py index 16325ddfbe1..079fca1f6d4 100644 --- a/gui/wxpython/location_wizard/dialogs.py +++ b/gui/wxpython/location_wizard/dialogs.py @@ -594,8 +594,8 @@ def __UpdateInfo(self): self.lcols.SetLabel(_("Cols: %d") % self.cols) self.lcells.SetLabel(_("Cells: %d") % self.cells) # 3D - self.ldepth.SetLabel(_("Depth: %d" % self.depth)) - self.lcells3.SetLabel(_("3D Cells: %d" % self.cells3)) + self.ldepth.SetLabel(_("Depth: %d") % self.depth) + self.lcells3.SetLabel(_("3D Cells: %d") % self.cells3) def OnSetButton(self, event=None): """Set default region""" diff --git a/gui/wxpython/location_wizard/wizard.py b/gui/wxpython/location_wizard/wizard.py index 155346b3467..7ba03ebee04 100644 --- a/gui/wxpython/location_wizard/wizard.py +++ b/gui/wxpython/location_wizard/wizard.py @@ -2723,7 +2723,7 @@ def OnWizFinished(self): if not self.filepage.georeffile or not os.path.isfile( self.filepage.georeffile ): - return _("File <%s> not found." % self.filepage.georeffile) + return _("File <%s> not found.") % self.filepage.georeffile grass.create_location( dbase=self.startpage.grassdatabase, diff --git a/gui/wxpython/main_window/frame.py b/gui/wxpython/main_window/frame.py index facb3f8195a..3b9b7f50261 100644 --- a/gui/wxpython/main_window/frame.py +++ b/gui/wxpython/main_window/frame.py @@ -1402,8 +1402,8 @@ def OnRunScript(self, event): "Do you want to set the permissions " "that allows you to run this script " "(note that you must be the owner of the file)?" - % os.path.basename(filename) - ), + ) + % os.path.basename(filename), caption=_("Set permission?"), style=wx.YES_NO | wx.YES_DEFAULT | wx.ICON_QUESTION, ) diff --git a/gui/wxpython/mapdisp/frame.py b/gui/wxpython/mapdisp/frame.py index 8cb8a51d407..0b948f63794 100644 --- a/gui/wxpython/mapdisp/frame.py +++ b/gui/wxpython/mapdisp/frame.py @@ -411,8 +411,9 @@ def AddNviz(self): message=_( "Unable to switch to 3D display mode.\nThe Nviz python extension " "was not found or loaded properly.\n" - "Switching back to 2D display mode.\n\nDetails: %s" % errorMsg - ), + "Switching back to 2D display mode.\n\nDetails: %s" + ) + % errorMsg, ) return diff --git a/gui/wxpython/mapdisp/test_mapdisp.py b/gui/wxpython/mapdisp/test_mapdisp.py index 7a61e196ba9..1494988fafb 100755 --- a/gui/wxpython/mapdisp/test_mapdisp.py +++ b/gui/wxpython/mapdisp/test_mapdisp.py @@ -356,7 +356,7 @@ def main(): tester.testMapWindowRlisetup(map_) else: # TODO: this should not happen but happens - gs.fatal(_("Unknown value %s of test parameter." % test)) + gs.fatal(_("Unknown value %s of test parameter.") % test) app.MainLoop() diff --git a/gui/wxpython/mapwin/analysis.py b/gui/wxpython/mapwin/analysis.py index 490a9d7e866..d0a7be1bc0c 100644 --- a/gui/wxpython/mapwin/analysis.py +++ b/gui/wxpython/mapwin/analysis.py @@ -262,11 +262,7 @@ def Start(self): self._useCtypes = True except ImportError as e: self._giface.WriteWarning( - _( - "Geodesic distance calculation " - "is not available.\n" - "Reason: %s" % e - ) + _("Geodesic distance calculation is not available.\nReason: %s") % e ) def MeasureDist(self, beginpt, endpt): diff --git a/gui/wxpython/rdigit/g.gui.rdigit.py b/gui/wxpython/rdigit/g.gui.rdigit.py index d740b1c3e78..ae8d9ed41d8 100755 --- a/gui/wxpython/rdigit/g.gui.rdigit.py +++ b/gui/wxpython/rdigit/g.gui.rdigit.py @@ -193,10 +193,8 @@ def OnMapCreated(self, name, ltype, add: bool | None = None): if not edit_map: gs.fatal( - _( - "Raster map <{}> not found in current mapset.".format( - options["edit"], - ), + _("Raster map <{}> not found in current mapset.").format( + options["edit"], ), ) else: @@ -209,11 +207,8 @@ def OnMapCreated(self, name, ltype, add: bool | None = None): )["fullname"] if not base_map: gs.fatal( - _( - "Base raster map <{}> not found in " - "current mapset.".format( - options["base"], - ), + _("Base raster map <{}> not found in current mapset.").format( + options["base"], ), ) kwargs["base_map"] = base_map diff --git a/gui/wxpython/rlisetup/frame.py b/gui/wxpython/rlisetup/frame.py index 00e35f66110..3905fa9b09d 100644 --- a/gui/wxpython/rlisetup/frame.py +++ b/gui/wxpython/rlisetup/frame.py @@ -40,9 +40,8 @@ def __init__( self.confilesBox = StaticBox( parent=self.panel, id=wx.ID_ANY, - label=_( - "View and modify the " - "configuration file '{name}'".format(name=self.confile) + label=_("View and modify the configuration file '{name}'").format( + name=self.confile ), ) self.textCtrl = TextCtrl( diff --git a/gui/wxpython/rlisetup/functions.py b/gui/wxpython/rlisetup/functions.py index 28f186fa396..2ce0b747dcd 100644 --- a/gui/wxpython/rlisetup/functions.py +++ b/gui/wxpython/rlisetup/functions.py @@ -153,8 +153,9 @@ def sampleAreaVector( "The raster map <%s> already exists." " Please remove or rename the maps " "with the prefix '%s' or select the " - "option to overwrite existing maps" % (rast_name, outpref) + "option to overwrite existing maps" ) + % (rast_name, outpref) ) return None convertFeature(vect, rast_name, cat, rast, layer, overwrite) diff --git a/gui/wxpython/rlisetup/wizard.py b/gui/wxpython/rlisetup/wizard.py index 54c6dbcd78a..4ecbb60e188 100644 --- a/gui/wxpython/rlisetup/wizard.py +++ b/gui/wxpython/rlisetup/wizard.py @@ -1859,8 +1859,8 @@ def newCat(self): "The raster map <%s> already exists." " Please remove or rename the maps " "with the prefix '%s' or select the " - "option to overwrite existing maps" % (self.outname, self.outpref) - ), + "option to overwrite existing maps" + ).format(self.outname, self.outpref), ) self.parent.wizard.ShowPage(self.parent.samplingareapage) return diff --git a/gui/wxpython/startup/locdownload.py b/gui/wxpython/startup/locdownload.py index f0a1ab13fd2..75eae560244 100644 --- a/gui/wxpython/startup/locdownload.py +++ b/gui/wxpython/startup/locdownload.py @@ -156,12 +156,12 @@ def reporthook(count, block_size, total_size): sys.stdout.write( _( "Download in progress, wait until it is finished " - "{0}%, {1} MB, {2} KB/s, {3:.0f} seconds passed".format( - percent, - progress_size / (1024 * 1024), - speed, - duration, - ), + "{0}%, {1} MB, {2} KB/s, {3:.0f} seconds passed" + ).format( + percent, + progress_size / (1024 * 1024), + speed, + duration, ), ) diff --git a/gui/wxpython/timeline/frame.py b/gui/wxpython/timeline/frame.py index f69dcc89aef..3982034619c 100644 --- a/gui/wxpython/timeline/frame.py +++ b/gui/wxpython/timeline/frame.py @@ -527,7 +527,7 @@ def _checkDatasets(self, datasets): elif len(indices) >= 2: dlg = wx.SingleChoiceDialog( self, - message=_("Please specify the space time dataset <%s>." % dataset), + message=_("Please specify the space time dataset <%s>.") % dataset, caption=_("Ambiguous dataset name"), choices=[ ( diff --git a/gui/wxpython/tplot/frame.py b/gui/wxpython/tplot/frame.py index 62147f54ad6..db21da4cd14 100755 --- a/gui/wxpython/tplot/frame.py +++ b/gui/wxpython/tplot/frame.py @@ -669,8 +669,8 @@ def _getSTVDData(self, timeseries): showTraceback=False, message=_( "No connection between vector map {vmap} " - "and layer {la}".format(vmap=row["name"], la=lay) - ), + "and layer {la}" + ).format(vmap=row["name"], la=lay), ) return vals = gs.vector_db_select( @@ -740,7 +740,7 @@ def _setLabels(self, x): if self.drawX != "": self.axes2d.set_xlabel(self.drawX) elif self.temporalType == "absolute": - self.axes2d.set_xlabel(_("Temporal resolution: %s" % x)) + self.axes2d.set_xlabel(_("Temporal resolution: %s") % x) else: self.axes2d.set_xlabel(_("Time [%s]") % self.unit) if self.drawY != "": @@ -917,8 +917,8 @@ def drawVCats(self): message=_( "Problem getting data from vector temporal" " dataset. Empty list of values for cat " - "{ca}.".format(ca=name_cat[1].replace("cat", "")) - ), + "{ca}." + ).format(ca=name_cat[1].replace("cat", "")), ) continue self.lookUp.AddDataset(yranges=ydata, xranges=xdata, datasetName=name) @@ -1007,9 +1007,8 @@ def OnRedraw(self, event=None): if os.path.exists(self.csvpath) and not self.overwrite: dlg = wx.MessageDialog( self, - _( - "{pa} already exists, do you want " - "to overwrite?".format(pa=self.csvpath) + _("{pa} already exists, do you want to overwrite?").format( + pa=self.csvpath ), _("File exists"), wx.OK | wx.CANCEL | wx.ICON_QUESTION, @@ -1185,7 +1184,7 @@ def _checkDatasets(self, datasets, typ): elif len(indices) >= 2: dlg = wx.SingleChoiceDialog( self, - message=_("Please specify the space time dataset <%s>." % dataset), + message=_("Please specify the space time dataset <%s>.") % dataset, caption=_("Ambiguous dataset name"), choices=[ ( @@ -1368,7 +1367,7 @@ def InfoFormat(timeData, values): text.append(_("Space time 3D raster dataset: %s") % key) text.extend( - (_("Value for {date} is {val}".format(date=val[0], val=val[1])), "\n") + (_("Value for {date} is {val}").format(date=val[0], val=val[1]), "\n") ) text.append(_("Press Del to dismiss.")) diff --git a/gui/wxpython/vnet/vnet_data.py b/gui/wxpython/vnet/vnet_data.py index a1332398a1e..6404fcac5c0 100644 --- a/gui/wxpython/vnet/vnet_data.py +++ b/gui/wxpython/vnet/vnet_data.py @@ -154,7 +154,7 @@ def InputsErrorMsgs( if flags["t"] and "turn_layer" not in relevant_params: GMessage( parent=self.guiparent, - message=_("Module <%s> does not support turns costs." % analysis), + message=_("Module <%s> does not support turns costs.") % analysis, ) return False diff --git a/gui/wxpython/web_services/dialogs.py b/gui/wxpython/web_services/dialogs.py index d67a2b34f7d..e47400cae70 100644 --- a/gui/wxpython/web_services/dialogs.py +++ b/gui/wxpython/web_services/dialogs.py @@ -331,7 +331,6 @@ def OnSettingsChanged(self, data): def OnClose(self, event): """Close the dialog""" - """Close dialog""" if not self.IsModal(): self.Destroy() event.Skip() @@ -378,7 +377,7 @@ def OnConnect(self, event): self.Fit() self.statusbar.SetStatusText( - _("Connecting to <%s>..." % self.server.GetValue().strip()) + _("Connecting to <$s>...") % self.server.GetValue().strip() ) # number of panels already connected @@ -464,14 +463,14 @@ def UpdateDialogAfterConnection(self): ) self._showWsPanel(self.web_service_sel[self.choose_ws_rb.GetSelection()]) self.statusbar.SetStatusText( - _("Connected to <%s>" % self.server.GetValue().strip()) + _("Connected to <%s>") % self.server.GetValue().strip() ) for btn in self.run_btns: btn.Enable(True) # no web service found on server else: self.statusbar.SetStatusText( - _("Unable to connect to <%s>" % self.server.GetValue().strip()) + _("Unable to connect to <%s>") % self.server.GetValue().strip() ) for btn in self.run_btns: btn.Enable(False) @@ -1029,7 +1028,7 @@ def OnSave(self, event): not self.overwrite.IsChecked() and gs.find_file(self.output, "cell", ".")["fullname"] ): - msg = _("Output map <%s> already exists" % self.output) + msg = _("Output map <%s> already exists") % self.output if msg: GMessage(parent=self, message=msg) @@ -1047,8 +1046,8 @@ def OnSave(self, event): if self.region_types["named"].GetValue(): if not gs.find_file(reg_spl[0], "windows", reg_mapset)["fullname"]: - msg = _( - "Region <%s> does not exist." % self.params["region"].GetValue() + msg = ( + _("Region <%s> does not exist.") % self.params["region"].GetValue() ) GWarning(parent=self, message=msg) return diff --git a/gui/wxpython/web_services/widgets.py b/gui/wxpython/web_services/widgets.py index 83fe7a5706c..3cb3af18068 100644 --- a/gui/wxpython/web_services/widgets.py +++ b/gui/wxpython/web_services/widgets.py @@ -538,10 +538,8 @@ def OnCapDownloadDone(self, event): if event.returncode != 0: if self.cmd_err_str: self.cmd_err_str = ( - _( - "Unable to download %s capabilities file\nfrom <%s>:\n" - % (self.ws.replace("_", " "), self.conn["url"]) - ) + _("Unable to download %s capabilities file\nfrom <%s>:\n") + % (self.ws.replace("_", " "), self.conn["url"]) + self.cmd_err_str ) self._postCapParsedEvt(error_msg=self.cmd_err_str) @@ -559,8 +557,9 @@ def _parseCapFile(self, cap_file): except (OSError, ParseError) as error: error_msg = _( "%s web service was not found in fetched capabilities file from " - "<%s>:\n%s\n" % (self.ws, self.conn["url"], str(error)) - ) + "<%s>:\n%s\n" + ) % (self.ws, self.conn["url"], str(error)) + if Debug.GetLevel() != 0: Debug.msg(1, error_msg) self._postCapParsedEvt(None) diff --git a/gui/wxpython/wxgui.py b/gui/wxpython/wxgui.py index 201eb0fe738..447821c6724 100644 --- a/gui/wxpython/wxgui.py +++ b/gui/wxpython/wxgui.py @@ -100,10 +100,10 @@ def show_main_gui(): warning( _( "Current version of wxPython {} is lower than " - "minimum required version {}".format( - wx.__version__, - ".".join(map(str, min_required_wx_version)), - ) + "minimum required version {}" + ).format( + wx.__version__, + ".".join(map(str, min_required_wx_version)), ) ) else: diff --git a/lib/init/grass.py b/lib/init/grass.py index 5a62e65ac53..28537f957b1 100755 --- a/lib/init/grass.py +++ b/lib/init/grass.py @@ -1314,16 +1314,17 @@ def lock_mapset(mapset_path, force_gislock_removal, user): "You can force launching GRASS using -f flag" " (note that you need permission for this operation)." " Have another look in the processor " - "manager just to be sure..." % {"user": user, "file": lockfile} - ) + "manager just to be sure..." + ) % {"user": user, "file": lockfile} + else: try_remove(lockfile) message( _( "%(user)s is currently running GRASS in selected mapset" " (file %(file)s found). Forcing to launch GRASS..." - % {"user": user, "file": lockfile} ) + % {"user": user, "file": lockfile} ) elif ret != 0: msg = ( diff --git a/pyproject.toml b/pyproject.toml index eb866cb0e08..f6d37ac3bea 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -280,61 +280,19 @@ ignore = [ [tool.ruff.lint.per-file-ignores] # See https://docs.astral.sh/ruff/settings/#lint_per-file-ignores # "A005", # builtin-module-shadowing -# "INT002", # f-string-in-get-text-func-call -# "INT001", # format-in-get-text-func-call -# "INT003", # printf-in-get-text-func-call # "PLW0108", # unnecessary-lambda # Ignore `E402` (import violations) in all `__init__.py` files "*/testsuite/**.py" = ["PT009", "PT027"] "__init__.py" = ["E402"] -"general/g.parser/test.py" = ["INT003"] "gui/**" = ["PLW0108"] # See https://github.com/OSGeo/grass/issues/4124 -"gui/wxpython/animation/dialogs.py" = ["INT002"] -"gui/wxpython/animation/temporal_manager.py" = ["INT003"] -"gui/wxpython/core/debug.py" = ["INT002"] -"gui/wxpython/core/render.py" = ["INT003"] -"gui/wxpython/gcp/manager.py" = ["INT002"] -"gui/wxpython/gmodeler/model.py" = ["INT001"] -"gui/wxpython/gmodeler/panels.py" = ["INT002", "INT003"] -"gui/wxpython/gui_core/ghelp.py" = ["INT003"] -"gui/wxpython/gui_core/gselect.py" = ["INT002"] -"gui/wxpython/gui_core/pyedit.py" = ["INT002"] -"gui/wxpython/gui_core/pystc.py" = ["INT002"] -"gui/wxpython/gui_core/query.py" = ["INT003"] -"gui/wxpython/history/browser.py" = ["INT002"] -"gui/wxpython/iclass/dialogs.py" = ["INT003"] -"gui/wxpython/iclass/frame.py" = ["FLY002", "INT003"] -"gui/wxpython/iclass/plots.py" = ["INT003"] +"gui/wxpython/iclass/frame.py" = ["FLY002"] "gui/wxpython/iclass/statistics.py" = ["A005"] -"gui/wxpython/image2target/ii2t_gis_set.py" = ["INT003"] -"gui/wxpython/iscatt/controllers.py" = ["INT003"] -"gui/wxpython/iscatt/dialogs.py" = ["INT003"] -"gui/wxpython/iscatt/frame.py" = ["INT003"] -"gui/wxpython/iscatt/iscatt_core.py" = ["INT003"] "gui/wxpython/iscatt/plots.py" = ["PLW0108"] -"gui/wxpython/lmgr/frame.py" = ["INT003"] -"gui/wxpython/lmgr/workspace.py" = ["INT002"] -"gui/wxpython/location_wizard/dialogs.py" = ["INT003"] -"gui/wxpython/location_wizard/wizard.py" = ["INT003"] -"gui/wxpython/main_window/frame.py" = ["INT003"] -"gui/wxpython/mapdisp/frame.py" = ["INT003"] -"gui/wxpython/mapdisp/test_mapdisp.py" = ["INT003"] -"gui/wxpython/mapwin/analysis.py" = ["INT003"] "gui/wxpython/psmap/utils.py" = ["PGH004"] -"gui/wxpython/rdigit/g.gui.rdigit.py" = ["INT002"] -"gui/wxpython/rlisetup/frame.py" = ["INT002"] -"gui/wxpython/rlisetup/functions.py" = ["INT003"] -"gui/wxpython/rlisetup/wizard.py" = ["INT003"] -"gui/wxpython/startup/locdownload.py" = ["INT002"] -"gui/wxpython/timeline/frame.py" = ["FLY002", "INT003"] -"gui/wxpython/tplot/frame.py" = ["FLY002", "INT002", "INT003"] -"gui/wxpython/vnet/vnet_data.py" = ["INT003"] -"gui/wxpython/web_services/dialogs.py" = ["INT003"] -"gui/wxpython/web_services/widgets.py" = ["INT003"] -"gui/wxpython/wxgui.py" = ["INT002"] +"gui/wxpython/timeline/frame.py" = ["FLY002"] +"gui/wxpython/tplot/frame.py" = ["FLY002"] "gui/wxpython/wxplot/profile.py" = ["A005"] "lib/imagery/testsuite/test_imagery_sigsetfile.py" = ["FURB152"] -"lib/init/grass.py" = ["INT003"] "python/grass/__init__.py" = ["PYI056"] "python/grass/exp*/tests/grass_script_mapset_session_test.py" = ["SIM117"] "python/grass/exp*/tests/grass_script_tmp_mapset_session_test.py" = ["SIM117"] @@ -346,64 +304,22 @@ ignore = [ "python/grass/jupyter/testsuite/interactivemap_test.py" = ["PGH004"] "python/grass/jupyter/testsuite/map_test.py" = ["PGH004"] "python/grass/pydispatch/signal.py" = ["A005"] -"python/grass/pygrass/raster/category.py" = ["INT002"] -"python/grass/pygrass/vector/__init__.py" = ["INT003"] "python/grass/pygrass/vector/geometry.py" = ["PYI024"] "python/grass/pygrass/vector/sql.py" = ["FLY002"] "python/grass/pygrass/vector/testsuite/test_table.py" = ["PLW0108"] "python/grass/script/array.py" = ["A005"] -"python/grass/script/raster.py" = ["INT003"] -"python/grass/temporal/abstract_space_time_dataset.py" = ["INT003"] -"python/grass/temporal/aggregation.py" = ["INT003"] -"python/grass/temporal/c_libraries_interface.py" = ["INT003"] -"python/grass/temporal/core.py" = ["INT002", "INT003"] -"python/grass/temporal/datetime_math.py" = ["INT003"] -"python/grass/temporal/mapcalc.py" = ["INT003"] -"python/grass/temporal/space_time_datasets.py" = ["INT003"] -"python/grass/temporal/stds_export.py" = ["INT003"] -"python/grass/temporal/stds_import.py" = ["INT003"] -"python/grass/temporal/temporal_algebra.py" = ["INT003"] -"python/grass/temporal/temporal_raster_base_algebra.py" = ["INT003"] -"python/grass/temporal/univar_statistics.py" = ["INT002"] "raster3d/r3.flow/testsuite/r3flow_test.py" = ["FLY002"] "raster3d/r3.gradient/testsuite/r3gradient_test.py" = ["FLY002"] -"scripts/d.polar/d.polar.py" = ["FURB154", "INT002"] -"scripts/g.extension.all/g.extension.all.py" = ["INT002"] -"scripts/g.extension/g.extension.py" = ["INT002"] -"scripts/i.oif/i.oif.py" = ["INT003"] -"scripts/i.pansharpen/i.pansharpen.py" = ["FLY002", "INT003"] -"scripts/i.spectral/i.spectral.py" = ["FLY002", "INT002"] +"scripts/d.polar/d.polar.py" = ["FURB154"] +"scripts/i.pansharpen/i.pansharpen.py" = ["FLY002"] +"scripts/i.spectral/i.spectral.py" = ["FLY002"] "scripts/r.in.srtm/r.in.srtm.py" = ["FLY002"] -"scripts/r.in.wms/wms_base.py" = ["INT003"] -"scripts/r.in.wms/wms_cap_parsers.py" = ["INT003"] -"scripts/r.in.wms/wms_drv.py" = ["INT003"] -"scripts/r.in.wms/wms_gdal_drv.py" = ["INT003"] -"scripts/r.pack/r.pack.py" = ["INT003"] -"scripts/r.tileset/r.tileset.py" = ["INT003"] -"scripts/r.unpack/r.unpack.py" = ["INT002"] -"scripts/v.rast.stats/v.rast.stats.py" = ["INT002"] -"scripts/v.to.lines/v.to.lines.py" = ["INT003"] -"scripts/v.unpack/v.unpack.py" = ["INT002", "INT003"] -"scripts/v.what.strds/v.what.strds.py" = ["INT003"] -"temporal/t.rast.accdetect/t.rast.accdetect.py" = ["INT003"] -"temporal/t.rast.accumulate/t.rast.accumulate.py" = ["INT003"] "temporal/t.rast.algebra/testsu*/*_algebra_arithmetic.py" = ["FLY002"] -"temporal/t.rast.export/t.rast.export.py" = ["INT002"] -"temporal/t.rast.gapfill/t.rast.gapfill.py" = ["INT003"] -"temporal/t.rast.list/t.rast.list.py" = ["INT002"] -"temporal/t.rast.out.vtk/t.rast.out.vtk.py" = ["INT003"] -"temporal/t.rast.series/t.rast.series.py" = ["INT002"] -"temporal/t.rast.to.rast3/t.rast.to.rast3.py" = ["INT003"] -"temporal/t.rast.what/t.rast.what.py" = ["INT003"] "temporal/t.register/testsu*/*_raster_different_local.py" = ["FLY002"] "temporal/t.register/testsu*/*_raster_mapmetadata.py" = ["FLY002"] "temporal/t.register/testsuite/test_t_register_raster.py" = ["FLY002"] "temporal/t.register/testsuite/test_t_register_raster_file.py" = ["FLY002"] -"temporal/t.remove/t.remove.py" = ["INT002", "INT003"] -"temporal/t.unregister/t.unregister.py" = ["INT003"] -"temporal/t.vect.observe.strds/t.vect.observe.strds.py" = ["INT003"] "utils/generate_release_notes.py" = ["PGH004"] -"utils/mkhtml.py" = ["INT002"] "vector/v.fill.holes/examples.ipynb" = ["PTH201"] [tool.ruff.lint.flake8-import-conventions.extend-aliases] diff --git a/python/grass/pygrass/raster/category.py b/python/grass/pygrass/raster/category.py index 00381f91130..cfeb84ddde2 100644 --- a/python/grass/pygrass/raster/category.py +++ b/python/grass/pygrass/raster/category.py @@ -68,7 +68,7 @@ def _get_mtype(self): def _set_mtype(self, mtype): if mtype.upper() not in {"CELL", "FCELL", "DCELL"}: - raise ValueError(_("Raster type: {0} not supported".format(mtype))) + raise ValueError(_("Raster type: {0} not supported").format(mtype)) self._mtype = mtype self._gtype = RTYPE[self.mtype]["grass type"] diff --git a/python/grass/pygrass/vector/__init__.py b/python/grass/pygrass/vector/__init__.py index 6f29a167b2e..b5a24e8d9c1 100644 --- a/python/grass/pygrass/vector/__init__.py +++ b/python/grass/pygrass/vector/__init__.py @@ -855,7 +855,7 @@ def features_to_wkb_list(self, bbox=None, feature_type="point", field=1): if not barray: if error == -1: raise GrassError( - _("Unable to read line of feature %i" % (f_id)) + _("Unable to read line of feature %i") % (f_id) ) if error == -2: print("Empty feature %i" % (f_id)) @@ -947,7 +947,7 @@ def areas_to_wkb_list(self, bbox=None, field=1): self.c_mapinfo, a_id, ctypes.byref(size) ) if not barray: - raise GrassError(_("Unable to read area with id %i" % (a_id))) + raise GrassError(_("Unable to read area with id %i") % (a_id)) pcat = None c_ok = libvect.Vect_get_area_cats( diff --git a/python/grass/script/raster.py b/python/grass/script/raster.py index f9937902dab..32c0639b32f 100644 --- a/python/grass/script/raster.py +++ b/python/grass/script/raster.py @@ -65,8 +65,8 @@ def raster_history(map, overwrite=False, env=None): _( "Unable to write history for <%(map)s>. " "Raster map <%(map)s> not found in current mapset." - % {"map": map, "map": map} ) + % {"map": map, "map": map} ) return False diff --git a/python/grass/temporal/abstract_space_time_dataset.py b/python/grass/temporal/abstract_space_time_dataset.py index 515502ff3f1..cc68f92af2b 100644 --- a/python/grass/temporal/abstract_space_time_dataset.py +++ b/python/grass/temporal/abstract_space_time_dataset.py @@ -2025,7 +2025,7 @@ def shift(self, gran, dbif=None): ) if not check_granularity_string(gran, self.get_temporal_type()): - self.msgr.error(_("Wrong granularity format: %s" % (gran))) + self.msgr.error(_("Wrong granularity format: %s") % (gran)) return False dbif, connection_state_changed = init_dbif(dbif) diff --git a/python/grass/temporal/aggregation.py b/python/grass/temporal/aggregation.py index 1ea60eaeea1..354600855e0 100644 --- a/python/grass/temporal/aggregation.py +++ b/python/grass/temporal/aggregation.py @@ -154,16 +154,14 @@ def aggregate_raster_maps( _( "Raster map <%(name)s> is already in temporal " "database, use overwrite flag to overwrite" - % ({"name": new_map.get_name()}) ) + % ({"name": new_map.get_name()}) ) return msgr.verbose( - _( - "Computing aggregation of maps between %(st)s - %(end)s" - % {"st": str(start), "end": str(end)} - ) + _("Computing aggregation of maps between %(st)s - %(end)s") + % {"st": str(start), "end": str(end)} ) # Create the r.series input file @@ -356,8 +354,9 @@ def aggregate_by_topology( _( "Unable to perform aggregation. Output raster " "map <%(name)s> exists and overwrite flag was " - "not set" % ({"name": output_name}) + "not set" ) + % ({"name": output_name}) ) output_list.append(map_layer) @@ -380,8 +379,8 @@ def aggregate_by_topology( "reached (%i). The module r.series will " "be run with flag z, to avoid open " "files limit exceeding." - % (int(file_limit), len(aggregation_list)) ) + % (int(file_limit), len(aggregation_list)) ) mod(flags="z") process_queue.put(mod) diff --git a/python/grass/temporal/c_libraries_interface.py b/python/grass/temporal/c_libraries_interface.py index 6b67dfb9869..27e0ff62238 100644 --- a/python/grass/temporal/c_libraries_interface.py +++ b/python/grass/temporal/c_libraries_interface.py @@ -815,7 +815,7 @@ def _read_raster3d_info(name, mapset): ) if not g3map: - logging.error(_("Unable to open 3D raster map <%s>" % (name))) + logging.error(_("Unable to open 3D raster map <%s>"), (name)) return None maptype = libraster3d.Rast3d_file_type_map(g3map) @@ -830,7 +830,7 @@ def _read_raster3d_info(name, mapset): max = libgis.DCELL() ret = libraster3d.Rast3d_range_load(g3map) if not ret: - logging.error(_("Unable to load range of 3D raster map <%s>" % (name))) + logging.error(_("Unable to load range of 3D raster map <%s>"), (name)) return None libraster3d.Rast3d_range_min_max(g3map, byref(min), byref(max)) @@ -844,7 +844,7 @@ def _read_raster3d_info(name, mapset): kvp["max"] = float(max.value) if not libraster3d.Rast3d_close(g3map): - logging.error(_("Unable to close 3D raster map <%s>" % (name))) + logging.error(_("Unable to close 3D raster map <%s>"), (name)) return None return kvp @@ -887,10 +887,8 @@ def _read_vector_info(name, mapset): with_topo = False if libvector.Vect_open_old2(byref(Map), name, mapset, "1") < 1: logging.error( - _( - "Unable to open vector map <%s>" - % (libvector.Vect_get_full_name(byref(Map))) - ) + _("Unable to open vector map <%s>"), + (libvector.Vect_get_full_name(byref(Map))), ) return None diff --git a/python/grass/temporal/core.py b/python/grass/temporal/core.py index dc74bff151d..0448ff2371d 100644 --- a/python/grass/temporal/core.py +++ b/python/grass/temporal/core.py @@ -769,12 +769,12 @@ def init(raise_fatal_error=False, skip_db_version_check=False): "Temporal database version mismatch detected.\n{backup}" "Supported temporal database version is: {tdb}\n" "Your existing temporal database version: {ctdb}\n" - "Current temporal database info: {info}".format( - backup=backup_howto, - tdb=tgis_db_version, - ctdb=tgis_db_version_meta, - info=get_database_info_string(), - ) + "Current temporal database info: {info}" + ).format( + backup=backup_howto, + tdb=tgis_db_version, + ctdb=tgis_db_version_meta, + info=get_database_info_string(), ) if tgis_db_version_meta == 2 and tgis_db_version == 3: @@ -784,8 +784,8 @@ def init(raise_fatal_error=False, skip_db_version_check=False): msgr.fatal( _( "The format of your actual temporal database is " - "not supported any more. {m}".format(m=message) - ) + "not supported any more. {m}" + ).format(m=message) ) return @@ -862,7 +862,7 @@ def create_temporal_database(dbif): stvds_tables_sql = stds_tables_template_sql.replace("STDS", "stvds") str3ds_tables_sql = stds_tables_template_sql.replace("STDS", "str3ds") - msgr.message(_("Creating temporal database: %s" % (str(tgis_database_string)))) + msgr.message(_("Creating temporal database: %s") % (str(tgis_database_string))) if tgis_backend == "sqlite": # We need to create the sqlite3 database path if it does not exist @@ -875,8 +875,9 @@ def create_temporal_database(dbif): _( "Unable to create SQLite temporal database\n" "Exception: %s\nPlease use t.connect to set a " - "read- and writable temporal database path" % (e) + "read- and writable temporal database path" ) + % (e) ) # Set up the trigger that takes care of @@ -1502,7 +1503,7 @@ def execute(self, statement, args=None): except: if connected: self.close() - self.msgr.error(_("Unable to execute :\n %(sql)s" % {"sql": statement})) + self.msgr.error(_("Unable to execute :\n %(sql)s") % {"sql": statement}) raise if connected: @@ -1546,7 +1547,7 @@ def execute_transaction(self, statement, mapset=None): if connected: self.close() self.msgr.error( - _("Unable to execute transaction:\n %(sql)s" % {"sql": statement}) + _("Unable to execute transaction:\n %(sql)s") % {"sql": statement} ) raise diff --git a/python/grass/temporal/datetime_math.py b/python/grass/temporal/datetime_math.py index 9b680760775..1031582fe23 100644 --- a/python/grass/temporal/datetime_math.py +++ b/python/grass/temporal/datetime_math.py @@ -828,7 +828,7 @@ def check_datetime_string(time_string, use_dateutil=True): try: return datetime.strptime(time_string, time_format) except: - return _("Unable to parse time string: %s" % time_string) + return _("Unable to parse time string: %s") % time_string ############################################################################### diff --git a/python/grass/temporal/mapcalc.py b/python/grass/temporal/mapcalc.py index 5f29cd32747..8761e86160f 100644 --- a/python/grass/temporal/mapcalc.py +++ b/python/grass/temporal/mapcalc.py @@ -508,90 +508,72 @@ def _parse_start_operators(expr, is_time_absolute, current): if expr.find("start_year()") >= 0: if not is_time_absolute: msgr.fatal( - _( - "The temporal operators <%s> support only absolute " - "time." % ("start_*") - ) + _("The temporal operators <%s> support only absolute time.") + % ("start_*") ) expr = expr.replace("start_year()", str(start.year)) if expr.find("start_month()") >= 0: if not is_time_absolute: msgr.fatal( - _( - "The temporal operators <%s> support only absolute " - "time." % ("start_*") - ) + _("The temporal operators <%s> support only absolute time.") + % ("start_*") ) expr = expr.replace("start_month()", str(start.month)) if expr.find("start_week()") >= 0: if not is_time_absolute: msgr.fatal( - _( - "The temporal operators <%s> support only absolute " - "time." % ("start_*") - ) + _("The temporal operators <%s> support only absolute time.") + % ("start_*") ) expr = expr.replace("start_week()", str(start.isocalendar()[1])) if expr.find("start_day()") >= 0: if not is_time_absolute: msgr.fatal( - _( - "The temporal operators <%s> support only absolute " - "time." % ("start_*") - ) + _("The temporal operators <%s> support only absolute time.") + % ("start_*") ) expr = expr.replace("start_day()", str(start.day)) if expr.find("start_hour()") >= 0: if not is_time_absolute: msgr.fatal( - _( - "The temporal operators <%s> support only absolute " - "time." % ("start_*") - ) + _("The temporal operators <%s> support only absolute time.") + % ("start_*") ) expr = expr.replace("start_hour()", str(start.hour)) if expr.find("start_minute()") >= 0: if not is_time_absolute: msgr.fatal( - _( - "The temporal operators <%s> support only absolute " - "time." % ("start_*") - ) + _("The temporal operators <%s> support only absolute time.") + % ("start_*") ) expr = expr.replace("start_minute()", str(start.minute)) if expr.find("start_second()") >= 0: if not is_time_absolute: msgr.fatal( - _( - "The temporal operators <%s> support only absolute " - "time." % ("start_*") - ) + _("The temporal operators <%s> support only absolute time.") + % ("start_*") ) expr = expr.replace("start_second()", str(start.second)) if expr.find("start_dow()") >= 0: if not is_time_absolute: msgr.fatal( - _( - "The temporal operators <%s> support only absolute " - "time." % ("start_*") - ) + _("The temporal operators <%s> support only absolute time.") + % ("start_*") ) expr = expr.replace("start_dow()", str(start.isoweekday())) if expr.find("start_doy()") >= 0: if not is_time_absolute: msgr.fatal( - _( - "The temporal operators <%s> support only absolute " - "time." % ("start_*") - ) + _("The temporal operators <%s> support only absolute time.") + % ("start_*") ) year = datetime(start.year, 1, 1) delta = start - year @@ -628,10 +610,7 @@ def _parse_end_operators(expr, is_time_absolute, current): if expr.find("end_year()") >= 0: if not is_time_absolute: msgr.fatal( - _( - "The temporal operators <%s> support only absolute " - "time." % ("end_*") - ) + _("The temporal operators <%s> support only absolute time.") % ("end_*") ) if not end: expr = expr.replace("end_year()", "null()") @@ -641,10 +620,7 @@ def _parse_end_operators(expr, is_time_absolute, current): if expr.find("end_month()") >= 0: if not is_time_absolute: msgr.fatal( - _( - "The temporal operators <%s> support only absolute " - "time." % ("end_*") - ) + _("The temporal operators <%s> support only absolute time.") % ("end_*") ) if not end: expr = expr.replace("end_month()", "null()") @@ -654,10 +630,7 @@ def _parse_end_operators(expr, is_time_absolute, current): if expr.find("end_week()") >= 0: if not is_time_absolute: msgr.fatal( - _( - "The temporal operators <%s> support only absolute " - "time." % ("end_*") - ) + _("The temporal operators <%s> support only absolute time.") % ("end_*") ) if not end: expr = expr.replace("end_week()", "null()") @@ -667,10 +640,7 @@ def _parse_end_operators(expr, is_time_absolute, current): if expr.find("end_day()") >= 0: if not is_time_absolute: msgr.fatal( - _( - "The temporal operators <%s> support only absolute " - "time." % ("end_*") - ) + _("The temporal operators <%s> support only absolute time.") % ("end_*") ) if not end: expr = expr.replace("end_day()", "null()") @@ -680,10 +650,7 @@ def _parse_end_operators(expr, is_time_absolute, current): if expr.find("end_hour()") >= 0: if not is_time_absolute: msgr.fatal( - _( - "The temporal operators <%s> support only absolute " - "time." % ("end_*") - ) + _("The temporal operators <%s> support only absolute time.") % ("end_*") ) if not end: expr = expr.replace("end_hour()", "null()") @@ -693,10 +660,7 @@ def _parse_end_operators(expr, is_time_absolute, current): if expr.find("end_minute()") >= 0: if not is_time_absolute: msgr.fatal( - _( - "The temporal operators <%s> support only absolute " - "time." % ("end_*") - ) + _("The temporal operators <%s> support only absolute time.") % ("end_*") ) if not end: expr = expr.replace("end_minute()", "null()") @@ -706,10 +670,7 @@ def _parse_end_operators(expr, is_time_absolute, current): if expr.find("end_second()") >= 0: if not is_time_absolute: msgr.fatal( - _( - "The temporal operators <%s> support only absolute " - "time." % ("end_*") - ) + _("The temporal operators <%s> support only absolute time.") % ("end_*") ) if not end: expr = expr.replace("end_second()", "null()") @@ -719,10 +680,7 @@ def _parse_end_operators(expr, is_time_absolute, current): if expr.find("end_dow()") >= 0: if not is_time_absolute: msgr.fatal( - _( - "The temporal operators <%s> support only absolute " - "time." % ("end_*") - ) + _("The temporal operators <%s> support only absolute time.") % ("end_*") ) if not end: expr = expr.replace("end_dow()", "null()") @@ -732,10 +690,7 @@ def _parse_end_operators(expr, is_time_absolute, current): if expr.find("end_doy()") >= 0: if not is_time_absolute: msgr.fatal( - _( - "The temporal operators <%s> support only absolute " - "time." % ("end_*") - ) + _("The temporal operators <%s> support only absolute time.") % ("end_*") ) if not end: expr = expr.replace("end_doy()", "null()") diff --git a/python/grass/temporal/space_time_datasets.py b/python/grass/temporal/space_time_datasets.py index a73e03fff46..ec01bf45baa 100644 --- a/python/grass/temporal/space_time_datasets.py +++ b/python/grass/temporal/space_time_datasets.py @@ -288,10 +288,8 @@ def read_timestamp_from_grass(self): if check < 1: self.msgr.error( - _( - "Unable to read timestamp file " - "for raster map <%s>" % (self.get_map_id()) - ) + _("Unable to read timestamp file for raster map <%s>") + % (self.get_map_id()) ) return False @@ -316,19 +314,15 @@ def write_timestamp_to_grass(self): if check == -1: self.msgr.error( - _( - "Unable to create timestamp file " - "for raster map <%s>" % (self.get_map_id()) - ) + _("Unable to create timestamp file for raster map <%s>") + % (self.get_map_id()) ) return False if check == -2: self.msgr.error( - _( - "Invalid datetime in timestamp for raster map " - "<%s>" % (self.get_map_id()) - ) + _("Invalid datetime in timestamp for raster map <%s>") + % (self.get_map_id()) ) return False @@ -350,7 +344,7 @@ def remove_timestamp_from_grass(self): if check == -1: self.msgr.error( - _("Unable to remove timestamp for raster map <%s>" % (self.get_name())) + _("Unable to remove timestamp for raster map <%s>") % (self.get_name()) ) return False @@ -390,10 +384,8 @@ def write_semantic_label_to_grass(self): ) if check == -1: self.msgr.error( - _( - "Unable to write semantic label for raster map <%s>" - % (self.get_name()) - ) + _("Unable to write semantic label for raster map <%s>") + % (self.get_name()) ) return False @@ -741,10 +733,8 @@ def read_timestamp_from_grass(self): if check < 1: self.msgr.error( - _( - "Unable to read timestamp file " - "for 3D raster map <%s>" % (self.get_map_id()) - ) + _("Unable to read timestamp file for 3D raster map <%s>") + % (self.get_map_id()) ) return False @@ -769,19 +759,15 @@ def write_timestamp_to_grass(self): if check == -1: self.msgr.error( - _( - "Unable to create timestamp file " - "for 3D raster map <%s>" % (self.get_map_id()) - ) + _("Unable to create timestamp file for 3D raster map <%s>") + % (self.get_map_id()) ) return False if check == -2: self.msgr.error( - _( - "Invalid datetime in timestamp for 3D raster " - "map <%s>" % (self.get_map_id()) - ) + _("Invalid datetime in timestamp for 3D raster map <%s>") + % (self.get_map_id()) ) return False @@ -802,10 +788,7 @@ def remove_timestamp_from_grass(self): if check == -1: self.msgr.error( - _( - "Unable to remove timestamp for raster map " - "<%s>" % (self.get_name()) - ) + _("Unable to remove timestamp for raster map <%s>") % (self.get_name()) ) return False @@ -1091,10 +1074,8 @@ def read_timestamp_from_grass(self): if check < 1: self.msgr.error( - _( - "Unable to read timestamp file " - "for vector map <%s>" % (self.get_map_id()) - ) + _("Unable to read timestamp file for vector map <%s>") + % (self.get_map_id()) ) return False @@ -1120,19 +1101,15 @@ def write_timestamp_to_grass(self): if check == -1: self.msgr.error( - _( - "Unable to create timestamp file " - "for vector map <%s>" % (self.get_map_id()) - ) + _("Unable to create timestamp file for vector map <%s>") + % (self.get_map_id()) ) return False if check == -2: self.msgr.error( - _( - "Invalid datetime in timestamp for vector " - "map <%s>" % (self.get_map_id()) - ) + _("Invalid datetime in timestamp for vector map <%s>") + % (self.get_map_id()) ) return False @@ -1148,9 +1125,8 @@ def remove_timestamp_from_grass(self): if check == -1: self.msgr.error( - _( - "Unable to remove timestamp for vector " - "map <%s>" % (self.get_name()) + _("Unable to remove timestamp for vector map <%s>").format( + self.get_name() ) ) return False diff --git a/python/grass/temporal/stds_export.py b/python/grass/temporal/stds_export.py index 70dbdcada0f..ff2731b102a 100644 --- a/python/grass/temporal/stds_export.py +++ b/python/grass/temporal/stds_export.py @@ -127,7 +127,7 @@ def _export_raster_maps_as_gdal( except CalledModuleError: shutil.rmtree(new_cwd) tar.close() - gs.fatal(_("Unable to export raster map <%s>" % name)) + gs.fatal(_("Unable to export raster map <%s>") % name) tar.add(out_name) @@ -139,10 +139,7 @@ def _export_raster_maps_as_gdal( shutil.rmtree(new_cwd) tar.close() gs.fatal( - _( - "Unable to export color rules for raster " - "map <%s> r.out.gdal" % name - ) + _("Unable to export color rules for raster map <%s> r.out.gdal") % name ) tar.add(out_name) @@ -168,7 +165,7 @@ def _export_raster_maps(rows, tar, list_file, new_cwd, fs): except CalledModuleError: shutil.rmtree(new_cwd) tar.close() - gs.fatal(_("Unable to export raster map <%s> with r.pack" % name)) + gs.fatal(_("Unable to export raster map <%s> with r.pack") % name) tar.add(name + ".pack") @@ -201,7 +198,7 @@ def _export_vector_maps_as_gml(rows, tar, list_file, new_cwd, fs): except CalledModuleError: shutil.rmtree(new_cwd) tar.close() - gs.fatal(_("Unable to export vector map <%s> as GML with v.out.ogr" % name)) + gs.fatal(_("Unable to export vector map <%s> as GML with v.out.ogr") % name) tar.add(name + ".xml") tar.add(name + ".xsd") @@ -236,7 +233,7 @@ def _export_vector_maps_as_gpkg(rows, tar, list_file, new_cwd, fs): shutil.rmtree(new_cwd) tar.close() gs.fatal( - _("Unable to export vector map <%s> as GPKG with v.out.ogr" % name) + _("Unable to export vector map <%s> as GPKG with v.out.ogr") % name ) tar.add(name + ".gpkg") @@ -269,7 +266,7 @@ def _export_vector_maps(rows, tar, list_file, new_cwd, fs): except CalledModuleError: shutil.rmtree(new_cwd) tar.close() - gs.fatal(_("Unable to export vector map <%s> with v.pack" % name)) + gs.fatal(_("Unable to export vector map <%s> with v.pack") % name) tar.add(name + ".pack") @@ -295,7 +292,7 @@ def _export_raster3d_maps(rows, tar, list_file, new_cwd, fs): except CalledModuleError: shutil.rmtree(new_cwd) tar.close() - gs.fatal(_("Unable to export raster map <%s> with r3.pack" % name)) + gs.fatal(_("Unable to export raster map <%s> with r3.pack") % name) tar.add(name + ".pack") diff --git a/python/grass/temporal/stds_import.py b/python/grass/temporal/stds_import.py index 03810e49b89..ae587cadb0f 100644 --- a/python/grass/temporal/stds_import.py +++ b/python/grass/temporal/stds_import.py @@ -254,10 +254,8 @@ def import_stds( # Check for important files msgr = get_tgis_message_interface() msgr.message( - _( - "Checking validity of input file (size: %0.1f MB). Make take a while..." - % (os.path.getsize(input) / (1024 * 1024.0)) - ) + _("Checking validity of input file (size: %0.1f MB). Make take a while...") + % (os.path.getsize(input) / (1024 * 1024.0)) ) members = tar.getnames() # Make sure that the basenames of the files are used for comparison diff --git a/python/grass/temporal/temporal_algebra.py b/python/grass/temporal/temporal_algebra.py index 3736a15315a..1b9a126c635 100644 --- a/python/grass/temporal/temporal_algebra.py +++ b/python/grass/temporal/temporal_algebra.py @@ -1195,7 +1195,7 @@ def remove_maps(self): for key, value in map_names.items(): if value: - self.msgr.message(_("Removing un-needed or empty %s maps" % (key))) + self.msgr.message(_("Removing un-needed or empty %s maps") % (key)) self._remove_maps(value, key) def _remove_maps(self, namelist, map_type): @@ -2392,8 +2392,8 @@ def p_statement_assign(self, t): _( "The resulting space time dataset type <%(a)s> " "is different from the requested type <%(b)s>" - % ({"a": maps_stds_type, "b": self.stdstype}) ) + % ({"a": maps_stds_type, "b": self.stdstype}) ) else: map_type_2 = map_i.get_type() diff --git a/python/grass/temporal/temporal_raster_base_algebra.py b/python/grass/temporal/temporal_raster_base_algebra.py index 76517db30cc..3424110803f 100644 --- a/python/grass/temporal/temporal_raster_base_algebra.py +++ b/python/grass/temporal/temporal_raster_base_algebra.py @@ -873,7 +873,7 @@ def p_statement_assign(self, t): process_queue.put(m) else: - self.msgr.error(_("Error computing map <%s>" % map_i.get_id())) + self.msgr.error(_("Error computing map <%s>") % map_i.get_id()) count += 1 if self.dry_run is False: diff --git a/python/grass/temporal/univar_statistics.py b/python/grass/temporal/univar_statistics.py index 9bf29f74eba..96a9f65474d 100755 --- a/python/grass/temporal/univar_statistics.py +++ b/python/grass/temporal/univar_statistics.py @@ -65,12 +65,9 @@ def compute_univar_stats(registered_map_info, stats_module, fs, rast_region=Fals if not univar_stats: gs.warning( - _( - "Unable to get statistics for {voxel}raster map " - "<{rmap}>".format( - rmap=id, voxel="" if stats_module.name == "r.univar" else "3d " - ) - ) + _("Unable to get statistics for raster map <%s>") % id + if stats_module.name == "r.univar" + else _("Unable to get statistics for 3d raster map <%s>") % id ) return None eol = "" diff --git a/scripts/d.polar/d.polar.py b/scripts/d.polar/d.polar.py index f592dd89b63..915177e94d4 100755 --- a/scripts/d.polar/d.polar.py +++ b/scripts/d.polar/d.polar.py @@ -425,8 +425,8 @@ def main(): gcore.fatal( _( "EPS output file path <{}>, doesn't exists. " - "Set new output file path.".format(eps) - ) + "Set new output file path." + ).format(eps) ) else: eps = basename(eps, "eps") + ".eps" @@ -436,8 +436,8 @@ def main(): gcore.fatal( _( "option : <{}> exists. To overwrite, " - "use the --overwrite flag.".format(eps) - ) + "use the --overwrite flag." + ).format(eps) ) # check if we have xgraph (if no EPS output requested) diff --git a/scripts/g.extension.all/g.extension.all.py b/scripts/g.extension.all/g.extension.all.py index 026589cca10..7f0b36f4dc6 100644 --- a/scripts/g.extension.all/g.extension.all.py +++ b/scripts/g.extension.all/g.extension.all.py @@ -111,11 +111,11 @@ def download_modules_xml_file(url, response_format, *args, **kwargs): _( "Download file from <{url}>, " "return status code {code}, " - "{desc}".format( - url=url, - code=response.code, - desc=desc, - ), + "{desc}" + ).format( + url=url, + code=response.code, + desc=desc, ), ) if response_format not in response.getheader("Content-Type"): @@ -123,10 +123,10 @@ def download_modules_xml_file(url, response_format, *args, **kwargs): _( "Wrong file format downloaded. " "Check url <{url}>. Allowed file format is " - "{response_format}.".format( - url=url, - response_format=response_format, - ), + "{response_format}." + ).format( + url=url, + response_format=response_format, ), ) return response @@ -138,8 +138,8 @@ def download_modules_xml_file(url, response_format, *args, **kwargs): "The download of the modules.xml file " "from the server was not successful. " "File on the server <{url}> doesn't " - "exists.".format(url=url), - ), + "exists." + ).format(url=url), ) else: return download_modules_xml_file( @@ -148,11 +148,8 @@ def download_modules_xml_file(url, response_format, *args, **kwargs): ) except URLError: gs.fatal( - _( - "Download file from <{url}>, " - "failed. Check internet connection.".format( - url=url, - ), + _("Download file from <{url}>, failed. Check internet connection.").format( + url=url, ), ) @@ -199,9 +196,8 @@ def find_addon_name(addons): gs.warning( _( "The <{}> addon cannot be reinstalled. " - "Addon wasn't found among the official " - "addons.".format(addon) - ), + "Addon wasn't found among the official addons." + ).format(addon), ) return set(result) diff --git a/scripts/g.extension/g.extension.py b/scripts/g.extension/g.extension.py index 3b0c15c0bfc..bf8cd183135 100644 --- a/scripts/g.extension/g.extension.py +++ b/scripts/g.extension/g.extension.py @@ -541,10 +541,8 @@ def get_default_branch(full_url): organization, repository = url_parts.path.split("/")[1:3] except URLError: gs.fatal( - _( - "Cannot retrieve organization and repository from URL: <{}>.".format( - full_url - ) + _("Cannot retrieve organization and repository from URL: <{}>.").format( + full_url ) ) # Construct API call and retrieve default branch @@ -583,10 +581,8 @@ def etree_fromurl(url): _( "Download file from <{url}>," " failed. File is not on the server or" - " check your internet connection.".format( - url=url, - ), - ), + " check your internet connection." + ).format(url=url), ) return ET.fromstring(file_.read()) diff --git a/scripts/i.oif/i.oif.py b/scripts/i.oif/i.oif.py index cfee7890120..aea65197954 100755 --- a/scripts/i.oif/i.oif.py +++ b/scripts/i.oif/i.oif.py @@ -47,7 +47,7 @@ def oifcalc(sdev, corr, k1, k2, k3): - grass.debug(_("Calculating OIF for combination: %s, %s, %s" % (k1, k2, k3)), 1) + grass.debug(_("Calculating OIF for combination: %s, %s, %s") % (k1, k2, k3), 1) # calculate SUM of Stddeviations: ssdev = [sdev[k1], sdev[k2], sdev[k3]] numer = sum(ssdev) diff --git a/scripts/i.pansharpen/i.pansharpen.py b/scripts/i.pansharpen/i.pansharpen.py index f344c5ac7fd..c62a53a536a 100755 --- a/scripts/i.pansharpen/i.pansharpen.py +++ b/scripts/i.pansharpen/i.pansharpen.py @@ -402,7 +402,7 @@ def main(): gs.run_command("g.region", res=panres, align=pan) # Select sharpening method - gs.message(_("Performing pan sharpening with hi res pan image: %f" % panres)) + gs.message(_("Performing pan sharpening with hi res pan image: %f") % panres) if sharpen == "brovey": brovey(pan, ms1, ms2, ms3, out, pid, sproc) elif sharpen == "ihs": @@ -437,8 +437,8 @@ def main(): for ch in ["red", "green", "blue"]: gs.verbose(_("%s_%s") % (out, ch)) - gs.verbose(_("To visualize output, run: g.region -p raster=%s_red" % out)) - gs.verbose(_("d.rgb r=%s_red g=%s_green b=%s_blue" % (out, out, out))) + gs.verbose(_("To visualize output, run: g.region -p raster=%s_red") % out) + gs.verbose(_("d.rgb r=%s_red g=%s_green b=%s_blue") % (out, out, out)) gs.verbose( _("If desired, combine channels into a single RGB map with 'r.composite'.") ) diff --git a/scripts/i.spectral/i.spectral.py b/scripts/i.spectral/i.spectral.py index d40c1076169..171eac7359c 100755 --- a/scripts/i.spectral/i.spectral.py +++ b/scripts/i.spectral/i.spectral.py @@ -197,8 +197,8 @@ def draw_linegraph(what): gcore.fatal( _( "Supported monitor isn't running. Please launch one of the" - " monitors {}.".format(", ".join(supported_monitors)) - ) + " monitors {}." + ).format(", ".join(supported_monitors)) ) selected_monitor = gcore.read_command("d.mon", flags="p", quiet=True).replace( "\n", "" @@ -207,17 +207,15 @@ def draw_linegraph(what): gcore.fatal( _( "Supported monitor isn't selected. Please select one of the" - " monitors {}.".format(", ".join(supported_monitors)) - ) + " monitors {}." + ).format(", ".join(supported_monitors)) ) with open(gcore.parse_command("d.mon", flags="g", quiet=True)["env"]) as f: for line in f: if "GRASS_RENDER_FILE=" in line: gcore.info( - _( - "{} monitor is used, output file {}".format( - selected_monitor.capitalize(), line.split("=")[-1] - ) + _("{} monitor is used, output file {}").format( + selected_monitor.capitalize(), line.split("=")[-1] ) ) break diff --git a/scripts/r.in.wms/wms_base.py b/scripts/r.in.wms/wms_base.py index a14e15dc786..234456f1518 100644 --- a/scripts/r.in.wms/wms_base.py +++ b/scripts/r.in.wms/wms_base.py @@ -78,10 +78,8 @@ def _initializeParameters(self, options, flags): self.params["password"] == "" and self.params["username"] ): gs.fatal( - _( - "Please insert both %s and %s parameters or none of them." - % ("password", "username") - ) + _("Please insert both %s and %s parameters or none of them.") + % ("password", "username") ) self.params["bgcolor"] = options["bgcolor"].strip() @@ -202,8 +200,8 @@ def _checkIgnoeredParams(self, options, flags, driver_props): _( "These parameter are ignored: %s\n\ %s driver does not support the parameters." - % (",".join(not_relevant_params), options["driver"]) ) + % (",".join(not_relevant_params), options["driver"]) ) not_relevant_flags = [] @@ -216,8 +214,8 @@ def _checkIgnoeredParams(self, options, flags, driver_props): _( "These flags are ignored: %s\n\ %s driver does not support the flags." - % (",".join(not_relevant_flags), options["driver"]) ) + % (",".join(not_relevant_flags), options["driver"]) ) def GetMap(self, options, flags): @@ -308,7 +306,7 @@ def GetCapabilities(self, options): Path(capfile_output).write_text(cap) return except OSError as error: - gs.fatal(_("Unable to open file '%s'.\n%s\n" % (capfile_output, error))) + gs.fatal(_("Unable to open file '%s'.\n%s\n") % (capfile_output, error)) # print to output print(cap) diff --git a/scripts/r.in.wms/wms_cap_parsers.py b/scripts/r.in.wms/wms_cap_parsers.py index 5483be0979f..56b1d0ce48c 100644 --- a/scripts/r.in.wms/wms_cap_parsers.py +++ b/scripts/r.in.wms/wms_cap_parsers.py @@ -45,7 +45,7 @@ def __init__(self, cap_file): raise ParseError(_("Unable to parse XML file")) except OSError as error: raise ParseError( - _("Unable to open XML file '%s'.\n%s\n" % (cap_file, error)) + _("Unable to open XML file '%s'.\n%s\n") % (cap_file, error) ) else: try: diff --git a/scripts/r.in.wms/wms_drv.py b/scripts/r.in.wms/wms_drv.py index 1e7a90e9938..186157ad6db 100644 --- a/scripts/r.in.wms/wms_drv.py +++ b/scripts/r.in.wms/wms_drv.py @@ -286,7 +286,7 @@ def _pct2rgb(self, src_filename, dst_filename): # open source file src_ds = gdal.Open(src_filename) if src_ds is None: - gs.fatal(_("Unable to open %s " % src_filename)) + gs.fatal(_("Unable to open %s ") % src_filename) src_band = src_ds.GetRasterBand(band_number) diff --git a/scripts/r.in.wms/wms_gdal_drv.py b/scripts/r.in.wms/wms_gdal_drv.py index d17bac11eee..69a49ca5429 100644 --- a/scripts/r.in.wms/wms_gdal_drv.py +++ b/scripts/r.in.wms/wms_gdal_drv.py @@ -172,7 +172,7 @@ def _download(self): driver = gdal.GetDriverByName(self.gdal_drv_format) if driver is None: - gs.fatal(_("Unable to find %s driver" % format)) + gs.fatal(_("Unable to find %s driver") % self.gdal_drv_format) metadata = driver.GetMetadata() if ( diff --git a/scripts/r.pack/r.pack.py b/scripts/r.pack/r.pack.py index cd7d6c39282..eb11547322c 100644 --- a/scripts/r.pack/r.pack.py +++ b/scripts/r.pack/r.pack.py @@ -180,7 +180,7 @@ def main(): os.chdir(olddir) - grass.verbose(_("Raster map saved to '%s'" % outfile)) + grass.verbose(_("Raster map saved to '%s'") % outfile) if __name__ == "__main__": diff --git a/scripts/r.tileset/r.tileset.py b/scripts/r.tileset/r.tileset.py index f5e7ab17b13..c3fba2c173e 100644 --- a/scripts/r.tileset/r.tileset.py +++ b/scripts/r.tileset/r.tileset.py @@ -246,16 +246,16 @@ def main(): _( "It is not possible to set 'maxcols=%s' and " "'overlap=%s'. Please set maxcols>overlap" - % (options["maxcols"], options["overlap"]) ) + % (options["maxcols"], options["overlap"]) ) elif max_rows == 0: gcore.fatal( _( "It is not possible to set 'maxrows=%s' and " "'overlap=%s'. Please set maxrows>overlap" - % (options["maxrows"], options["overlap"]) ) + % (options["maxrows"], options["overlap"]) ) # destination projection if not options["destproj"]: @@ -397,7 +397,7 @@ def main(): if errors_dest > 0: gcore.warning( - _("During computation %i tiles could not be created" % errors_dest) + _("During computation %i tiles could not be created") % errors_dest ) while xi < ximax: diff --git a/scripts/r.unpack/r.unpack.py b/scripts/r.unpack/r.unpack.py index 053ac96988b..575d465ebb5 100644 --- a/scripts/r.unpack/r.unpack.py +++ b/scripts/r.unpack/r.unpack.py @@ -63,7 +63,7 @@ def main(): grass.debug("tmp_dir = {tmpdir}".format(tmpdir=tmp_dir)) if not os.path.exists(infile): - grass.fatal(_("File {name} not found.".format(name=infile))) + grass.fatal(_("File {name} not found.").format(name=infile)) gisenv = grass.gisenv() mset_dir = os.path.join( @@ -87,7 +87,7 @@ def main(): f = tar.extractfile("{}/{}".format(data_names[0], fname)) sys.stdout.write(f.read().decode()) except KeyError: - grass.fatal(_("Pack file unreadable: file '{}' missing".format(fname))) + grass.fatal(_("Pack file unreadable: file '{}' missing").format(fname)) tar.close() return 0 @@ -100,13 +100,11 @@ def main(): gfile = grass.find_file(name=map_name, element="cell", mapset=".") if gfile["file"]: if os.environ.get("GRASS_OVERWRITE", "0") != "1": - grass.fatal(_("Raster map <{name}> already exists".format(name=map_name))) + grass.fatal(_("Raster map <{name}> already exists").format(name=map_name)) else: grass.warning( - _( - "Raster map <{name}> already exists and will be overwritten".format( - name=map_name - ) + _("Raster map <{name}> already exists and will be overwritten").format( + name=map_name ) ) @@ -132,9 +130,10 @@ def main(): grass.fatal( _( "This GRASS GIS pack file contains vector data. Use " - "v.unpack to unpack <{name}>".format(name=map_name) - ) + "v.unpack to unpack <{name}>" + ).format(name=map_name) ) + else: grass.fatal(_("Pack file unreadable")) @@ -246,7 +245,7 @@ def main(): files = "\n".join(maps) Path(vrt_file).write_text(files) - grass.message(_("Raster map <{name}> unpacked".format(name=map_name))) + grass.message(_("Raster map <{name}> unpacked").format(name=map_name)) if __name__ == "__main__": diff --git a/scripts/v.rast.stats/v.rast.stats.py b/scripts/v.rast.stats/v.rast.stats.py index 1e1451f6b84..803fc8691ad 100644 --- a/scripts/v.rast.stats/v.rast.stats.py +++ b/scripts/v.rast.stats/v.rast.stats.py @@ -143,10 +143,8 @@ def main(): gs.fatal( _( "Number of raster maps ({0}) different from \ - number of column prefixes ({1})".format( - len(rasters), len(colprefixes) - ) - ) + number of column prefixes ({1})" + ).format(len(rasters), len(colprefixes)) ) vector = vs[0] @@ -340,10 +338,8 @@ def get_nr_of_categories( gs.warning( _( "Not all vector categories converted to raster. \ - Converted {0} of {1}.".format( - number, vect_cats_n - ) - ) + Converted {0} of {1}." + ).format(number, vect_cats_n) ) return number diff --git a/scripts/v.to.lines/v.to.lines.py b/scripts/v.to.lines/v.to.lines.py index bfcb2e45bc2..0630ad86401 100644 --- a/scripts/v.to.lines/v.to.lines.py +++ b/scripts/v.to.lines/v.to.lines.py @@ -189,7 +189,7 @@ def main(): gs.fatal(_("Error removing table from layer 1")) # TODO: when this except is happaning, it seems that never, so it seems wrong except Exception: - gs.warning(_("No table for layer %d" % 1)) + gs.warning(_("No table for layer %d") % 1) try: gs.run_command( "v.category", diff --git a/scripts/v.unpack/v.unpack.py b/scripts/v.unpack/v.unpack.py index 0507e9eb400..419e133b195 100644 --- a/scripts/v.unpack/v.unpack.py +++ b/scripts/v.unpack/v.unpack.py @@ -87,7 +87,7 @@ def main(): f = tar.extractfile(fname) sys.stdout.write(f.read().decode()) except KeyError: - grass.fatal(_("Pack file unreadable: file '{}' missing".format(fname))) + grass.fatal(_("Pack file unreadable: file '{}' missing").format(fname)) tar.close() return 0 @@ -139,8 +139,9 @@ def main(): grass.fatal( _( "This GRASS GIS pack file contains raster data. Use " - "r.unpack to unpack <%s>" % map_name + "r.unpack to unpack <%s>" ) + % map_name ) else: grass.fatal(_("Pack file unreadable")) diff --git a/scripts/v.what.strds/v.what.strds.py b/scripts/v.what.strds/v.what.strds.py index 2bd6cd72131..0e1bf893f98 100644 --- a/scripts/v.what.strds/v.what.strds.py +++ b/scripts/v.what.strds/v.what.strds.py @@ -169,13 +169,13 @@ def main(): "datasets must be equal\n<%(a)s> of type " "%(type_a)s do not match <%(b)s> of type " "%(type_b)s" - % { - "a": first_strds.get_id(), - "type_a": first_strds.get_temporal_type(), - "b": dataset.get_id(), - "type_b": dataset.get_temporal_type(), - } ) + % { + "a": first_strds.get_id(), + "type_a": first_strds.get_temporal_type(), + "b": dataset.get_id(), + "type_b": dataset.get_temporal_type(), + } ) mapmatrizes = tgis.sample_stds_by_stds_topology( @@ -227,7 +227,7 @@ def main(): pymap.open("r") except: dbif.close() - gs.fatal(_("Unable to create vector map <%s>" % output)) + gs.fatal(_("Unable to create vector map <%s>") % output) if len(pymap.dblinks) == 0: try: @@ -235,7 +235,7 @@ def main(): gs.run_command("v.db.addtable", map=output) except CalledModuleError: dbif.close() - gs.fatal(_("Unable to add table <%s> to vector map <%s>" % output)) + gs.fatal(_("Unable to add table <%s> to vector map <%s>") % output) if pymap.is_open(): pymap.close() diff --git a/temporal/t.rast.accdetect/t.rast.accdetect.py b/temporal/t.rast.accdetect/t.rast.accdetect.py index 887616f7a1c..1588b44d4b9 100644 --- a/temporal/t.rast.accdetect/t.rast.accdetect.py +++ b/temporal/t.rast.accdetect/t.rast.accdetect.py @@ -341,7 +341,7 @@ def main(): if len(input_maps) == 0: continue - gs.message(_("Processing cycle %s - %s" % (str(start), str(end)))) + gs.message(_("Processing cycle %s - %s") % (str(start), str(end))) count = compute_occurrence( occurrence_maps, diff --git a/temporal/t.rast.accumulate/t.rast.accumulate.py b/temporal/t.rast.accumulate/t.rast.accumulate.py index 94344f2d9cc..6fe067e02bc 100644 --- a/temporal/t.rast.accumulate/t.rast.accumulate.py +++ b/temporal/t.rast.accumulate/t.rast.accumulate.py @@ -323,7 +323,7 @@ def main(): where = "start_time >= '%s' AND start_time < '%s'" % (str(start), str(end)) input_maps = input_strds.get_registered_maps_as_objects(where=where, dbif=dbif) - gs.message(_("Processing cycle %s - %s" % (str(start), str(end)))) + gs.message(_("Processing cycle %s - %s") % (str(start), str(end))) if len(input_maps) == 0: continue diff --git a/temporal/t.rast.export/t.rast.export.py b/temporal/t.rast.export/t.rast.export.py index 675040bf5aa..fdf19541ee4 100755 --- a/temporal/t.rast.export/t.rast.export.py +++ b/temporal/t.rast.export/t.rast.export.py @@ -127,10 +127,10 @@ def main(): } if not directory or not os.path.exists(directory): - gs.fatal(_("Directory {} not found".format(directory))) + gs.fatal(_("Directory {} not found").format(directory)) if not os.access(directory, os.W_OK): - gs.fatal(_("Directory {} is not writable".format(directory))) + gs.fatal(_("Directory {} is not writable").format(directory)) if _type and _format in {"pack", "AAIGrid"}: gs.warning( diff --git a/temporal/t.rast.gapfill/t.rast.gapfill.py b/temporal/t.rast.gapfill/t.rast.gapfill.py index e2ffb149513..84395da6295 100755 --- a/temporal/t.rast.gapfill/t.rast.gapfill.py +++ b/temporal/t.rast.gapfill/t.rast.gapfill.py @@ -208,8 +208,9 @@ def main(): gs.fatal( _( "Map with name <%s> already exists. " - "Please use another base name." % (_id) + "Please use another base name." ) + % (_id) ) elif new_map.is_in_db(dbif): overwrite_flags[new_id] = True diff --git a/temporal/t.rast.list/t.rast.list.py b/temporal/t.rast.list/t.rast.list.py index 651bc69b956..0209d0aeee6 100755 --- a/temporal/t.rast.list/t.rast.list.py +++ b/temporal/t.rast.list/t.rast.list.py @@ -108,7 +108,13 @@ def message_option_value_excludes_option_value( return _( "Combining {option_name}={option_value} and " "{excluded_option_name}={excluded_option_value} is not allowed. {reason}" - ).format(**locals()) + ).format( + option_name=option_name, + option_value=option_value, + excluded_option_name=excluded_option_name, + excluded_option_value=excluded_option_value, + reason=reason, + ) def message_option_value_excludes_option( @@ -117,13 +123,23 @@ def message_option_value_excludes_option( return _( "The option {excluded_option_name} is not allowed with " "{option_name}={option_value}. {reason}" - ).format(**locals()) + ).format( + excluded_option_name=excluded_option_name, + option_name=option_name, + option_value=option_value, + reason=reason, + ) def message_option_value_excludes_flag(option_name, option_value, flag_name, reason): return _( "The flag -{flag_name} is not allowed with {option_name}={option_value}." - " {reason}".format(**locals()) + " {reason}" + ).format( + flag_name=flag_name, + option_name=option_name, + option_value=option_value, + reason=reason, ) diff --git a/temporal/t.rast.out.vtk/t.rast.out.vtk.py b/temporal/t.rast.out.vtk/t.rast.out.vtk.py index a042168499a..876770e4c4e 100755 --- a/temporal/t.rast.out.vtk/t.rast.out.vtk.py +++ b/temporal/t.rast.out.vtk/t.rast.out.vtk.py @@ -160,7 +160,7 @@ def main(): overwrite=gs.overwrite(), ) except CalledModuleError: - gs.fatal(_("Unable to export raster map <%s>" % map_name)) + gs.fatal(_("Unable to export raster map <%s>") % map_name) count += 1 diff --git a/temporal/t.rast.series/t.rast.series.py b/temporal/t.rast.series/t.rast.series.py index 074f35a00a0..57907f463e4 100755 --- a/temporal/t.rast.series/t.rast.series.py +++ b/temporal/t.rast.series/t.rast.series.py @@ -149,8 +149,8 @@ def main(): gs.warning( _( "Processing over {} maps: activating -z flag of r.series which " - "slows down processing.".format(max_files_open) - ) + "slows down processing." + ).format(max_files_open) ) flag += "z" if nulls: diff --git a/temporal/t.rast.to.rast3/t.rast.to.rast3.py b/temporal/t.rast.to.rast3/t.rast.to.rast3.py index e3bdd9567ad..7776d7426ee 100755 --- a/temporal/t.rast.to.rast3/t.rast.to.rast3.py +++ b/temporal/t.rast.to.rast3/t.rast.to.rast3.py @@ -162,7 +162,7 @@ def main(): overwrite=gs.overwrite(), ) except CalledModuleError: - gs.fatal(_("Unable to create 3D raster map <%s>" % output)) + gs.fatal(_("Unable to create 3D raster map <%s>") % output) gs.run_command("g.remove", flags="f", type="raster", name=null_map) diff --git a/temporal/t.rast.what/t.rast.what.py b/temporal/t.rast.what/t.rast.what.py index 6a4efbb2b94..39e63180abf 100755 --- a/temporal/t.rast.what/t.rast.what.py +++ b/temporal/t.rast.what/t.rast.what.py @@ -387,7 +387,7 @@ def one_point_per_row_output( for count in range(len(output_files)): file_name = output_files[count] - gs.verbose(_("Transforming r.what output file %s" % (file_name))) + gs.verbose(_("Transforming r.what output file %s") % (file_name)) map_list = output_time_list[count] in_file = open(file_name, "r") for line in in_file: @@ -465,7 +465,7 @@ def one_point_per_col_output( first = True for count in range(len(output_files)): file_name = output_files[count] - gs.verbose(_("Transforming r.what output file %s" % (file_name))) + gs.verbose(_("Transforming r.what output file %s") % (file_name)) in_file = open(file_name, "r") lines = in_file.readlines() @@ -607,7 +607,7 @@ def one_point_per_timerow_output( if write_header: out_file.write(header + "\n") - gs.verbose(_("Writing the output file <%s>" % (output))) + gs.verbose(_("Writing the output file <%s>") % (output)) for row in matrix: first = True for col in row: @@ -663,15 +663,13 @@ def process_loop( output_time_list.append(map_list) gs.verbose( - _( - "Process maps %(samp_start)i to %(samp_end)i (of %(total)i)" - % ( - { - "samp_start": count - len(map_names) + 1, - "samp_end": count, - "total": len(maps), - } - ) + _("Process maps %(samp_start)i to %(samp_end)i (of %(total)i)") + % ( + { + "samp_start": count - len(map_names) + 1, + "samp_end": count, + "total": len(maps), + } ) ) mod = copy.deepcopy(r_what) diff --git a/temporal/t.remove/t.remove.py b/temporal/t.remove/t.remove.py index fd32f8972d5..b5c1164cef4 100755 --- a/temporal/t.remove/t.remove.py +++ b/temporal/t.remove/t.remove.py @@ -127,22 +127,25 @@ def main(): sp = tgis.open_old_stds(name, type, dbif) if not force: gs.message( - _("{stds}: {gid}".format(stds=sp.get_type().upper(), gid=sp.get_id())) + _("{stds}: {gid}").format(stds=sp.get_type().upper(), gid=sp.get_id()) ) if recursive or clean: if not force: if recursive: - msg = ( + msg = _( "The following maps of {stds} {gid} will be " "unregistered from temporal database:" ) elif clean: - msg = ( + msg = _( "The following maps of {stds} {gid} will be " "unregistered from temporal database and removed " "from spatial database:" ) - gs.message(_(msg.format(stds=sp.get_type(), gid=sp.get_id()))) + + if recursive or clean: + gs.message(msg.format(stds=sp.get_type(), gid=sp.get_id())) + maps = sp.get_registered_maps_as_objects(dbif=dbif) map_statement = "" count = 1 @@ -150,10 +153,10 @@ def main(): for map in maps: map.select(dbif) # We may have multiple layer for a single map, hence we need - # to avoid multiple deletation of the same map, + # to avoid multiple deletions of the same map, # but the database entries are still present and must be removed if not force: - gs.message(_("- %s" % map.get_name())) + gs.message(_("- %s") % map.get_name()) continue if clean and force: if map.get_name() not in name_list: @@ -190,8 +193,8 @@ def main(): gs.message( _( "Nothing removed. You must use the force flag (-{flag}) to actually " - "remove them.".format(flag="f") - ) + "remove them." + ).format(flag="f") ) else: # Execute the collected SQL statenents diff --git a/temporal/t.unregister/t.unregister.py b/temporal/t.unregister/t.unregister.py index e7e234320c0..7aef44ed12b 100755 --- a/temporal/t.unregister/t.unregister.py +++ b/temporal/t.unregister/t.unregister.py @@ -154,10 +154,8 @@ def main(): statement += map.delete(dbif=dbif, update=False, execute=False) else: gs.warning( - _( - "Unable to find %s map <%s> in temporal database" - % (map.get_type(), map.get_id()) - ) + _("Unable to find %s map <%s> in temporal database") + % (map.get_type(), map.get_id()) ) count += 1 @@ -170,7 +168,7 @@ def main(): # Update space time datasets if input: - gs.message(_("Unregister maps from space time dataset <%s>" % (input))) + gs.message(_("Unregister maps from space time dataset <%s>") % (input)) else: gs.message(_("Unregister maps from the temporal database")) diff --git a/temporal/t.vect.observe.strds/t.vect.observe.strds.py b/temporal/t.vect.observe.strds/t.vect.observe.strds.py index 8b3850fb2ef..9c60a3d026c 100755 --- a/temporal/t.vect.observe.strds/t.vect.observe.strds.py +++ b/temporal/t.vect.observe.strds/t.vect.observe.strds.py @@ -152,13 +152,13 @@ def main(): "Temporal type of space time raster datasets must be equal\n" "<%(a)s> of type %(type_a)s do not match <%(b)s> of type " "%(type_b)s" - % { - "a": first_strds.get_id(), - "type_a": first_strds.get_temporal_type(), - "b": dataset.get_id(), - "type_b": dataset.get_temporal_type(), - } ) + % { + "a": first_strds.get_id(), + "type_a": first_strds.get_temporal_type(), + "b": dataset.get_id(), + "type_b": dataset.get_temporal_type(), + } ) mapmatrizes = tgis.sample_stds_by_stds_topology( diff --git a/utils/mkhtml.py b/utils/mkhtml.py index 210e83b3fd6..d36ea78663d 100644 --- a/utils/mkhtml.py +++ b/utils/mkhtml.py @@ -164,12 +164,11 @@ def download_git_commit(url, response_format, *args, **kwargs): desc = HTTP_STATUS_CODES[index].description gs.fatal( _( - "Download commit from <{url}>, return status code " - "{code}, {desc}".format( - url=url, - code=response.code, - desc=desc, - ), + "Download commit from <{url}>, return status code {code}, {desc}" + ).format( + url=url, + code=response.code, + desc=desc, ), ) if response_format not in response.getheader("Content-Type"): @@ -177,10 +176,10 @@ def download_git_commit(url, response_format, *args, **kwargs): _( "Wrong downloaded commit file format. " "Check url <{url}>. Allowed file format is " - "{response_format}.".format( - url=url, - response_format=response_format, - ), + "{response_format}." + ).format( + url=url, + response_format=response_format, ), ) return response @@ -190,16 +189,16 @@ def download_git_commit(url, response_format, *args, **kwargs): "The download of the commit from the GitHub API " "server wasn't successful, <{}>. Commit and commit " "date will not be included in the <{}> addon html manual " - "page.".format(err.msg, pgm) - ), + "page." + ).format(err.msg, pgm), ) except URLError: gs.warning( _( "Download file from <{url}>, failed. Check internet " "connection. Commit and commit date will not be included " - "in the <{pgm}> addon manual page.".format(url=url, pgm=pgm) - ), + "in the <{pgm}> addon manual page." + ).format(url=url, pgm=pgm), )