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}

" - "".format(tfoot=tfoot, summary=summary_sentence) + "{tfoot}

{summary}

".format( + tfoot=tfoot, summary=summary_sentence + ) ) self.main_index.close() diff --git a/python/grass/imaging/images2gif.py b/python/grass/imaging/images2gif.py index 8e352e62bd3..aa73723dd79 100644 --- a/python/grass/imaging/images2gif.py +++ b/python/grass/imaging/images2gif.py @@ -185,7 +185,7 @@ def getImageDescriptor(self, im, xy=None): xy = (0, 0) # Image separator, - bb = "\x2C" + bb = "\x2c" # Image position and size bb += intToBin(xy[0]) # Left position @@ -214,7 +214,7 @@ def getAppExt(self, loops=float("inf")): # (the extension interprets zero loops # to mean an infinite number of loops) # Mmm, does not seem to work - bb = "\x21\xFF\x0B" # application extension + bb = "\x21\xff\x0b" # application extension bb += "NETSCAPE2.0" bb += "\x03\x01" bb += intToBin(loops) @@ -240,7 +240,7 @@ def getGraphicsControlExt(self, duration=0.1, dispose=2): :param dispose: """ - bb = "\x21\xF9\x04" + bb = "\x21\xf9\x04" bb += chr((dispose & 3) << 2) # low bit 1 == transparency, # 2nd bit 1 == user input , next 3 bits, the low two of which are used, # are dispose. diff --git a/python/grass/imaging/images2swf.py b/python/grass/imaging/images2swf.py index 447217e108e..85f9e447c59 100644 --- a/python/grass/imaging/images2swf.py +++ b/python/grass/imaging/images2swf.py @@ -65,6 +65,7 @@ of a watermark in the upper left corner. """ + from __future__ import annotations import os diff --git a/python/grass/jupyter/interactivemap.py b/python/grass/jupyter/interactivemap.py index d843ac3b6b6..fd2ee74f14e 100644 --- a/python/grass/jupyter/interactivemap.py +++ b/python/grass/jupyter/interactivemap.py @@ -13,6 +13,7 @@ # for details. """Interactive visualizations map with folium or ipyleaflet""" + import os import base64 import json diff --git a/python/grass/jupyter/map3d.py b/python/grass/jupyter/map3d.py index 99253251406..b6b49dcaf0f 100644 --- a/python/grass/jupyter/map3d.py +++ b/python/grass/jupyter/map3d.py @@ -12,6 +12,7 @@ # for details. """Render 3D visualizations""" + from __future__ import annotations import os diff --git a/python/grass/jupyter/utils.py b/python/grass/jupyter/utils.py index e3be2e7da87..518cd9c2fa0 100644 --- a/python/grass/jupyter/utils.py +++ b/python/grass/jupyter/utils.py @@ -11,6 +11,7 @@ # for details. """Utility functions warpping existing processes in a suitable way""" + from collections.abc import Mapping import tempfile import json diff --git a/python/grass/pydispatch/errors.py b/python/grass/pydispatch/errors.py index 60fd4c67f8f..80caabdee21 100644 --- a/python/grass/pydispatch/errors.py +++ b/python/grass/pydispatch/errors.py @@ -1,5 +1,4 @@ -"""Error types for dispatcher mechanism -""" +"""Error types for dispatcher mechanism""" class DispatcherError(Exception): diff --git a/python/grass/pygrass/raster/category.py b/python/grass/pygrass/raster/category.py index e2168efa413..d0eefc02f25 100644 --- a/python/grass/pygrass/raster/category.py +++ b/python/grass/pygrass/raster/category.py @@ -271,7 +271,8 @@ def copy(self, category): :type category: Category object """ libraster.Rast_copy_cats( - ctypes.byref(self.c_cats), ctypes.byref(category.c_cats) # to + ctypes.byref(self.c_cats), + ctypes.byref(category.c_cats), # to ) # from self._read_cats() diff --git a/python/grass/pygrass/vector/__init__.py b/python/grass/pygrass/vector/__init__.py index 7b50c1cf513..5d486d675cb 100644 --- a/python/grass/pygrass/vector/__init__.py +++ b/python/grass/pygrass/vector/__init__.py @@ -632,8 +632,9 @@ def rewrite(self, geo_obj, cat, attrs=None, **kargs): self.table.update(key=cat, values=attrs) elif self.table is None and attrs: print( - "Table for vector {name} does not exist, attributes not" - " loaded".format(name=self.name) + "Table for vector {name} does not exist, attributes not loaded".format( + name=self.name + ) ) libvect.Vect_cat_set(geo_obj.c_cats, self.layer, cat) result = libvect.Vect_rewrite_line( diff --git a/python/grass/pygrass/vector/find.py b/python/grass/pygrass/vector/find.py index 97a9d2bc261..0769e85e72e 100644 --- a/python/grass/pygrass/vector/find.py +++ b/python/grass/pygrass/vector/find.py @@ -21,7 +21,6 @@ class AbstractFinder: - def __init__( self, c_mapinfo, table: Table | None = None, writeable: bool = False ) -> None: diff --git a/python/grass/script/__init__.py b/python/grass/script/__init__.py index 032a0eb67f3..a5dfbedd239 100644 --- a/python/grass/script/__init__.py +++ b/python/grass/script/__init__.py @@ -1,5 +1,4 @@ -"""Python interface to launch GRASS GIS modules in scripts -""" +"""Python interface to launch GRASS GIS modules in scripts""" from . import setup from .core import ( diff --git a/python/grass/script/core.py b/python/grass/script/core.py index bab16d2b4ca..ab116dc42db 100644 --- a/python/grass/script/core.py +++ b/python/grass/script/core.py @@ -362,8 +362,7 @@ def get_module_and_code(args, kwargs): module, code = get_module_and_code(args, kwargs) fatal( _( - "Module {module} ({code}) failed with" - " non-zero return code {returncode}" + "Module {module} ({code}) failed with non-zero return code {returncode}" ).format(module=module, code=code, returncode=returncode) ) elif handler.lower() == "exit": diff --git a/python/grass/temporal/abstract_space_time_dataset.py b/python/grass/temporal/abstract_space_time_dataset.py index 541fc8dd564..3b14e28b494 100644 --- a/python/grass/temporal/abstract_space_time_dataset.py +++ b/python/grass/temporal/abstract_space_time_dataset.py @@ -1744,17 +1744,11 @@ def _update_where_statement_by_spatial_extent( ) elif spatial_relation == "is_contained": spatial_where_template = ( - "(north <= {n}" - " AND south >= {s}" - " AND east <= {e}" - " AND west >= {w}" + "(north <= {n} AND south >= {s} AND east <= {e} AND west >= {w}" ) elif spatial_relation == "contains": spatial_where_template = ( - "(north >= {n}" - " AND south <= {s}" - " AND east >= {e}" - " AND west <= {w}" + "(north >= {n} AND south <= {s} AND east >= {e} AND west <= {w}" ) if self.get_type() == "str3ds": diff --git a/python/grass/temporal/core.py b/python/grass/temporal/core.py index c350c4fa458..5daa99e2b20 100644 --- a/python/grass/temporal/core.py +++ b/python/grass/temporal/core.py @@ -630,8 +630,7 @@ def init(raise_fatal_error: bool = False, skip_db_version_check: bool = False): import sqlite3 except ImportError: msgr.error( - "Unable to locate the sqlite SQL Python interface" - " module sqlite3." + "Unable to locate the sqlite SQL Python interface module sqlite3." ) raise dbmi = sqlite3 diff --git a/python/grass/temporal/temporal_algebra.py b/python/grass/temporal/temporal_algebra.py index 9c33faa98f3..002862580d6 100644 --- a/python/grass/temporal/temporal_algebra.py +++ b/python/grass/temporal/temporal_algebra.py @@ -2532,8 +2532,7 @@ def p_statement_assign(self, t) -> None: success = resultstds.register_map(map_i, dbif) if not success: self.msgr.warning( - "Unabe to register map layers " - "in STDS %s" % (t[1]) + "Unabe to register map layers in STDS %s" % (t[1]) ) if self.dry_run is False: diff --git a/python/grass/temporal/univar_statistics.py b/python/grass/temporal/univar_statistics.py index f5b25414b43..9e2dfb6e467 100755 --- a/python/grass/temporal/univar_statistics.py +++ b/python/grass/temporal/univar_statistics.py @@ -92,15 +92,15 @@ def compute_univar_stats( eol = "\n" else: eol = "" - string += f'{fs}{stats["mean"]}{fs}{stats["min"]}' - string += f'{fs}{stats["max"]}{fs}{stats["mean_of_abs"]}' - string += f'{fs}{stats["stddev"]}{fs}{stats["variance"]}' - string += f'{fs}{stats["coeff_var"]}{fs}{stats["sum"]}' - string += f'{fs}{stats["null_cells"]}{fs}{stats["n"]}' - string += f'{fs}{stats["n"]}' + string += f"{fs}{stats['mean']}{fs}{stats['min']}" + string += f"{fs}{stats['max']}{fs}{stats['mean_of_abs']}" + string += f"{fs}{stats['stddev']}{fs}{stats['variance']}" + string += f"{fs}{stats['coeff_var']}{fs}{stats['sum']}" + string += f"{fs}{stats['null_cells']}{fs}{stats['n']}" + string += f"{fs}{stats['n']}" if "median" in stats: - string += f'{fs}{stats["first_quartile"]}{fs}{stats["median"]}' - string += f'{fs}{stats["third_quartile"]}' + string += f"{fs}{stats['first_quartile']}{fs}{stats['median']}" + string += f"{fs}{stats['third_quartile']}" if stats_module.inputs.percentile: for perc in stats_module.inputs.percentile: perc_value = stats[ diff --git a/raster/r.buffer/testsuite/test_buffer.py b/raster/r.buffer/testsuite/test_buffer.py index 97fea861104..e207a7f5e8b 100644 --- a/raster/r.buffer/testsuite/test_buffer.py +++ b/raster/r.buffer/testsuite/test_buffer.py @@ -5,7 +5,6 @@ class TestRBuffer(TestCase): - @classmethod def setUpClass(cls): """Set up a temporary region for testing.""" diff --git a/raster/r.circle/testsuite/test_circle.py b/raster/r.circle/testsuite/test_circle.py index 1c0a4b62f54..e6fd2019e03 100644 --- a/raster/r.circle/testsuite/test_circle.py +++ b/raster/r.circle/testsuite/test_circle.py @@ -5,7 +5,6 @@ class TestRCircle(TestCase): - @classmethod def setUpClass(cls): """Set up a temporary region for testing.""" diff --git a/raster/r.describe/testsuite/test_r_describe.py b/raster/r.describe/testsuite/test_r_describe.py index 34e647a4d12..b160cd287b2 100644 --- a/raster/r.describe/testsuite/test_r_describe.py +++ b/raster/r.describe/testsuite/test_r_describe.py @@ -6,7 +6,6 @@ class TestRDescribe(TestCase): - @classmethod def setUpClass(cls): """Set up a temporary region and generate test data.""" diff --git a/raster/r.distance/testsuite/test_distance.py b/raster/r.distance/testsuite/test_distance.py index 62809b2d55e..3773677c909 100644 --- a/raster/r.distance/testsuite/test_distance.py +++ b/raster/r.distance/testsuite/test_distance.py @@ -4,7 +4,6 @@ class TestRDistance(TestCase): - @classmethod def setUpClass(cls): """Set up a temporary region and generate test data.""" diff --git a/scripts/g.extension.all/g.extension.all.py b/scripts/g.extension.all/g.extension.all.py index 1b0a2a88108..03bd7471a9d 100644 --- a/scripts/g.extension.all/g.extension.all.py +++ b/scripts/g.extension.all/g.extension.all.py @@ -109,9 +109,7 @@ def download_modules_xml_file(url, response_format, *args, **kwargs): desc = HTTP_STATUS_CODES[index].description gs.fatal( _( - "Download file from <{url}>, " - "return status code {code}, " - "{desc}" + "Download file from <{url}>, return status code {code}, {desc}" ).format( url=url, code=response.code, diff --git a/scripts/g.extension/g.extension.py b/scripts/g.extension/g.extension.py index aa707912f38..f694e73c23a 100644 --- a/scripts/g.extension/g.extension.py +++ b/scripts/g.extension/g.extension.py @@ -517,8 +517,7 @@ def get_version_branch(major_version): if stderr: gs.fatal( _( - "Failed to get branch from the Git repository <{repo_path}>.\n" - "{error}" + "Failed to get branch from the Git repository <{repo_path}>.\n{error}" ).format( repo_path=GIT_URL, error=gs.decode(stderr), @@ -1803,8 +1802,9 @@ def is_binary_string(bytes): def extract_zip(name, directory, tmpdir): """Extract a ZIP file into a directory""" gs.debug( - "extract_zip(name={name}, directory={directory}," - " tmpdir={tmpdir})".format(name=name, directory=directory, tmpdir=tmpdir), + "extract_zip(name={name}, directory={directory}, tmpdir={tmpdir})".format( + name=name, directory=directory, tmpdir=tmpdir + ), 3, ) try: @@ -1828,8 +1828,9 @@ def extract_zip(name, directory, tmpdir): def extract_tar(name, directory, tmpdir): """Extract a TAR or a similar file into a directory""" gs.debug( - "extract_tar(name={name}, directory={directory}," - " tmpdir={tmpdir})".format(name=name, directory=directory, tmpdir=tmpdir), + "extract_tar(name={name}, directory={directory}, tmpdir={tmpdir})".format( + name=name, directory=directory, tmpdir=tmpdir + ), 3, ) import tarfile @@ -2186,18 +2187,12 @@ def remove_extension(force=False): gs.message(_("Extension <%s> successfully uninstalled.") % ename) elif flags["t"]: gs.warning( - _( - "Toolbox <%s> not removed. " - "Re-run '%s' with '-f' flag to force removal" - ) + _("Toolbox <%s> not removed. Re-run '%s' with '-f' flag to force removal") % (options["extension"], "g.extension") ) else: gs.warning( - _( - "Extension <%s> not removed. " - "Re-run '%s' with '-f' flag to force removal" - ) + _("Extension <%s> not removed. Re-run '%s' with '-f' flag to force removal") % (options["extension"], "g.extension") ) @@ -2824,8 +2819,7 @@ def main(): if options["operation"] != "add": gs.warning( _( - "Flag '{}' is relevant only to" - " 'operation=add'. Ignoring this flag." + "Flag '{}' is relevant only to 'operation=add'. Ignoring this flag." ).format(flag) ) else: diff --git a/scripts/i.in.spotvgt/i.in.spotvgt.py b/scripts/i.in.spotvgt/i.in.spotvgt.py index 9885caea5ec..8e56f5f529b 100755 --- a/scripts/i.in.spotvgt/i.in.spotvgt.py +++ b/scripts/i.in.spotvgt/i.in.spotvgt.py @@ -260,10 +260,7 @@ def main(): gs.message(_("Imported SPOT VEGETATION SM quality map <%s>.") % smfile) gs.message( - _( - "Note: A snow map can be extracted by category " - "252 (d.rast %s cat=252)" - ) + _("Note: A snow map can be extracted by category 252 (d.rast %s cat=252)") % smfile ) gs.message("") diff --git a/scripts/i.spectral/i.spectral.py b/scripts/i.spectral/i.spectral.py index 62f4a3397a3..e275b004f72 100755 --- a/scripts/i.spectral/i.spectral.py +++ b/scripts/i.spectral/i.spectral.py @@ -189,8 +189,7 @@ def draw_linegraph(what): if not found: gcore.fatal( _( - "Supported monitor isn't running. Please launch one of the" - " monitors {}." + "Supported monitor isn't running. Please launch one of the monitors {}." ).format(", ".join(supported_monitors)) ) selected_monitor = gcore.read_command("d.mon", flags="p", quiet=True).replace( diff --git a/scripts/r.fillnulls/r.fillnulls.py b/scripts/r.fillnulls/r.fillnulls.py index b22550db497..0be21133a46 100755 --- a/scripts/r.fillnulls/r.fillnulls.py +++ b/scripts/r.fillnulls/r.fillnulls.py @@ -229,10 +229,7 @@ def main(): ) except CalledModuleError: gs.fatal( - _( - "abandoned. Removing temporary map, restoring " - "user mask if needed:" - ) + _("abandoned. Removing temporary map, restoring user mask if needed:") ) # assign unique IDs to each hole or hole system (holes closer than edge @@ -248,10 +245,7 @@ def main(): ) except CalledModuleError: gs.fatal( - _( - "abandoned. Removing temporary map, restoring " - "user mask if needed:" - ) + _("abandoned. Removing temporary map, restoring user mask if needed:") ) # get a list of unique hole cat's @@ -275,10 +269,7 @@ def main(): ) except CalledModuleError: gs.fatal( - _( - "abandoned. Removing temporary maps, restoring " - "user mask if needed:" - ) + _("abandoned. Removing temporary maps, restoring user mask if needed:") ) tmp_vmaps.append(prefix + "holes") diff --git a/scripts/r.grow/testsuite/test_grow.py b/scripts/r.grow/testsuite/test_grow.py index 80421da2fec..a857d51569a 100644 --- a/scripts/r.grow/testsuite/test_grow.py +++ b/scripts/r.grow/testsuite/test_grow.py @@ -4,7 +4,6 @@ class TestRGrow(TestCase): - @classmethod def setUpClass(cls): """Set up a small region and test map.""" diff --git a/scripts/v.db.droptable/v.db.droptable.py b/scripts/v.db.droptable/v.db.droptable.py index f8bf86dbd30..9cfd46c6233 100755 --- a/scripts/v.db.droptable/v.db.droptable.py +++ b/scripts/v.db.droptable/v.db.droptable.py @@ -72,10 +72,7 @@ def main(): existingtable = f["table"] if existingtable != table: gs.fatal( - _( - "User selected table <%s> but the table <%s> " - "is linked to layer <%s>" - ) + _("User selected table <%s> but the table <%s> is linked to layer <%s>") % (table, existingtable, layer) ) @@ -90,10 +87,7 @@ def main(): if not force: gs.message( - _( - "You must use the -f (force) flag to actually " - "remove the table. Exiting." - ) + _("You must use the -f (force) flag to actually remove the table. Exiting.") ) gs.message(_("Leaving map/table unchanged.")) sys.exit(0) diff --git a/scripts/v.db.reconnect.all/v.db.reconnect.all.py b/scripts/v.db.reconnect.all/v.db.reconnect.all.py index 7a422f47f7f..6026d302909 100755 --- a/scripts/v.db.reconnect.all/v.db.reconnect.all.py +++ b/scripts/v.db.reconnect.all/v.db.reconnect.all.py @@ -99,10 +99,7 @@ def create_db(driver, database): return False gs.info( - _( - "Target database doesn't exist, " - "creating a new database using <%s> driver..." - ) + _("Target database doesn't exist, creating a new database using <%s> driver...") % driver ) try: @@ -308,10 +305,7 @@ def main(): ) except CalledModuleError: gs.warning( - _( - "Unable to connect table <%s> to vector " - "<%s> on layer <%s>" - ) + _("Unable to connect table <%s> to vector <%s> on layer <%s>") % (table, vect, str(layer)) ) diff --git a/scripts/v.dissolve/v_dissolve.ipynb b/scripts/v.dissolve/v_dissolve.ipynb index 9767c1260e2..b3586acf441 100644 --- a/scripts/v.dissolve/v_dissolve.ipynb +++ b/scripts/v.dissolve/v_dissolve.ipynb @@ -165,7 +165,7 @@ "outputs": [], "source": [ "for row in table[\"records\"]:\n", - " print(f'{row[\"NAME\"]:<14} {row[\"num_zip_codes\"]:>2} {row[\"town_area\"]:>12.0f}')" + " print(f\"{row['NAME']:<14} {row['num_zip_codes']:>2} {row['town_area']:>12.0f}\")" ] }, { @@ -278,11 +278,11 @@ " areas_by_zip = zip_records_by_town[town_name]\n", " # Check number ZIP codes.\n", " if len(areas_by_zip) != town_zip_codes:\n", - " msg = f'Incorrect number of zipcodes in town {row[\"NAME\"]}'\n", + " msg = f\"Incorrect number of zipcodes in town {row['NAME']}\"\n", " raise RuntimeError(msg)\n", " # Check total area.\n", " if round(sum(areas_by_zip)) != round(town_area):\n", - " msg = f'Incorrect area for {row[\"NAME\"]}: {sum(areas_by_zip)} != {town_area}'\n", + " msg = f\"Incorrect area for {row['NAME']}: {sum(areas_by_zip)} != {town_area}\"\n", " raise RuntimeError(msg)\n", "print(\"No exceptions. Test passed.\")" ] diff --git a/temporal/t.rast.aggregate.ds/t.rast.aggregate.ds.py b/temporal/t.rast.aggregate.ds/t.rast.aggregate.ds.py index 99aa795d7cc..1a5cbfeea6d 100755 --- a/temporal/t.rast.aggregate.ds/t.rast.aggregate.ds.py +++ b/temporal/t.rast.aggregate.ds/t.rast.aggregate.ds.py @@ -144,10 +144,7 @@ def main(): if sampler_sp.temporal_extent.get_map_time() != "interval": dbif.close() gs.fatal( - _( - "All registered maps of the aggregation dataset " - "must have time intervals" - ) + _("All registered maps of the aggregation dataset must have time intervals") ) # We will create the strds later, but need to check here diff --git a/temporal/t.rast.gapfill/t.rast.gapfill.py b/temporal/t.rast.gapfill/t.rast.gapfill.py index a4d3b3a8c95..986ccd4373d 100755 --- a/temporal/t.rast.gapfill/t.rast.gapfill.py +++ b/temporal/t.rast.gapfill/t.rast.gapfill.py @@ -151,10 +151,7 @@ def main(): if len(map_.get_follows()) > 1: gs.warning( - _( - "More than one predecessor of the gap found. " - "Using the first found." - ) + _("More than one predecessor of the gap found. Using the first found.") ) # Interpolate the maps using parallel processing diff --git a/temporal/t.rast.what/t.rast.what.py b/temporal/t.rast.what/t.rast.what.py index 32a719fa4f5..a4d5af7939d 100755 --- a/temporal/t.rast.what/t.rast.what.py +++ b/temporal/t.rast.what/t.rast.what.py @@ -466,8 +466,7 @@ def one_point_per_col_output( x = row[1] y = row[2] out_str += ( - "{sep}{cat}{csep}{x:10.10f}{csep}" - "{y:10.10f}".format( + "{sep}{cat}{csep}{x:10.10f}{csep}{y:10.10f}".format( cat=cat, x=float(x), y=float(y), diff --git a/utils/create_python_init_file.py b/utils/create_python_init_file.py index 5642bbc2e75..8d045b9924b 100755 --- a/utils/create_python_init_file.py +++ b/utils/create_python_init_file.py @@ -14,7 +14,6 @@ @author Vaclav Petras """ - import os import sys import glob diff --git a/utils/generate_release_notes.py b/utils/generate_release_notes.py index fb3fb7c2813..4ad19fdb060 100755 --- a/utils/generate_release_notes.py +++ b/utils/generate_release_notes.py @@ -138,7 +138,7 @@ def print_support(file=None): random.shuffle(data) supporters = [] for member in data: - supporters.append(f"""[{member['name']}]({member['profile']})""") + supporters.append(f"""[{member["name"]}]({member["profile"]})""") print(", ".join(supporters)) print() diff --git a/vector/v.distance/testsuite/test_v_distance.py b/vector/v.distance/testsuite/test_v_distance.py index 5ebffaf5dc1..98337d40937 100644 --- a/vector/v.distance/testsuite/test_v_distance.py +++ b/vector/v.distance/testsuite/test_v_distance.py @@ -7,7 +7,6 @@ class TestVDistance(TestCase): - def test_json(self): """Test json format""" reference = [ diff --git a/vector/v.out.ogr/testsuite/test_v_out_ogr.py b/vector/v.out.ogr/testsuite/test_v_out_ogr.py index d269ccff606..373ec8e1273 100644 --- a/vector/v.out.ogr/testsuite/test_v_out_ogr.py +++ b/vector/v.out.ogr/testsuite/test_v_out_ogr.py @@ -8,7 +8,6 @@ class TestOgrExport(TestCase): - # Vector map in NC test dataset test_map = "boundary_county" diff --git a/vector/v.random/testsuite/test_v_random.py b/vector/v.random/testsuite/test_v_random.py index 7b68434f46b..52dfc83be8c 100644 --- a/vector/v.random/testsuite/test_v_random.py +++ b/vector/v.random/testsuite/test_v_random.py @@ -9,6 +9,7 @@ License (>=v2). Read the file COPYING that comes with GRASS for details. """ + from grass.gunittest.case import TestCase from grass.gunittest.main import test