From d7949c5c61e6b491bc77c5b980ab3af24069ad0a Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sat, 1 Feb 2025 09:30:17 -0500 Subject: [PATCH] CI(deps): Update black to v25 (major) (#5022) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 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 <27212526+echoix@users.noreply.github.com> --- .github/workflows/python-code-quality.yml | 2 +- .pre-commit-config.yaml | 2 +- db/db.describe/testsuite/test_dbdescribe.py | 1 + gui/wxpython/animation/provider.py | 5 ++-- gui/wxpython/core/settings.py | 5 +--- gui/wxpython/core/testsuite/test_gcmd.py | 1 - gui/wxpython/core/toolboxes.py | 5 +--- gui/wxpython/datacatalog/dialogs.py | 3 +-- gui/wxpython/dbmgr/base.py | 8 ++---- gui/wxpython/gcp/manager.py | 14 +++------- gui/wxpython/gmodeler/dialogs.py | 3 +-- gui/wxpython/gmodeler/model.py | 11 ++++---- gui/wxpython/gui_core/dialogs.py | 3 +-- gui/wxpython/gui_core/forms.py | 3 +-- gui/wxpython/gui_core/gselect.py | 5 ++-- gui/wxpython/gui_core/pyedit.py | 3 +-- gui/wxpython/history/tree.py | 1 - gui/wxpython/image2target/ii2t_gis_set.py | 3 +-- gui/wxpython/image2target/ii2t_manager.py | 8 ++---- gui/wxpython/lmgr/frame.py | 6 ++--- gui/wxpython/main_window/frame.py | 6 ++--- gui/wxpython/mapdisp/toolbars.py | 3 +-- gui/wxpython/mapwin/buffered.py | 5 ++-- gui/wxpython/modules/import_export.py | 3 +-- gui/wxpython/nviz/mapwindow.py | 1 - gui/wxpython/nviz/wxnviz.py | 7 ++--- gui/wxpython/photo2image/g.gui.photo2image.py | 1 + gui/wxpython/photo2image/ip2i_manager.py | 9 +++---- gui/wxpython/psmap/dialogs.py | 5 ++-- gui/wxpython/psmap/frame.py | 3 +-- gui/wxpython/startup/guiutils.py | 3 +-- gui/wxpython/tplot/frame.py | 10 +++---- gui/wxpython/vdigit/toolbars.py | 6 +---- gui/wxpython/vnet/toolbars.py | 1 - imagery/i.atcorr/create_iwave.py | 1 + .../parson/testsuite/gjson_lib_test.py | 1 - lib/gis/testsuite/test_parser_json.py | 1 - lib/init/grass.py | 4 +-- man/build_index.py | 1 - man/build_keywords.py | 2 +- pyproject.toml | 2 +- python/grass/app/runtime.py | 3 +-- python/grass/exceptions/__init__.py | 3 +-- python/grass/grassdb/checks.py | 20 +++----------- python/grass/gunittest/checkers.py | 3 +-- python/grass/gunittest/reporters.py | 17 +++++------- python/grass/imaging/images2gif.py | 6 ++--- python/grass/imaging/images2swf.py | 1 + python/grass/jupyter/interactivemap.py | 1 + python/grass/jupyter/map3d.py | 1 + python/grass/jupyter/utils.py | 1 + python/grass/pydispatch/errors.py | 3 +-- python/grass/pygrass/raster/category.py | 3 ++- python/grass/pygrass/vector/__init__.py | 5 ++-- python/grass/pygrass/vector/find.py | 1 - python/grass/script/__init__.py | 3 +-- python/grass/script/core.py | 3 +-- .../temporal/abstract_space_time_dataset.py | 10 ++----- python/grass/temporal/core.py | 3 +-- python/grass/temporal/temporal_algebra.py | 3 +-- python/grass/temporal/univar_statistics.py | 16 ++++++------ raster/r.buffer/testsuite/test_buffer.py | 1 - raster/r.circle/testsuite/test_circle.py | 1 - .../r.describe/testsuite/test_r_describe.py | 1 - raster/r.distance/testsuite/test_distance.py | 1 - scripts/g.extension.all/g.extension.all.py | 4 +-- scripts/g.extension/g.extension.py | 26 +++++++------------ scripts/i.in.spotvgt/i.in.spotvgt.py | 5 +--- scripts/i.spectral/i.spectral.py | 3 +-- scripts/r.fillnulls/r.fillnulls.py | 15 +++-------- scripts/r.grow/testsuite/test_grow.py | 1 - scripts/v.db.droptable/v.db.droptable.py | 10 ++----- .../v.db.reconnect.all/v.db.reconnect.all.py | 10 ++----- scripts/v.dissolve/v_dissolve.ipynb | 6 ++--- .../t.rast.aggregate.ds.py | 5 +--- temporal/t.rast.gapfill/t.rast.gapfill.py | 5 +--- temporal/t.rast.what/t.rast.what.py | 3 +-- utils/create_python_init_file.py | 1 - utils/generate_release_notes.py | 2 +- .../v.distance/testsuite/test_v_distance.py | 1 - vector/v.out.ogr/testsuite/test_v_out_ogr.py | 1 - vector/v.random/testsuite/test_v_random.py | 1 + 82 files changed, 126 insertions(+), 250 deletions(-) diff --git a/.github/workflows/python-code-quality.yml b/.github/workflows/python-code-quality.yml index bbd0fe46f8d..980f28318b1 100644 --- a/.github/workflows/python-code-quality.yml +++ b/.github/workflows/python-code-quality.yml @@ -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 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 86704d77cfd..3b50a066925 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -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: | diff --git a/db/db.describe/testsuite/test_dbdescribe.py b/db/db.describe/testsuite/test_dbdescribe.py index f48debf0388..dc4d3298a06 100644 --- a/db/db.describe/testsuite/test_dbdescribe.py +++ b/db/db.describe/testsuite/test_dbdescribe.py @@ -5,6 +5,7 @@ @author: lucadelu """ + import json from grass.gunittest.case import TestCase diff --git a/gui/wxpython/animation/provider.py b/gui/wxpython/animation/provider.py index 1b07f63841f..08d1c083cb8 100644 --- a/gui/wxpython/animation/provider.py +++ b/gui/wxpython/animation/provider.py @@ -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 = [] diff --git a/gui/wxpython/core/settings.py b/gui/wxpython/core/settings.py index aa51f8fb207..4df63226392 100644 --- a/gui/wxpython/core/settings.py +++ b/gui/wxpython/core/settings.py @@ -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 diff --git a/gui/wxpython/core/testsuite/test_gcmd.py b/gui/wxpython/core/testsuite/test_gcmd.py index 75d3bf5932b..9653eb5e5c7 100644 --- a/gui/wxpython/core/testsuite/test_gcmd.py +++ b/gui/wxpython/core/testsuite/test_gcmd.py @@ -17,7 +17,6 @@ def recv(self): class Recv_SomeTest(TestCase): - @xfail_windows def test_decode(self): """ diff --git a/gui/wxpython/core/toolboxes.py b/gui/wxpython/core/toolboxes.py index 76c1094e2ba..da4a516e83c 100644 --- a/gui/wxpython/core/toolboxes.py +++ b/gui/wxpython/core/toolboxes.py @@ -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 diff --git a/gui/wxpython/datacatalog/dialogs.py b/gui/wxpython/datacatalog/dialogs.py index aef9aead7bd..8aec78b4f5e 100644 --- a/gui/wxpython/datacatalog/dialogs.py +++ b/gui/wxpython/datacatalog/dialogs.py @@ -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" ), ) diff --git a/gui/wxpython/dbmgr/base.py b/gui/wxpython/dbmgr/base.py index 348e4555641..80430d3a60b 100644 --- a/gui/wxpython/dbmgr/base.py +++ b/gui/wxpython/dbmgr/base.py @@ -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}, ) @@ -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 ) diff --git a/gui/wxpython/gcp/manager.py b/gui/wxpython/gcp/manager.py index 53aee173473..6761cead483 100644 --- a/gui/wxpython/gcp/manager.py +++ b/gui/wxpython/gcp/manager.py @@ -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() @@ -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 @@ -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 @@ -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" ), ) diff --git a/gui/wxpython/gmodeler/dialogs.py b/gui/wxpython/gmodeler/dialogs.py index 1f8ef0ffc91..4a58c70a3cd 100644 --- a/gui/wxpython/gmodeler/dialogs.py +++ b/gui/wxpython/gmodeler/dialogs.py @@ -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 diff --git a/gui/wxpython/gmodeler/model.py b/gui/wxpython/gmodeler/model.py index 75795b92fe2..e8b1ae21f69 100644 --- a/gui/wxpython/gmodeler/model.py +++ b/gui/wxpython/gmodeler/model.py @@ -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", """ ) @@ -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": [ """ ) @@ -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", "") diff --git a/gui/wxpython/gui_core/dialogs.py b/gui/wxpython/gui_core/dialogs.py index ca412808a57..f79578c47a6 100644 --- a/gui/wxpython/gui_core/dialogs.py +++ b/gui/wxpython/gui_core/dialogs.py @@ -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?") diff --git a/gui/wxpython/gui_core/forms.py b/gui/wxpython/gui_core/forms.py index 389ae6f2c30..14d87728057 100644 --- a/gui/wxpython/gui_core/forms.py +++ b/gui/wxpython/gui_core/forms.py @@ -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 diff --git a/gui/wxpython/gui_core/gselect.py b/gui/wxpython/gui_core/gselect.py index 729f38a5d30..bcb744d8562 100644 --- a/gui/wxpython/gui_core/gselect.py +++ b/gui/wxpython/gui_core/gselect.py @@ -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; """ @@ -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}") diff --git a/gui/wxpython/gui_core/pyedit.py b/gui/wxpython/gui_core/pyedit.py index 5958ffb6d68..86b29bc178b 100644 --- a/gui/wxpython/gui_core/pyedit.py +++ b/gui/wxpython/gui_core/pyedit.py @@ -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, diff --git a/gui/wxpython/history/tree.py b/gui/wxpython/history/tree.py index b5488c23d0e..18045cd1cb9 100644 --- a/gui/wxpython/history/tree.py +++ b/gui/wxpython/history/tree.py @@ -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) diff --git a/gui/wxpython/image2target/ii2t_gis_set.py b/gui/wxpython/image2target/ii2t_gis_set.py index dcc8744f469..1022ef2c9b5 100644 --- a/gui/wxpython/image2target/ii2t_gis_set.py +++ b/gui/wxpython/image2target/ii2t_gis_set.py @@ -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, ) diff --git a/gui/wxpython/image2target/ii2t_manager.py b/gui/wxpython/image2target/ii2t_manager.py index 52f7fd88d10..97d528bcf7d 100644 --- a/gui/wxpython/image2target/ii2t_manager.py +++ b/gui/wxpython/image2target/ii2t_manager.py @@ -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() @@ -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" ), ) diff --git a/gui/wxpython/lmgr/frame.py b/gui/wxpython/lmgr/frame.py index 0fe98001674..95e5ec0fd83 100644 --- a/gui/wxpython/lmgr/frame.py +++ b/gui/wxpython/lmgr/frame.py @@ -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) @@ -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 diff --git a/gui/wxpython/main_window/frame.py b/gui/wxpython/main_window/frame.py index 7af480925a4..dba017f6ec8 100644 --- a/gui/wxpython/main_window/frame.py +++ b/gui/wxpython/main_window/frame.py @@ -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) @@ -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 diff --git a/gui/wxpython/mapdisp/toolbars.py b/gui/wxpython/mapdisp/toolbars.py index 18459b26e17..9b0eb4a9c69 100644 --- a/gui/wxpython/mapdisp/toolbars.py +++ b/gui/wxpython/mapdisp/toolbars.py @@ -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")), diff --git a/gui/wxpython/mapwin/buffered.py b/gui/wxpython/mapwin/buffered.py index f2e5b623a2f..a808875f2a8 100644 --- a/gui/wxpython/mapwin/buffered.py +++ b/gui/wxpython/mapwin/buffered.py @@ -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, diff --git a/gui/wxpython/modules/import_export.py b/gui/wxpython/modules/import_export.py index c6e3b9c6d42..d83d468facf 100644 --- a/gui/wxpython/modules/import_export.py +++ b/gui/wxpython/modules/import_export.py @@ -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 diff --git a/gui/wxpython/nviz/mapwindow.py b/gui/wxpython/nviz/mapwindow.py index 0498bd21bbe..b3f05ed6f04 100644 --- a/gui/wxpython/nviz/mapwindow.py +++ b/gui/wxpython/nviz/mapwindow.py @@ -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__():") diff --git a/gui/wxpython/nviz/wxnviz.py b/gui/wxpython/nviz/wxnviz.py index 3d646019803..d4875212343 100644 --- a/gui/wxpython/nviz/wxnviz.py +++ b/gui/wxpython/nviz/wxnviz.py @@ -326,7 +326,6 @@ def print_progress(value): class Nviz: - def __init__(self, glog, gprogress) -> None: """Initialize Nviz class instance @@ -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, @@ -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, diff --git a/gui/wxpython/photo2image/g.gui.photo2image.py b/gui/wxpython/photo2image/g.gui.photo2image.py index 443a43f2d81..e3d6ea140f2 100755 --- a/gui/wxpython/photo2image/g.gui.photo2image.py +++ b/gui/wxpython/photo2image/g.gui.photo2image.py @@ -69,6 +69,7 @@ """ Module to run GCP management tool as standalone application. """ + import os import grass.script as gs diff --git a/gui/wxpython/photo2image/ip2i_manager.py b/gui/wxpython/photo2image/ip2i_manager.py index 7e985101a06..f7a43bbcf6b 100644 --- a/gui/wxpython/photo2image/ip2i_manager.py +++ b/gui/wxpython/photo2image/ip2i_manager.py @@ -1272,8 +1272,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 @@ -1408,8 +1407,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 @@ -2346,8 +2344,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" ), ) diff --git a/gui/wxpython/psmap/dialogs.py b/gui/wxpython/psmap/dialogs.py index 25319e21976..41ae0bbceb7 100644 --- a/gui/wxpython/psmap/dialogs.py +++ b/gui/wxpython/psmap/dialogs.py @@ -4967,8 +4967,9 @@ def _scalebarPanel(self): sbTypeText = StaticText(panel, id=wx.ID_ANY, label=_("Type:")) self.sbCombo = BitmapComboBox(panel, style=wx.CB_READONLY) # only temporary, images must be moved away - imagePath = os.path.join(globalvar.IMGDIR, "scalebar-fancy.png"), os.path.join( - globalvar.IMGDIR, "scalebar-simple.png" + imagePath = ( + os.path.join(globalvar.IMGDIR, "scalebar-fancy.png"), + os.path.join(globalvar.IMGDIR, "scalebar-simple.png"), ) for item, path in zip(["fancy", "simple"], imagePath): bitmap = EmptyBitmap(0, 0) if not os.path.exists(path) else wx.Bitmap(path) diff --git a/gui/wxpython/psmap/frame.py b/gui/wxpython/psmap/frame.py index bd0c484b757..41536cd921d 100644 --- a/gui/wxpython/psmap/frame.py +++ b/gui/wxpython/psmap/frame.py @@ -468,8 +468,7 @@ def OnCmdDone(self, event): event.userData["pdfname"], ] message = _( - "Program {} is not available." - " Please install it to create PDF.\n\n " + "Program {} is not available. Please install it to create PDF.\n\n " ).format(pdf_rendering_prog) try: proc = gs.Popen(command) diff --git a/gui/wxpython/startup/guiutils.py b/gui/wxpython/startup/guiutils.py index fa4d0a8760a..bb5cbc88d0d 100644 --- a/gui/wxpython/startup/guiutils.py +++ b/gui/wxpython/startup/guiutils.py @@ -707,8 +707,7 @@ def switch_mapset_interactively( GMessage( parent=guiparent, message=_( - "Current project is <%(loc)s>.\n" - "Current mapset is <%(mapset)s>." + "Current project is <%(loc)s>.\nCurrent mapset is <%(mapset)s>." ) % {"loc": location, "mapset": mapset}, ) diff --git a/gui/wxpython/tplot/frame.py b/gui/wxpython/tplot/frame.py index 831d06e93a8..21fe822cf4a 100755 --- a/gui/wxpython/tplot/frame.py +++ b/gui/wxpython/tplot/frame.py @@ -18,6 +18,7 @@ @author Luca Delucchi @author start stvds support Matej Krejci """ + import os from itertools import cycle from pathlib import Path @@ -474,9 +475,7 @@ def _getSTRDdata(self, timeseries): GError( parent=self, message=_( - "Datasets have different " - "time unit which is not " - "allowed." + "Datasets have different time unit which is not allowed." ), ) return @@ -670,8 +669,7 @@ def _getSTVDData(self, timeseries): parent=self, showTraceback=False, message=_( - "No connection between vector map {vmap} " - "and layer {la}" + "No connection between vector map {vmap} and layer {la}" ).format(vmap=row["name"], la=lay), ) return @@ -806,7 +804,7 @@ def _drawSimpleLinRegLine(self, xdata, ydata): x=np.array(xdata), y=np.array(ydata), returnFormula=True ) - r2 = "r\u00B2 = {:.5f}".format( + r2 = "r\u00b2 = {:.5f}".format( np.corrcoef(np.array(xdata), np.array(ydata))[0, 1] ** 2 ) self.plots.append( diff --git a/gui/wxpython/vdigit/toolbars.py b/gui/wxpython/vdigit/toolbars.py index 61b79235193..e3fc9657a51 100644 --- a/gui/wxpython/vdigit/toolbars.py +++ b/gui/wxpython/vdigit/toolbars.py @@ -1215,11 +1215,7 @@ def StopEditing(self): dlg.Destroy() self.parent.SetStatusText( - _( - "Please wait, " - "closing and rebuilding topology of " - "vector map <%s>..." - ) + _("Please wait, closing and rebuilding topology of vector map <%s>...") % self.mapLayer.GetName(), 0, ) diff --git a/gui/wxpython/vnet/toolbars.py b/gui/wxpython/vnet/toolbars.py index 4472d718064..e3e83346e1d 100644 --- a/gui/wxpython/vnet/toolbars.py +++ b/gui/wxpython/vnet/toolbars.py @@ -235,5 +235,4 @@ def __init__(self, parent, vnet_mgr): self.Realize() def _toolbarData(self): - return self._getToolbarData(()) diff --git a/imagery/i.atcorr/create_iwave.py b/imagery/i.atcorr/create_iwave.py index 827b8be54c4..bb45fa3eed9 100644 --- a/imagery/i.atcorr/create_iwave.py +++ b/imagery/i.atcorr/create_iwave.py @@ -26,6 +26,7 @@ filter function short. """ + import os import sys import numpy as np diff --git a/lib/external/parson/testsuite/gjson_lib_test.py b/lib/external/parson/testsuite/gjson_lib_test.py index b0352c406d7..6c2eb168266 100644 --- a/lib/external/parson/testsuite/gjson_lib_test.py +++ b/lib/external/parson/testsuite/gjson_lib_test.py @@ -7,7 +7,6 @@ class GjsonLibraryTest(TestCase): - def test_wrapper(self): self.assertModule("test.gjson.lib", flags="u") diff --git a/lib/gis/testsuite/test_parser_json.py b/lib/gis/testsuite/test_parser_json.py index 74ff9673c7f..472a4075156 100644 --- a/lib/gis/testsuite/test_parser_json.py +++ b/lib/gis/testsuite/test_parser_json.py @@ -16,7 +16,6 @@ class TestParserJson(TestCase): - @xfail_windows def test_r_slope_aspect_json(self): args = [ diff --git a/lib/init/grass.py b/lib/init/grass.py index 07e454de0c6..dfa38661fea 100755 --- a/lib/init/grass.py +++ b/lib/init/grass.py @@ -736,9 +736,7 @@ def cannot_create_location_reason(gisdbase, location): " already exists." ).format(**locals()) return _( - "Unable to create new project in" - " the directory <{path}>" - " for an unknown reason." + "Unable to create new project in the directory <{path}> for an unknown reason." ).format(**locals()) diff --git a/man/build_index.py b/man/build_index.py index ef4dbc0dcc1..b51c0807275 100644 --- a/man/build_index.py +++ b/man/build_index.py @@ -44,7 +44,6 @@ def build_index(ext): if __name__ == "__main__": - build_index("html") build_index("md") diff --git a/man/build_keywords.py b/man/build_keywords.py index 546eed62f37..63173c3f254 100644 --- a/man/build_keywords.py +++ b/man/build_keywords.py @@ -158,7 +158,7 @@ def build_keywords(ext): if ext == "html": keyword_line += f' {value.replace(f".{ext}", "")},' # noqa: E501 else: - keyword_line += f' [{value.rsplit(".", 1)[0]}]({man_file_path}),' + keyword_line += f" [{value.rsplit('.', 1)[0]}]({man_file_path})," keyword_line = keyword_line.rstrip(",") if ext == "html": keyword_line += "" diff --git a/pyproject.toml b/pyproject.toml index 69bbc9a0249..b3bdd21a8d5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -5,7 +5,7 @@ requires-python = ">=3.9" [tool.black] line-length = 88 -required-version = '24' +required-version = '25' target-version = ['py39', 'py310', 'py311', 'py312', 'py313'] # 'extend-exclude' excludes files or directories in addition to the defaults extend-exclude = ''' diff --git a/python/grass/app/runtime.py b/python/grass/app/runtime.py index 1640d11a853..d135ed6987d 100644 --- a/python/grass/app/runtime.py +++ b/python/grass/app/runtime.py @@ -37,8 +37,7 @@ def get_grass_config_dir(major_version, minor_version, env): config_dir = env.get(env_dirname) if config_dir is None: msg = ( - f"The {env_dirname} variable is not set, ask your operating" - " system support" + f"The {env_dirname} variable is not set, ask your operating system support" ) raise RuntimeError(msg) diff --git a/python/grass/exceptions/__init__.py b/python/grass/exceptions/__init__.py index deec48ffd96..c7024958097 100644 --- a/python/grass/exceptions/__init__.py +++ b/python/grass/exceptions/__init__.py @@ -1,5 +1,4 @@ -"""GRASS GIS interface to Python exceptions -""" +"""GRASS GIS interface to Python exceptions""" import subprocess diff --git a/python/grass/grassdb/checks.py b/python/grass/grassdb/checks.py index 39dd1081fdf..052addac248 100644 --- a/python/grass/grassdb/checks.py +++ b/python/grass/grassdb/checks.py @@ -284,19 +284,13 @@ def get_mapset_invalid_reason(database, location, mapset, none_for_no_reason=Fal return _("<%s> is not a GRASS Mapset because it is not a directory") % mapset if not (mapset_path / "WIND").is_file(): return ( - _( - "<%s> is not a valid GRASS Mapset" - " because it does not have a WIND file" - ) + _("<%s> is not a valid GRASS Mapset because it does not have a WIND file") % mapset ) # based on the is_mapset_valid() function if not os.access(mapset_path / "WIND", os.R_OK): return ( - _( - "<%s> is not a valid GRASS Mapset" - " because its WIND file is not readable" - ) + _("<%s> is not a valid GRASS Mapset because its WIND file is not readable") % mapset ) # no reason for invalidity found (might be valid) @@ -336,18 +330,12 @@ def get_location_invalid_reason( # permanent mapset if not permanent_path.exists(): return ( - _( - "<%s> is not a valid GRASS Location" - " because PERMANENT Mapset is missing" - ) + _("<%s> is not a valid GRASS Location because PERMANENT Mapset is missing") % location_path ) if not permanent_path.is_dir(): return ( - _( - "<%s> is not a valid GRASS Location" - " because PERMANENT is not a directory" - ) + _("<%s> is not a valid GRASS Location because PERMANENT is not a directory") % location_path ) # partially based on the is_location_valid() function diff --git a/python/grass/gunittest/checkers.py b/python/grass/gunittest/checkers.py index f83fda80216..57148c77019 100644 --- a/python/grass/gunittest/checkers.py +++ b/python/grass/gunittest/checkers.py @@ -224,8 +224,7 @@ def text_to_keyvalue( if kvdict: # key is the one from previous line msg = ( - "Empty line in the parsed text." - " Previous line's key is <%s>" + "Empty line in the parsed text. Previous line's key is <%s>" ) % key raise ValueError(msg) else: # noqa: PLR5501 diff --git a/python/grass/gunittest/reporters.py b/python/grass/gunittest/reporters.py index d6ff1669bbc..cef2ee5a0b8 100644 --- a/python/grass/gunittest/reporters.py +++ b/python/grass/gunittest/reporters.py @@ -278,9 +278,7 @@ def get_html_test_authors_table(directory, tests_authors): not_testing_authors = tested_dir_authors - tests_authors else: no_svn_text = ( - '' - "Authors cannot be obtained using SVN." - "" + 'Authors cannot be obtained using SVN.' ) not_testing_authors = tested_dir_authors = [no_svn_text] if not not_testing_authors: @@ -516,8 +514,7 @@ def success_to_html_text(total, successes): # alternatives: SUCCEEDED, passed, OK return 'succeeded' return ( - '' - "? more successes than total ?" + '? more successes than total ?' ) @@ -559,9 +556,7 @@ def start(self, results_dir): svn_info = get_svn_info() if not svn_info: svn_text = ( - '' - "SVN revision cannot be obtained" - "" + 'SVN revision cannot be obtained' ) else: url = get_source_url( @@ -629,9 +624,9 @@ def format_percentage(percentage): ) self.main_index.write( - "
{tfoot}" - "{summary}
" - "