Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

style: Fix all flake8-gettext (INT) errors (INT001, INT002, INT003) #4052

Merged
merged 23 commits into from
Sep 14, 2024
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
9169617
style: Fix all flake8-gettext (INT) errors (INT001, INT002, INT003)
echoix Jul 14, 2024
be04e4b
style: Fix all flake8-gettext (INT) errors (INT001, INT002, INT003)
echoix Jul 14, 2024
bfc04b1
style: Fix all flake8-gettext (INT) errors (INT001, INT002, INT003)
echoix Jul 14, 2024
9a109d2
style: Fix all flake8-gettext (INT) errors (INT001, INT002, INT003)
echoix Jul 14, 2024
50cb143
style: Fix all flake8-gettext (INT) errors (INT001, INT002, INT003)
echoix Jul 14, 2024
0a9de8c
style: Fix all flake8-gettext (INT) errors (INT001, INT002, INT003)
echoix Jul 14, 2024
3cd99a0
style: Fix all flake8-gettext (INT) errors (INT001, INT002, INT003)
echoix Jul 14, 2024
f3e7a4f
style: Fix all flake8-gettext (INT) errors (INT001, INT002, INT003)
echoix Jul 14, 2024
104776f
Merge remote-tracking branch 'origin/main' into fix-flake8-gettext-INT
echoix Jul 17, 2024
a39178c
Revert source string changes when unneeded.
echoix Jul 18, 2024
2851f6a
Merge remote-tracking branch 'upstream/main' into fix-flake8-gettext-INT
echoix Aug 5, 2024
2473c21
Merge branch 'main' into fix-flake8-gettext-INT
echoix Aug 9, 2024
7b46e59
Merge branch 'main' into fix-flake8-gettext-INT
echoix Aug 13, 2024
00580b1
Merge branch 'main' into fix-flake8-gettext-INT
echoix Sep 3, 2024
f48fb0c
Update univar_statistics.py
echoix Sep 4, 2024
5d016ca
Update panels.py for Python script type string
echoix Sep 10, 2024
c9ee22f
Apply suggestions from code review
echoix Sep 10, 2024
8c1cf56
Merge branch 'main' into fix-flake8-gettext-INT
echoix Sep 10, 2024
b169f05
Update pyedit.py to keep path keyword in changed string
echoix Sep 10, 2024
7fd2842
Update univar_statistics.py to make already translated strings match …
echoix Sep 10, 2024
895fd8c
Update pyedit.py
echoix Sep 10, 2024
b07f49b
Update model.py
echoix Sep 13, 2024
43d7cee
Merge branch 'main' into fix-flake8-gettext-INT
echoix Sep 13, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions general/g.parser/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
6 changes: 3 additions & 3 deletions gui/wxpython/animation/dialogs.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion gui/wxpython/animation/temporal_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,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] = {}
Expand Down
4 changes: 2 additions & 2 deletions gui/wxpython/core/debug.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
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 @@ -708,7 +708,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(
Expand Down
9 changes: 4 additions & 5 deletions gui/wxpython/gcp/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -1786,11 +1786,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,
Expand Down
11 changes: 5 additions & 6 deletions gui/wxpython/gmodeler/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -2825,12 +2825,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 "
echoix marked this conversation as resolved.
Show resolved Hide resolved
"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"),
echoix marked this conversation as resolved.
Show resolved Hide resolved
style=wx.OK_DEFAULT | wx.ICON_WARNING,
)
Expand Down
24 changes: 10 additions & 14 deletions gui/wxpython/gmodeler/panels.py
Original file line number Diff line number Diff line change
Expand Up @@ -266,19 +266,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,
)
Expand Down Expand Up @@ -1259,7 +1255,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,
)
Expand Down Expand Up @@ -1674,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":
Expand Down Expand Up @@ -1702,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,
)
Expand Down Expand Up @@ -1833,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,
)

Expand All @@ -1852,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()
Expand Down
12 changes: 6 additions & 6 deletions gui/wxpython/gui_core/ghelp.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand Down
68 changes: 34 additions & 34 deletions gui/wxpython/gui_core/gselect.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand All @@ -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
Expand Down
29 changes: 13 additions & 16 deletions gui/wxpython/gui_core/pyedit.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)

Expand All @@ -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,
),
echoix marked this conversation as resolved.
Show resolved Hide resolved
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,
)
Expand All @@ -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])
Expand All @@ -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
Expand Down Expand Up @@ -508,9 +506,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
echoix marked this conversation as resolved.
Show resolved Hide resolved
),
parent=self.guiparent,
)
Expand Down
Loading
Loading