Skip to content

Commit

Permalink
style: Fix single-line-implicit-string-concatenation violations (ISC0…
Browse files Browse the repository at this point in the history
…01) (OSGeo#3943)

* style: Fix single-line-implicit-string-concatenation violations (ISC001)

Only applies safe fixes with `ruff check --select "ISC001" --fix` in order to limit the review scope.

* style: Apply black formatting

Separated in another commit for easier review of the changes of the first commit
  • Loading branch information
echoix authored and a0x8o committed Jul 2, 2024
1 parent 962f525 commit fb2b1e4
Show file tree
Hide file tree
Showing 109 changed files with 262 additions and 314 deletions.
8 changes: 4 additions & 4 deletions gui/wxpython/animation/dialogs.py
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,7 @@ def _create3DPanel(self, parent):
id=wx.ID_ANY,
size=globalvar.DIALOG_GSELECT_SIZE,
labelText=_("Workspace file:"),
dialogTitle=_("Choose workspace file to " "import 3D view parameters"),
dialogTitle=_("Choose workspace file to import 3D view parameters"),
buttonText=_("Browse"),
startDirectory=os.getcwd(),
fileMode=0,
Expand Down Expand Up @@ -550,7 +550,7 @@ def _createAdvancedPage(self, parent):
)
self.zoomRadio = RadioButton(panel, label=_("Zoom value:"))
self.zoomRadio.SetToolTip(
_("N-S/E-W distances in map units used to " "gradually reduce region.")
_("N-S/E-W distances in map units used to gradually reduce region.")
)
gridSizer.Add(self.zoomRadio, pos=(3, 0), border=10, flag=wx.EXPAND | wx.LEFT)

