Skip to content

Commit

Permalink
CI(deps): Update black to v25 (major) (#5022)
Browse files Browse the repository at this point in the history
* CI(deps): Update black to v25

* style: Set required black version to 25

* style: Format repo with Black 2025 style

* style: Apply `ruff format` changes not conflicting with Black 25

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Edouard Choinière <[email protected]>
  • Loading branch information
renovate[bot] and echoix authored Feb 1, 2025
1 parent 6be158f commit d7949c5
Show file tree
Hide file tree
Showing 82 changed files with 126 additions and 250 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/python-code-quality.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
PYTHON_VERSION: "3.13"
MIN_PYTHON_VERSION: "3.9"
# renovate: datasource=pypi depName=black
BLACK_VERSION: "24.10.0"
BLACK_VERSION: "25.1.0"
# renovate: datasource=pypi depName=flake8
FLAKE8_VERSION: "7.1.1"
# renovate: datasource=pypi depName=pylint
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ repos:
- id: markdownlint-fix
# Using this mirror lets us use mypyc-compiled black, which is about 2x faster
- repo: https://github.com/psf/black-pre-commit-mirror
rev: 24.10.0
rev: 25.1.0
hooks:
- id: black-jupyter
exclude: |
Expand Down
1 change: 1 addition & 0 deletions db/db.describe/testsuite/test_dbdescribe.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
@author: lucadelu
"""

import json

from grass.gunittest.case import TestCase
Expand Down
5 changes: 3 additions & 2 deletions gui/wxpython/animation/provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,8 +217,9 @@ def Load(self, force=False, bgcolor=(255, 255, 255), nprocs=4):
"""
Debug.msg(
2,
"BitmapProvider.Load: "
"force={f}, bgcolor={b}, nprocs={n}".format(f=force, b=bgcolor, n=nprocs),
"BitmapProvider.Load: force={f}, bgcolor={b}, nprocs={n}".format(
f=force, b=bgcolor, n=nprocs
),
)
cmds = []
regions = []
Expand Down
5 changes: 1 addition & 4 deletions gui/wxpython/core/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -998,10 +998,7 @@ def SaveToFile(self, settings=None):
raise GException(e)
except Exception as e:
raise GException(
_(
"Writing settings to file <%(file)s> failed."
"\n\nDetails: %(detail)s"
)
_("Writing settings to file <%(file)s> failed.\n\nDetails: %(detail)s")
% {"file": self.filePath, "detail": e}
)
return self.filePath
Expand Down
1 change: 0 additions & 1 deletion gui/wxpython/core/testsuite/test_gcmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ def recv(self):


class Recv_SomeTest(TestCase):

@xfail_windows
def test_decode(self):
"""
Expand Down
5 changes: 1 addition & 4 deletions gui/wxpython/core/toolboxes.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,10 +149,7 @@ def getMenudataFile(userRootFile, newFile, fallback):
generateNew = True
_debug(
2,
(
"toolboxes.getMenudataFile: only one of the user "
"defined files"
),
("toolboxes.getMenudataFile: only one of the user defined files"),
)
else:
# if newer files -> generate new
Expand Down
3 changes: 1 addition & 2 deletions gui/wxpython/datacatalog/dialogs.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,7 @@ def _doLayout(self):
dialogSizer.Add(optionsSizer, proportion=1, flag=wx.ALL | wx.EXPAND, border=10)
helptext = StaticText(
self.panel,
label="For more reprojection options,"
" please see {module}".format(
label="For more reprojection options, please see {module}".format(
module="r.proj" if self.etype == "raster" else "v.proj"
),
)
Expand Down
8 changes: 2 additions & 6 deletions gui/wxpython/dbmgr/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,8 +198,7 @@ def LoadData(self, layer, columns=None, where=None, sql=None):
GError(
parent=self,
message=_(
"Column <%(column)s> not found in "
"in the table <%(table)s>."
"Column <%(column)s> not found in in the table <%(table)s>."
)
% {"column": col, "table": tableName},
)
Expand Down Expand Up @@ -1642,10 +1641,7 @@ def OnDataItemAdd(self, event):
try:
if cat in tlist.itemCatsMap.values():
raise ValueError(
_(
"Record with category number %d "
"already exists in the table."
)
_("Record with category number %d already exists in the table.")
% cat
)

Expand Down
14 changes: 4 additions & 10 deletions gui/wxpython/gcp/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -503,10 +503,7 @@ def OnMapset(self, event):
def OnPageChanging(self, event: WizardEvent | None = None) -> None:
if event.GetDirection() and (self.xylocation == "" or self.xymapset == ""):
GMessage(
_(
"You must select a valid location "
"and mapset in order to continue"
),
_("You must select a valid location and mapset in order to continue"),
parent=self,
)
event.Veto()
Expand Down Expand Up @@ -2020,8 +2017,7 @@ def RMSError(self, xygroup, order):
GError(
parent=self,
message=_(
"Could not calculate RMS Error.\n"
"Possible error with m.transform."
"Could not calculate RMS Error.\nPossible error with m.transform."
),
)
return
Expand Down Expand Up @@ -2153,8 +2149,7 @@ def GetNewExtent(self, region, map=None):
GError(
parent=self,
message=_(
"Could not calculate new extends.\n"
"Possible error with m.transform."
"Could not calculate new extends.\nPossible error with m.transform."
),
)
return
Expand Down Expand Up @@ -3258,8 +3253,7 @@ def OnSDFactor(self, event):
GError(
parent=self,
message=_(
"RMS threshold factor is < 1\n"
"Too many points might be highlighted"
"RMS threshold factor is < 1\nToo many points might be highlighted"
),
)

Expand Down
3 changes: 1 addition & 2 deletions gui/wxpython/gmodeler/dialogs.py
Original file line number Diff line number Diff line change
Expand Up @@ -469,8 +469,7 @@ def _getOptions(self):
GError(
parent=self.parent,
message=_(
"Relation doesn't point to GRASS command.\n"
"Unable to add relation."
"Relation doesn't point to GRASS command.\nUnable to add relation."
),
)
return items
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 @@ -2704,9 +2704,9 @@ def _writeActinia(self):

self.fd.write(
f"""{{
{' ' * self.indent * 1}"id": "model",
{' ' * self.indent * 1}"description": "{'""'.join(description.splitlines())}",
{' ' * self.indent * 1}"version": "1",
{" " * self.indent * 1}"id": "model",
{" " * self.indent * 1}"description": "{'""'.join(description.splitlines())}",
{" " * self.indent * 1}"version": "1",
"""
)

Expand All @@ -2723,12 +2723,12 @@ def _writeActinia(self):
if parameterized is True:
self.fd.write(f'{" " * self.indent * 1}"template": {{\n')
self.fd.write(
f"""{' ' * self.indent * 2}"list": [
f"""{" " * self.indent * 2}"list": [
"""
)
else:
self.fd.write(
f"""{' ' * self.indent}"list": [
f"""{" " * self.indent}"list": [
"""
)

Expand Down Expand Up @@ -2781,7 +2781,6 @@ def _getPythonActionCmd(self, item, task, cmdIndent, variables={}):
value = p.get("value", None)

if (name and value) or (name in parameterizedParams):

if name in parameterizedParams:
parameterizedParam = self._getParamName(name, item)
default_val = p.get("value", "")
Expand Down
3 changes: 1 addition & 2 deletions gui/wxpython/gui_core/dialogs.py
Original file line number Diff line number Diff line change
Expand Up @@ -2357,8 +2357,7 @@ def __init__(

if self._shell_running:
text = _(
"Do you want to quit GRASS GIS including shell "
"or just close the GUI?"
"Do you want to quit GRASS GIS including shell or just close the GUI?"
)
else:
text = _("Do you want to quit GRASS GIS?")
Expand Down
3 changes: 1 addition & 2 deletions gui/wxpython/gui_core/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,7 @@
if os.getenv("GISBASE") is None:
# intentionally not translatable
sys.exit(
"Failed to start. GRASS GIS is not running"
" or the installation is broken."
"Failed to start. GRASS GIS is not running or the installation is broken."
)
from grass.script.setup import set_gui_path

Expand Down
5 changes: 2 additions & 3 deletions gui/wxpython/gui_core/gselect.py
Original file line number Diff line number Diff line change
Expand Up @@ -2532,7 +2532,7 @@ def _getPGDBTablesColumnsTypesSql(self, tables):
pg_catalog.pg_table_is_visible(c.oid)
) AS o ON a.attrelid = o.oid
WHERE
relname IN ({', '.join(tables)})
relname IN ({", ".join(tables)})
AND NOT a.attisdropped;
"""

Expand Down Expand Up @@ -2608,8 +2608,7 @@ def _getPGDBRasters(self, dsn):
GError(
parent=self,
message=_(
"PostgreSQL DB <{psql}> program was not found."
" Please, install it."
"PostgreSQL DB <{psql}> program was not found. Please, install it."
).format(psql=self._psql),
)
Debug.msg(3, f"GdalSelect._getPGDBRasters(): return {rasters}")
Expand Down
3 changes: 1 addition & 2 deletions gui/wxpython/gui_core/pyedit.py
Original file line number Diff line number Diff line change
Expand Up @@ -305,8 +305,7 @@ def _openFile(self, file_path):
except PermissionError:
GError(
message=_(
"Permission denied <{}>. Please change file "
"permission for reading."
"Permission denied <{}>. Please change file permission for reading."
).format(file_path),
parent=self.guiparent,
showTraceback=False,
Expand Down
1 change: 0 additions & 1 deletion gui/wxpython/history/tree.py
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,6 @@ def _initHistoryModel(self):
Populate the tree history model based on the current history log.
"""
for entry in self.ReadFromHistory():

# Get history day node
day_node = self.GetHistoryNode(entry)

Expand Down
3 changes: 1 addition & 2 deletions gui/wxpython/image2target/ii2t_gis_set.py
Original file line number Diff line number Diff line change
Expand Up @@ -864,8 +864,7 @@ def UpdateLocations(self, dbase):
GError(
parent=self,
message=_(
"Unicode error detected. "
"Check your locale settings. Details: {0}"
"Unicode error detected. Check your locale settings. Details: {0}"
).format(e),
showTraceback=False,
)
Expand Down
8 changes: 2 additions & 6 deletions gui/wxpython/image2target/ii2t_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -527,10 +527,7 @@ def OnMapset(self, event):
def OnPageChanging(self, event: WizardEvent | None = None) -> None:
if event.GetDirection() and (self.xylocation == "" or self.xymapset == ""):
GMessage(
_(
"You must select a valid location "
"and mapset in order to continue"
),
_("You must select a valid location and mapset in order to continue"),
parent=self,
)
event.Veto()
Expand Down Expand Up @@ -3220,8 +3217,7 @@ def OnSDFactor(self, event):
GError(
parent=self,
message=_(
"RMS threshold factor is < 1\n"
"Too many points might be highlighted"
"RMS threshold factor is < 1\nToo many points might be highlighted"
),
)

Expand Down
6 changes: 2 additions & 4 deletions gui/wxpython/lmgr/frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -968,8 +968,7 @@ def RunSpecialCmd(self, command):
else:
result = False
raise ValueError(
"Layer Manager special command (%s)"
" not supported." % " ".join(command)
"Layer Manager special command (%s) not supported." % " ".join(command)
)
if result:
self._gconsole.UpdateHistory(status=Status.SUCCESS)
Expand Down Expand Up @@ -1185,8 +1184,7 @@ def OnVDigit(self, event):
GMessage(
parent=self,
message=_(
"Editing is allowed only for vector maps from the "
"current mapset."
"Editing is allowed only for vector maps from the current mapset."
),
)
return
Expand Down
6 changes: 2 additions & 4 deletions gui/wxpython/main_window/frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -1109,8 +1109,7 @@ def RunSpecialCmd(self, command):
else:
result = False
raise ValueError(
"Layer Manager special command (%s)"
" not supported." % " ".join(command)
"Layer Manager special command (%s) not supported." % " ".join(command)
)
if result:
self._gconsole.UpdateHistory(status=Status.SUCCESS)
Expand Down Expand Up @@ -1340,8 +1339,7 @@ def OnVDigit(self, event):
GMessage(
parent=self,
message=_(
"Editing is allowed only for vector maps from the "
"current mapset."
"Editing is allowed only for vector maps from the current mapset."
),
)
return
Expand Down
3 changes: 1 addition & 2 deletions gui/wxpython/mapdisp/toolbars.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,7 @@
img="flythrough",
label=_("Fly-through mode"),
desc=_(
"Drag with mouse, hold Ctrl down for different mode"
" or Shift to accelerate"
"Drag with mouse, hold Ctrl down for different mode or Shift to accelerate"
),
),
"zoomIn": BaseIcons["zoomIn"].SetLabel(desc=_("Click mouse to zoom")),
Expand Down
5 changes: 3 additions & 2 deletions gui/wxpython/mapwin/buffered.py
Original file line number Diff line number Diff line change
Expand Up @@ -743,8 +743,9 @@ def _saveToFileDone(self, callback=None):
# draw any active and defined overlays
if self.imagedict[img]["layer"].IsActive():
id = self.imagedict[img]["id"]
coords = int(ratio[0] * self.overlays[id].coords[0]), int(
ratio[1] * self.overlays[id].coords[1]
coords = (
int(ratio[0] * self.overlays[id].coords[0]),
int(ratio[1] * self.overlays[id].coords[1]),
)
self.Draw(
self.pdc,
Expand Down
3 changes: 1 addition & 2 deletions gui/wxpython/modules/import_export.py
Original file line number Diff line number Diff line change
Expand Up @@ -502,8 +502,7 @@ def OnRun(self, event):
GError(
parent=self,
message=_(
"The Python GDAL package is missing."
" Please install it."
"The Python GDAL package is missing. Please install it."
),
)
return
Expand Down
1 change: 0 additions & 1 deletion gui/wxpython/nviz/mapwindow.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ class RenderTypedDict(TypedDict):


class NvizThread(Thread):

def __init__(self, log, progressbar, window) -> None:
Thread.__init__(self)
Debug.msg(5, "NvizThread.__init__():")
Expand Down
7 changes: 2 additions & 5 deletions gui/wxpython/nviz/wxnviz.py
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,6 @@ def print_progress(value):


class Nviz:

def __init__(self, glog, gprogress) -> None:
"""Initialize Nviz class instance
Expand Down Expand Up @@ -1397,8 +1396,7 @@ def SetVectorPointMode(

Debug.msg(
3,
"Nviz::SetVectorPointMode(): id=%d, color=%s, "
"width=%d, size=%f, marker=%d",
"Nviz::SetVectorPointMode(): id=%d, color=%s, width=%d, size=%f, marker=%d",
id,
color_str,
width,
Expand Down Expand Up @@ -1999,8 +1997,7 @@ def SetIsosurfaceAttr(

Debug.msg(
3,
"Nviz::SetIsosurfaceAttr(): id=%d, isosurf=%d, "
"attr=%d, map=%s, value=%s",
"Nviz::SetIsosurfaceAttr(): id=%d, isosurf=%d, attr=%d, map=%s, value=%s",
id,
isosurf_id,
attr,
Expand Down
1 change: 1 addition & 0 deletions gui/wxpython/photo2image/g.gui.photo2image.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@
"""
Module to run GCP management tool as standalone application.
"""

import os
import grass.script as gs

Expand Down
Loading

0 comments on commit d7949c5

Please sign in to comment.