Expand Down Expand Up @@ -678,7 +678,7 @@ def GetOptData(self, dcmd, layer, params, propwin):
def _update(self):
if self.nDChoice.GetSelection() == 1 and len(self._layerList) > 1:
raise GException(
_("Only one series or space-time " "dataset is accepted for 3D mode.")
_("Only one series or space-time dataset is accepted for 3D mode.")
)
hasSeries = False
for layer in self._layerList:
Expand Down Expand Up @@ -1541,7 +1541,7 @@ def _export_file_validation(self, filebrowsebtn, file_path, file_postfix):
"""

file_path_does_not_exist_err_message = _(
"Exported file directory '{base_dir}' " "does not exist."
"Exported file directory '{base_dir}' does not exist."
)
if not file_path:
GError(parent=self, message=_("Export file is missing."))
Expand Down
4 changes: 1 addition & 3 deletions gui/wxpython/animation/temporal_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -618,9 +618,7 @@ def createRelativePoint():

n1 = grass.read_command("g.tempfile", pid=1, flags="d").strip()
fd = open(n1, "w")
fd.write(
"prec_1|1\n" "prec_2|3\n" "prec_3|5\n" "prec_4|7\n" "prec_5|11\n" "prec_6|13\n"
)
fd.write("prec_1|1\nprec_2|3\nprec_3|5\nprec_4|7\nprec_5|11\nprec_6|13\n")
fd.close()
name = "relpoint"
grass.run_command(
Expand Down
2 changes: 1 addition & 1 deletion gui/wxpython/animation/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ def checkSeriesCompatibility(mapSeriesList=None, timeseriesList=None):

if len(timeseriesInfo["count"]) > 1:
raise GException(
_("The number of maps in space-time datasets " "has to be the same.")
_("The number of maps in space-time datasets has to be the same.")
)

if len(timeseriesInfo["temporalType"]) > 1:
Expand Down
2 changes: 1 addition & 1 deletion gui/wxpython/core/globalvar.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ def CheckForWx():
except ImportError as e:
print("ERROR: wxGUI requires wxPython. {}".format(e), file=sys.stderr)
print(
"You can still use GRASS GIS modules in" " the command line or in Python.",
"You can still use GRASS GIS modules in the command line or in Python.",
file=sys.stderr,
)
sys.exit(1)
Expand Down
2 changes: 1 addition & 1 deletion gui/wxpython/core/render.py
Original file line number Diff line number Diff line change
Expand Up @@ -869,7 +869,7 @@ def _projInfo(self):
projinfo = {}
if not grass.find_program("g.proj", "--help"):
sys.exit(
_("GRASS tool '%s' not found. Unable to start map " "display window.")
_("GRASS tool '%s' not found. Unable to start map display window.")
% "g.proj"
)
env = os.environ.copy()
Expand Down
2 changes: 1 addition & 1 deletion gui/wxpython/core/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -892,7 +892,7 @@ def StoreEnvVariable(key, value=None, envFile=None):
k, v = map(lambda x: x.strip(), line.split(" ", 1)[1].split("=", 1))
except Exception as e:
sys.stderr.write(
_("%s: line skipped - unable to parse '%s'\n" "Reason: %s\n")
_("%s: line skipped - unable to parse '%s'\nReason: %s\n")
% (envFile, line, e)
)
lineSkipped.append(line)
Expand Down
11 changes: 4 additions & 7 deletions gui/wxpython/dbmgr/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -1059,9 +1059,7 @@ def AddColumn(self, name, ctype, length):
if not name:
GError(
parent=self,
message=_(
"Unable to add column to the table. " "No column name defined."
),
message=_("Unable to add column to the table. No column name defined."),
)
return False

Expand Down Expand Up @@ -1667,8 +1665,7 @@ def OnDataItemAdd(self, event):
if len(values[i]) == 0: # NULL
if columnName[i] == keyColumn:
raise ValueError(
_("Category number (column %s)" " is missing.")
% keyColumn
_("Category number (column %s) is missing.") % keyColumn
)
else:
continue
Expand Down Expand Up @@ -2604,7 +2601,7 @@ def OnTableItemChange(self, event):
if not name or not nameTo:
GError(
parent=self,
message=_("Unable to rename column. " "No column name defined."),
message=_("Unable to rename column. No column name defined."),
)
return
else:
Expand Down Expand Up @@ -3272,7 +3269,7 @@ def _createAddPage(self):

# tooltips
self.addLayerWidgets["addCat"][0].SetToolTip(
_("You need to add categories " "by v.category module.")
_("You need to add categories by v.category module.")
)

# table description
Expand Down
8 changes: 4 additions & 4 deletions gui/wxpython/gcp/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -508,7 +508,7 @@ def OnMapset(self, event):
"""Sets source mapset for map(s) to georectify"""
if self.xylocation == "":
GMessage(
_("You must select a valid location " "before selecting a mapset"),
_("You must select a valid location before selecting a mapset"),
parent=self,
)
return
Expand Down Expand Up @@ -695,15 +695,15 @@ def OnExtension(self, event):
def OnPageChanging(self, event=None):
if event.GetDirection() and self.xygroup == "":
GMessage(
_("You must select a valid image/map " "group in order to continue"),
_("You must select a valid image/map group in order to continue"),
parent=self,
)
event.Veto()
return

if event.GetDirection() and self.extension == "":
GMessage(
_("You must enter an map name " "extension in order to continue"),
_("You must enter an map name extension in order to continue"),
parent=self,
)
event.Veto()
Expand Down Expand Up @@ -917,7 +917,7 @@ def OnPageChanging(self, event=None):

if event.GetDirection() and (src_map == ""):
GMessage(
_("You must select a source map " "in order to continue"), parent=self
_("You must select a source map in order to continue"), parent=self
)
event.Veto()
return
Expand Down
2 changes: 1 addition & 1 deletion gui/wxpython/gcp/mapdisplay.py
Original file line number Diff line number Diff line change
Expand Up @@ -627,7 +627,7 @@ def SaveToFile(self, event):
dlg = wx.FileDialog(
parent=self,
message=_(
"Choose a file name to save the image " "(no need to add extension)"
"Choose a file name to save the image (no need to add extension)"
),
wildcard=filetype,
style=wx.FD_SAVE | wx.FD_OVERWRITE_PROMPT,
Expand Down
8 changes: 4 additions & 4 deletions gui/wxpython/gmodeler/dialogs.py
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ def ValidateCmd(self, cmd):
GError(
parent=self,
message=_(
"Command not defined.\n\n" "Unable to add new action to the model."
"Command not defined.\n\nUnable to add new action to the model."
),
)
return False
Expand Down Expand Up @@ -458,7 +458,7 @@ def _getOptions(self):
GError(
parent=self.parent,
message=_(
"Relation doesn't start with data item.\n" "Unable to add relation."
"Relation doesn't start with data item.\nUnable to add relation."
),
)
return items
Expand All @@ -483,7 +483,7 @@ def _getOptions(self):
if not items:
GError(
parent=self.parent,
message=_("No relevant option found.\n" "Unable to add relation."),
message=_("No relevant option found.\nUnable to add relation."),
)
return items

Expand Down Expand Up @@ -867,7 +867,7 @@ def OnRemoveAll(self, event):
"""Remove all variable(s) from the model"""
dlg = wx.MessageBox(
parent=self,
message=_("Do you want to delete all variables from " "the model?"),
message=_("Do you want to delete all variables from the model?"),
caption=_("Delete variables"),
style=wx.YES_NO | wx.CENTRE,
)
Expand Down
2 changes: 1 addition & 1 deletion gui/wxpython/gmodeler/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -653,7 +653,7 @@ def Run(self, log, onDone, parent=None):
dlg = wx.MessageDialog(
parent=parent,
message=_(
"Model is not valid. Do you want to " "run the model anyway?\n\n%s"
"Model is not valid. Do you want to run the model anyway?\n\n%s"
)
% "\n".join(errList),
caption=_("Run model?"),
Expand Down
2 changes: 1 addition & 1 deletion gui/wxpython/gmodeler/panels.py
Original file line number Diff line number Diff line change
Expand Up @@ -1765,7 +1765,7 @@ def SaveAs(self, force=False):
dlg = wx.MessageDialog(
self,
message=_(
"File <%s> already exists. " "Do you want to overwrite this file?"
"File <%s> already exists. Do you want to overwrite this file?"
)
% filename,
caption=_("Save file"),
Expand Down
12 changes: 5 additions & 7 deletions gui/wxpython/gui_core/dialogs.py
Original file line number Diff line number Diff line change
Expand Up @@ -493,9 +493,7 @@ def CreateNewVector(
if dlg.table.IsEnabled() and not key:
GError(
parent=parent,
message=_(
"Invalid or empty key column.\n" "Unable to create vector map <%s>."
)
message=_("Invalid or empty key column.\nUnable to create vector map <%s>.")
% outmap,
)
dlg.Destroy()
Expand Down Expand Up @@ -794,7 +792,7 @@ def _createDialogBody(self):
StaticText(
parent=self,
id=wx.ID_ANY,
label=_("Select existing group or " "enter name of new group:"),
label=_("Select existing group or enter name of new group:"),
),
flag=wx.TOP,
border=10,
Expand Down Expand Up @@ -822,7 +820,7 @@ def _createDialogBody(self):
StaticText(
parent=self.subg_panel,
id=wx.ID_ANY,
label=_("Select existing subgroup or " "enter name of new subgroup:"),
label=_("Select existing subgroup or enter name of new subgroup:"),
)
)

Expand Down Expand Up @@ -1232,7 +1230,7 @@ def _checkGroupChange(self):
if self.currentGroup and self.dataChanged:
dlg = wx.MessageDialog(
self,
message=_("Group <%s> was changed, " "do you want to apply changes?")
message=_("Group <%s> was changed, do you want to apply changes?")
% self.currentGroup,
caption=_("Unapplied changes"),
style=wx.YES_NO | wx.ICON_QUESTION | wx.YES_DEFAULT,
Expand All @@ -1247,7 +1245,7 @@ def _checkSubgroupChange(self):
if self.currentSubgroup and self.dataChanged:
dlg = wx.MessageDialog(
self,
message=_("Subgroup <%s> was changed, " "do you want to apply changes?")
message=_("Subgroup <%s> was changed, do you want to apply changes?")
% self.currentSubgroup,
caption=_("Unapplied changes"),
style=wx.YES_NO | wx.ICON_QUESTION | wx.YES_DEFAULT,
Expand Down
2 changes: 1 addition & 1 deletion gui/wxpython/gui_core/mapdisp.py
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ def _initMap(self, Map):
"""Initialize map display, set dimensions and map region"""
if not grass.find_program("g.region", "--help"):
sys.exit(
_("GRASS module '%s' not found. Unable to start map " "display window.")
_("GRASS module '%s' not found. Unable to start map display window.")
% "g.region"
)
Expand Down
2 changes: 1 addition & 1 deletion gui/wxpython/gui_core/preferences.py
Original file line number Diff line number Diff line change
Expand Up @@ -2226,7 +2226,7 @@ def OnSetFont(self, event):
GError(
parent=self,
message=_(
"Failed to set default display font. " "Try different font."
"Failed to set default display font. Try different font."
),
showTraceback=True,
)
Expand Down
2 changes: 1 addition & 1 deletion gui/wxpython/gui_core/pyedit.py
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,7 @@ def SaveAs(self):
dlg = wx.MessageDialog(
parent=self.guiparent,
message=_(
"File <%s> already exists. " "Do you want to overwrite this file?"
"File <%s> already exists. Do you want to overwrite this file?"
)
% filename,
caption=_("Save file"),
Expand Down
7 changes: 3 additions & 4 deletions gui/wxpython/iclass/dialogs.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,13 +207,12 @@ def GetGroupBandsErr(self, parent):
if not bands:
if self.use_subg:
GError(
_("No data found in subgroup <%s> of group <%s>.\n" ".")
% (s, g),
_("No data found in subgroup <%s> of group <%s>.\n.") % (s, g),
parent=parent,
)

else:
GError(_("No data found in group <%s>.\n" ".") % g, parent=parent)
GError(_("No data found in group <%s>.\n.") % g, parent=parent)
else:
GError(_("Group <%s> not found") % gr, parent=parent)

Expand Down Expand Up @@ -799,7 +798,7 @@ def __layout(self):
)
self.withTableCtrl.SetValue(True)
self.withTableCtrl.SetToolTip(
_("Export attribute table containing" " computed statistical data")
_("Export attribute table containing computed statistical data")
)

dataSizer.Add(self.withTableCtrl, proportion=0, flag=wx.ALL, border=3)
Expand Down
8 changes: 4 additions & 4 deletions gui/wxpython/iclass/frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -962,7 +962,7 @@ def OnImportAreas(self, event):
if self.GetAreasCount() or self.stats_data.GetCategories():
qdlg = wx.MessageDialog(
parent=self,
message=_("All changes will be lost. " "Do you want to continue?"),
message=_("All changes will be lost. Do you want to continue?"),
style=wx.YES_NO | wx.NO_DEFAULT | wx.ICON_QUESTION | wx.CENTRE,
)
if qdlg.ShowModal() == wx.ID_NO:
Expand Down Expand Up @@ -1616,7 +1616,7 @@ def CheckInput(self, group, vector):
if not group:
GMessage(
parent=self,
message=_("No imagery group selected. " "Operation canceled."),
message=_("No imagery group selected. Operation canceled."),
)
return False
Expand All @@ -1636,7 +1636,7 @@ def CheckInput(self, group, vector):
# check if vector has any areas
if self.GetAreasCount() == 0:
GMessage(parent=self, message=_("No areas given. " "Operation canceled."))
GMessage(parent=self, message=_("No areas given. Operation canceled."))
return False
# check if vector is inside raster
Expand All @@ -1654,7 +1654,7 @@ def CheckInput(self, group, vector):
GMessage(
parent=self,
message=_(
"Vector features are outside raster layers. " "Operation canceled."
"Vector features are outside raster layers. Operation canceled."
),
)
return False
Expand Down
8 changes: 3 additions & 5 deletions gui/wxpython/image2target/ii2t_gis_set.py
Original file line number Diff line number Diff line change
Expand Up @@ -322,9 +322,7 @@ def _set_properties(self, version, revision):
wx.MessageBox(
parent=self,
caption=_("Error"),
message=_(
"Unable to set GRASS database. " "Check your locale settings."
),
message=_("Unable to set GRASS database. Check your locale settings."),
style=wx.OK | wx.ICON_ERROR | wx.CENTRE,
)

Expand Down Expand Up @@ -673,7 +671,7 @@ def ImportFile(self, filePath):
if returncode != 0:
GError(
parent=self,
message=_("Import of <%(name)s> failed.\n" "Reason: %(msg)s")
message=_("Import of <%(name)s> failed.\nReason: %(msg)s")
% ({"name": filePath, "msg": error}),
)
else:
Expand Down Expand Up @@ -1142,7 +1140,7 @@ def OnStart(self, event):
os.remove(lockfile)
except OSError as e:
GError(
_("Unable to remove '%(lock)s'.\n\n" "Details: %(reason)s")
_("Unable to remove '%(lock)s'.\n\nDetails: %(reason)s")
% {"lock": lockfile, "reason": e}
)
else:
Expand Down
Loading

0 comments on commit fb2b1e4

Please sign in to comment.