".
+ return G_fully_qualified_name("MASK", G_mapset());
+}
+
/**
* @brief Get raster mask status information
*
diff --git a/raster/r.mask.status/main.c b/raster/r.mask.status/main.c
index 16790adf35c..b0a7b9185c0 100644
--- a/raster/r.mask.status/main.c
+++ b/raster/r.mask.status/main.c
@@ -89,7 +89,7 @@ int report_status(struct Parameters *params)
}
// Mask raster
- char *full_mask = G_fully_qualified_name(name, mapset);
+ char *full_mask = Rast_mask_name();
// Underlying raster if applicable
char *full_underlying = NULL;
if (is_mask_reclass)
@@ -99,10 +99,7 @@ int report_status(struct Parameters *params)
JSON_Value *root_value = json_value_init_object();
JSON_Object *root_object = json_object(root_value);
json_object_set_boolean(root_object, "present", present);
- if (present)
- json_object_set_string(root_object, "full_name", full_mask);
- else
- json_object_set_null(root_object, "full_name");
+ json_object_set_string(root_object, "name", full_mask);
if (is_mask_reclass)
json_object_set_string(root_object, "is_reclass_of",
full_underlying);
@@ -121,9 +118,7 @@ int report_status(struct Parameters *params)
printf("1");
else
printf("0");
- printf("\nfull_name=");
- if (present)
- printf("%s", full_mask);
+ printf("\nname=%s", full_mask);
printf("\nis_reclass_of=");
if (is_mask_reclass)
printf("%s", full_underlying);
@@ -135,19 +130,16 @@ int report_status(struct Parameters *params)
printf("true");
else
printf("false");
- printf("\nfull_name: ");
- if (present)
- printf("|-\n %s", full_mask);
- else
- printf("null");
- // Null values in YAML can be an empty (no) value (rather than null),
- // so we could use that, but using the explicit null as a reasonable
- // starting point.
+ printf("\nname: ");
+ printf("|-\n %s", full_mask);
printf("\nis_reclass_of: ");
// Using block scalar with |- to avoid need for escaping.
// Alternatively, we could check mapset naming limits against YAML
// escaping needs for different types of strings and do the necessary
// escaping here.
+ // Null values in YAML can be an empty (no) value (rather than null),
+ // so we could use that, but using the explicit null as a reasonable
+ // starting point.
if (is_mask_reclass)
printf("|-\n %s", full_underlying);
else
@@ -155,14 +147,14 @@ int report_status(struct Parameters *params)
printf("\n");
}
else {
- if (present)
- printf(_("Mask is active"));
- else
- printf(_("Mask is not present"));
if (present) {
- printf("\n");
+ printf(_("Mask is active"));
printf(_("Mask name: %s"), full_mask);
}
+ else {
+ printf(_("Mask is not present"));
+ printf(_("If activated, mask name will be: %s"), full_mask);
+ }
if (is_mask_reclass) {
printf("\n");
printf(_("Mask is a raster reclassified from: %s"),
diff --git a/raster/r.mask.status/r.mask.status.html b/raster/r.mask.status/r.mask.status.html
index 248ee3ea317..cb3897820f5 100644
--- a/raster/r.mask.status/r.mask.status.html
+++ b/raster/r.mask.status/r.mask.status.html
@@ -1,11 +1,21 @@
DESCRIPTION
The r.mask.status reports information about the 2D raster mask and its
-status. If the mask is present, the tool reports a full name of the raster (name
-including the mapset) which represents the mask. It can also report full name of
-the underlying raster if the mask is reclassified from another raster.
-
-
+status. The tool reports whether the mask is present or not. For both active
+and inactive mask, the tool reports a full name of the raster (name including
+the mapset) which represents or would represent the mask.
+It can also report full name of the underlying raster if the mask is
+reclassified from another raster.
+
+The tool can be used to check if the mask is currently set
+(present
boolean in JSON), what is raster name used to represent
+the mask (name
string in JSON), and whether the raster is
+reclassifed from another (is_reclass_of
string or null in JSON).
+YAML and shell script style outputs are following the JSON output if possible.
+The plain text format outputs multi-line human-readable information in natural
+language.
+
+
With the -t flag, no output is printed, instead a return code is used to
indicate presence or absence. The convention is the same same the POSIX
test utility, so r.mask.status returns 0 when the mask is
diff --git a/raster/r.mask.status/tests/r_mask_status_test.py b/raster/r.mask.status/tests/r_mask_status_test.py
index deafdfb145b..a5d406ad581 100644
--- a/raster/r.mask.status/tests/r_mask_status_test.py
+++ b/raster/r.mask.status/tests/r_mask_status_test.py
@@ -15,10 +15,11 @@ def test_json_no_mask(session_no_data):
session = session_no_data
data = gs.parse_command("r.mask.status", format="json", env=session.env)
assert "present" in data
- assert "full_name" in data
+ assert "name" in data
+ assert data["name"], "Mask name needs to be always set"
+ assert data["name"] == "MASK@PERMANENT", "Default mask name and current mapset"
assert "is_reclass_of" in data
assert data["present"] is False
- assert not data["full_name"]
assert not data["is_reclass_of"]
@@ -28,13 +29,13 @@ def test_json_with_r_mask(session_with_data):
gs.run_command("r.mask", raster="a", env=session.env)
data = gs.parse_command("r.mask.status", format="json", env=session.env)
assert data["present"] is True
- assert data["full_name"] == "MASK@PERMANENT"
+ assert data["name"] == "MASK@PERMANENT"
assert data["is_reclass_of"] == "a@PERMANENT"
# Now remove the mask.
gs.run_command("r.mask", flags="r", env=session.env)
data = gs.parse_command("r.mask.status", format="json", env=session.env)
assert data["present"] is False
- assert not data["full_name"]
+ assert data["name"] == "MASK@PERMANENT"
assert not data["is_reclass_of"]
@@ -44,13 +45,13 @@ def test_json_with_g_copy(session_with_data):
gs.run_command("g.copy", raster="a,MASK", env=session.env)
data = gs.parse_command("r.mask.status", format="json", env=session.env)
assert data["present"] is True
- assert data["full_name"] == "MASK@PERMANENT"
+ assert data["name"] == "MASK@PERMANENT"
assert not data["is_reclass_of"]
# Now remove the mask.
gs.run_command("g.remove", type="raster", name="MASK", flags="f", env=session.env)
data = gs.parse_command("r.mask.status", format="json", env=session.env)
assert data["present"] is False
- assert not data["full_name"]
+ assert data["name"] == "MASK@PERMANENT"
assert not data["is_reclass_of"]
@@ -60,13 +61,13 @@ def test_shell(session_with_data):
gs.run_command("r.mask", raster="a", env=session.env)
data = gs.parse_command("r.mask.status", format="shell", env=session.env)
assert int(data["present"])
- assert data["full_name"] == "MASK@PERMANENT"
+ assert data["name"] == "MASK@PERMANENT"
assert data["is_reclass_of"] == "a@PERMANENT"
# Now remove the mask.
gs.run_command("r.mask", flags="r", env=session.env)
data = gs.parse_command("r.mask.status", format="shell", env=session.env)
assert not int(data["present"])
- assert not data["full_name"]
+ assert data["name"] == "MASK@PERMANENT"
assert not data["is_reclass_of"]
@@ -78,14 +79,14 @@ def test_yaml(session_with_data):
text = gs.read_command("r.mask.status", format="yaml", env=session.env)
data = yaml.safe_load(text)
assert data["present"] is True
- assert data["full_name"] == "MASK@PERMANENT"
+ assert data["name"] == "MASK@PERMANENT"
assert data["is_reclass_of"] == "a@PERMANENT"
# Now remove the mask.
gs.run_command("r.mask", flags="r", env=session.env)
text = gs.read_command("r.mask.status", format="yaml", env=session.env)
data = yaml.safe_load(text)
assert data["present"] is False
- assert not data["full_name"]
+ assert data["name"] == "MASK@PERMANENT"
assert not data["is_reclass_of"]
@@ -101,6 +102,8 @@ def test_plain(session_with_data):
gs.run_command("r.mask", flags="r", env=session.env)
text = gs.read_command("r.mask.status", format="plain", env=session.env)
assert text
+ assert "MASK@PERMANENT" in text
+ assert "a@PERMANENT" not in text
def test_without_parameters(session_no_data):
From f9f01e1e40ab9eb8a28fd91717178935946e6606 Mon Sep 17 00:00:00 2001
From: Stefan Blumentrath
Date: Thu, 31 Oct 2024 20:23:21 +0100
Subject: [PATCH 17/25] r.buildvrt: document performance issues with external
data (#4441)
* document performance issue
* address code review
* Apply suggestions from code review
Co-authored-by: Markus Neteler
* consistent recommendation
* remove leftover dot
---------
Co-authored-by: Markus Neteler
---
raster/r.buildvrt/r.buildvrt.html | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/raster/r.buildvrt/r.buildvrt.html b/raster/r.buildvrt/r.buildvrt.html
index 67368179efb..d5118ba5150 100644
--- a/raster/r.buildvrt/r.buildvrt.html
+++ b/raster/r.buildvrt/r.buildvrt.html
@@ -12,6 +12,8 @@ NOTES
the original raster maps which is only valid if the original raster
maps remain in the originally indicated mapset. A VRT can also be built
from raster maps registered with r.external.
+However, GRASS VRTs built from external registered data (see below)
+are known to have performance issues.
Reading the whole VRT is slower than reading the equivalent single
@@ -48,12 +50,23 @@
VRT from a DEM in the North Carolina sample dataset
r.buildvrt file=tilelist.csv output=elev_state_50m_vrt
+KNOWN ISSUES
+
+Users may experience significant performance degradation with virtual rasters built
+with r.buildvrt over GDAL-linked (r.external) raster maps,
+especially on slower file systems with latency like NFS. Performance degradation
+may also occur on local file systems, but is usually less severe. For such use cases
+consider using the GRASS GIS addon
+r.buildvrt.gdal
+or building GDAL VRTs, e.g. with gdalbuildvrt.
+
SEE ALSO
r.tile,
r.patch,
r.external
+r.buildvrt.gdal
From d5a87229ae30cf04ff90f7cfcdc923ec0afa5a36 Mon Sep 17 00:00:00 2001
From: Arohan Ajit
Date: Thu, 31 Oct 2024 16:12:20 -0400
Subject: [PATCH 18/25] db.out.ogr: Removed unused variable (#4617)
---
.flake8 | 2 +-
scripts/db.out.ogr/db.out.ogr.py | 1 -
2 files changed, 1 insertion(+), 2 deletions(-)
diff --git a/.flake8 b/.flake8
index 3adda73f281..33920703ca6 100644
--- a/.flake8
+++ b/.flake8
@@ -94,7 +94,7 @@ per-file-ignores =
scripts/r.semantic.label/r.semantic.label.py: E501
scripts/db.out.ogr/db.out.ogr.py: F841
scripts/g.extension/g.extension.py: E501
- scripts/v.unpack/v.unpack.py: E501
+ scripts/v.unpack/v.unpack.py: E501n
scripts/v.import/v.import.py: E501
scripts/db.univar/db.univar.py: E501
scripts/i.pansharpen/i.pansharpen.py: E501
diff --git a/scripts/db.out.ogr/db.out.ogr.py b/scripts/db.out.ogr/db.out.ogr.py
index 4fdfed23648..4fe5b4f9854 100755
--- a/scripts/db.out.ogr/db.out.ogr.py
+++ b/scripts/db.out.ogr/db.out.ogr.py
@@ -67,7 +67,6 @@ def main():
layer = options["layer"]
format = options["format"]
output = options["output"]
- table = options["table"]
if format.lower() == "dbf":
format = "ESRI_Shapefile"
From 5b9b46a0cb1606ea7fd0c69d5145ce879b9a6c31 Mon Sep 17 00:00:00 2001
From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com>
Date: Thu, 31 Oct 2024 20:37:29 +0000
Subject: [PATCH 19/25] CI(deps): Update softprops/action-gh-release action to
v2.0.9 (#4624)
---
.github/workflows/create_release_draft.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.github/workflows/create_release_draft.yml b/.github/workflows/create_release_draft.yml
index efefb0fd0c7..fb71e35d2ff 100644
--- a/.github/workflows/create_release_draft.yml
+++ b/.github/workflows/create_release_draft.yml
@@ -73,7 +73,7 @@ jobs:
sha256sum ${{ env.GRASS }}.tar.xz > ${{ env.GRASS }}.tar.xz.sha256
- name: Publish draft distribution to GitHub (for tags only)
if: startsWith(github.ref, 'refs/tags/')
- uses: softprops/action-gh-release@c062e08bd532815e2082a85e87e3ef29c3e6d191 # v2.0.8
+ uses: softprops/action-gh-release@e7a8f85e1c67a31e6ed99a94b41bd0b71bbee6b8 # v2.0.9
with:
name: GRASS GIS ${{ github.ref_name }}
body: |
From 3f0b69fdf56879fcd35d36da51c0227765948dca Mon Sep 17 00:00:00 2001
From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com>
Date: Thu, 31 Oct 2024 17:23:31 -0400
Subject: [PATCH 20/25] CI(deps): Update docker/dockerfile Docker tag to v1.11
(#4621)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
---
Dockerfile | 2 +-
docker/ubuntu/Dockerfile | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/Dockerfile b/Dockerfile
index a5c6ab1ee1d..6b928fb46c9 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,4 +1,4 @@
-# syntax=docker/dockerfile:1.10@sha256:865e5dd094beca432e8c0a1d5e1c465db5f998dca4e439981029b3b81fb39ed5
+# syntax=docker/dockerfile:1.11@sha256:1f2be5a2aa052cbd9aedf893d17c63277c3d1c51b3fb0f3b029c6b34f658d057
# Note: This file must be kept in sync in ./Dockerfile and ./docker/ubuntu/Dockerfile.
# Changes to this file must be copied over to the other file.
diff --git a/docker/ubuntu/Dockerfile b/docker/ubuntu/Dockerfile
index a5c6ab1ee1d..6b928fb46c9 100644
--- a/docker/ubuntu/Dockerfile
+++ b/docker/ubuntu/Dockerfile
@@ -1,4 +1,4 @@
-# syntax=docker/dockerfile:1.10@sha256:865e5dd094beca432e8c0a1d5e1c465db5f998dca4e439981029b3b81fb39ed5
+# syntax=docker/dockerfile:1.11@sha256:1f2be5a2aa052cbd9aedf893d17c63277c3d1c51b3fb0f3b029c6b34f658d057
# Note: This file must be kept in sync in ./Dockerfile and ./docker/ubuntu/Dockerfile.
# Changes to this file must be copied over to the other file.
From 7d9bbac1f28a6e5f093e4bac55f6b0d6c7227272 Mon Sep 17 00:00:00 2001
From: Arohan Ajit
Date: Thu, 31 Oct 2024 22:18:23 -0400
Subject: [PATCH 21/25] r.in.wms: Removed bare 'except' and repositioned
imports (#4622)
---
.flake8 | 3 ---
scripts/r.in.wms/srs.py | 2 +-
scripts/r.in.wms/wms_drv.py | 23 ++++++++++-------------
scripts/r.in.wms/wms_gdal_drv.py | 2 +-
4 files changed, 12 insertions(+), 18 deletions(-)
diff --git a/.flake8 b/.flake8
index 33920703ca6..ab4038e4749 100644
--- a/.flake8
+++ b/.flake8
@@ -88,9 +88,6 @@ per-file-ignores =
python/grass/*/*/__init__.py: F403
python/grass/*/*/*/__init__.py: F403
# E402 module level import not at top of file
- scripts/r.in.wms/wms_gdal_drv.py: E722
- scripts/r.in.wms/wms_drv.py: E402, E722
- scripts/r.in.wms/srs.py: E722
scripts/r.semantic.label/r.semantic.label.py: E501
scripts/db.out.ogr/db.out.ogr.py: F841
scripts/g.extension/g.extension.py: E501
diff --git a/scripts/r.in.wms/srs.py b/scripts/r.in.wms/srs.py
index 8d996fcde94..752f71d8151 100644
--- a/scripts/r.in.wms/srs.py
+++ b/scripts/r.in.wms/srs.py
@@ -79,7 +79,7 @@ def __init__(self, srs):
# code is always the last value
try:
self.code = int(values[-1])
- except:
+ except (IndexError, ValueError):
self.code = values[-1]
elif len(values) == 2: # it's an authority:code code
diff --git a/scripts/r.in.wms/wms_drv.py b/scripts/r.in.wms/wms_drv.py
index e825aabe438..f9dc42d2383 100644
--- a/scripts/r.in.wms/wms_drv.py
+++ b/scripts/r.in.wms/wms_drv.py
@@ -18,13 +18,13 @@
"""
import socket
-import grass.script as gs
-
from time import sleep
+import grass.script as gs
+
try:
from osgeo import gdal
-except:
+except ImportError:
gs.fatal(
_(
"Unable to load GDAL Python bindings (requires package 'python-gdal' "
@@ -32,21 +32,18 @@
)
)
-import numpy as np
-
-np.arrayrange = np.arange
-
-from math import pi, floor
-
-from urllib.error import HTTPError
from http.client import HTTPException
-
+from math import floor, pi
+from urllib.error import HTTPError
from xml.etree.ElementTree import ParseError
-from wms_base import GetEpsg, GetSRSParamVal, WMSBase
+import numpy as np
-from wms_cap_parsers import WMTSCapabilitiesTree, OnEarthCapabilitiesTree
from srs import Srs
+from wms_base import GetEpsg, GetSRSParamVal, WMSBase
+from wms_cap_parsers import OnEarthCapabilitiesTree, WMTSCapabilitiesTree
+
+np.arrayrange = np.arange
class WMSDrv(WMSBase):
diff --git a/scripts/r.in.wms/wms_gdal_drv.py b/scripts/r.in.wms/wms_gdal_drv.py
index 830be2b593e..869f71195a2 100644
--- a/scripts/r.in.wms/wms_gdal_drv.py
+++ b/scripts/r.in.wms/wms_gdal_drv.py
@@ -17,7 +17,7 @@
try:
from osgeo import gdal
-except:
+except ImportError:
gs.fatal(
_(
"Unable to load GDAL Python bindings (requires package 'python-gdal' being "
From 4385b2650bcc5432080b29756c855ba0a05d6036 Mon Sep 17 00:00:00 2001
From: Michael Barton
Date: Thu, 31 Oct 2024 21:26:09 -0500
Subject: [PATCH 22/25] lib: Add new SRTM_percent color table (#4608)
This color table uses the color ramp from the srtm_plus color table for terrain to create colors for relative elevation (spread over the range of elevations in a raster map) rather than absolute elevation in meters. This applies srtm colors in a way similar to the way the elevation color table applies them. This color table is especially useful in creating nice looking elevation maps and shading relief maps.
---
lib/gis/colors.desc | 1 +
lib/gis/colors/srtm_percent | 7 +++++++
2 files changed, 8 insertions(+)
create mode 100644 lib/gis/colors/srtm_percent
diff --git a/lib/gis/colors.desc b/lib/gis/colors.desc
index 673c0db8f91..c501e00c93b 100644
--- a/lib/gis/colors.desc
+++ b/lib/gis/colors.desc
@@ -48,6 +48,7 @@ sepia: yellowish-brown through to white
slope: r.slope.aspect-type slope colors for raster values 0-90
soilmoisture: soilmoisture color table (0.0-1.0)
srtm: color palette for Shuttle Radar Topography Mission elevation
+srtm_percent: color palette for Shuttle Radar Topography Mission using relative elevation
srtm_plus: color palette for Shuttle Radar Topography Mission elevation (with seafloor colors)
terrain: global elevation color table covering -11000 to +8850m
viridis: perceptually uniform sequential color table viridis
diff --git a/lib/gis/colors/srtm_percent b/lib/gis/colors/srtm_percent
new file mode 100644
index 00000000000..a8e0d857f76
--- /dev/null
+++ b/lib/gis/colors/srtm_percent
@@ -0,0 +1,7 @@
+0% 57 151 105
+25% 117 194 93
+40% 230 230 128
+55% 214 187 98
+70% 185 154 100
+80% 150 120 80
+100% 220 220 220
From 4964f451589a1428c48112f8e9349450e1e2edb0 Mon Sep 17 00:00:00 2001
From: Arohan Ajit
Date: Fri, 1 Nov 2024 11:54:21 -0400
Subject: [PATCH 23/25] r.in.wms: Replace long-deprecated `np.arrayrange` alias
with `np.arange` (#4629)
---
scripts/r.in.wms/wms_drv.py | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/scripts/r.in.wms/wms_drv.py b/scripts/r.in.wms/wms_drv.py
index f9dc42d2383..f5e8cbeb914 100644
--- a/scripts/r.in.wms/wms_drv.py
+++ b/scripts/r.in.wms/wms_drv.py
@@ -43,8 +43,6 @@
from wms_base import GetEpsg, GetSRSParamVal, WMSBase
from wms_cap_parsers import OnEarthCapabilitiesTree, WMTSCapabilitiesTree
-np.arrayrange = np.arange
-
class WMSDrv(WMSBase):
def _download(self):
@@ -288,9 +286,9 @@ def _pct2rgb(self, src_filename, dst_filename):
# Build color table
lookup = [
- np.arrayrange(256),
- np.arrayrange(256),
- np.arrayrange(256),
+ np.arange(256),
+ np.arange(256),
+ np.arange(256),
np.ones(256) * 255,
]
From cb3d12b490528b595729589e373887bc5a5923a6 Mon Sep 17 00:00:00 2001
From: Vaclav Petras
Date: Fri, 1 Nov 2024 17:23:39 -0400
Subject: [PATCH 24/25] grass.script: Pass environment to message functions
(#4630)
While the message functions (fatal, warning, message, info, debug, verbose, percent) have env parameter, grass.script was not consistently passing the env parameter to these functions. This fixes all the clear cases in functions which themselves have env (but does not touch any which don't have it where the fix needs to be more complex).
These functions can now be called and produce these messages even for non-global sessions.
---
python/grass/script/core.py | 10 ++++++----
python/grass/script/db.py | 7 ++++---
python/grass/script/raster.py | 8 ++++++--
python/grass/script/raster3d.py | 5 ++++-
python/grass/script/vector.py | 9 +++++----
5 files changed, 25 insertions(+), 14 deletions(-)
diff --git a/python/grass/script/core.py b/python/grass/script/core.py
index f51814a5900..e6de4331b43 100644
--- a/python/grass/script/core.py
+++ b/python/grass/script/core.py
@@ -1447,7 +1447,7 @@ def list_strings(type, pattern=None, mapset=None, exclude=None, flag="", env=Non
:return: list of elements
"""
if type == "cell":
- verbose(_('Element type should be "raster" and not "%s"') % type)
+ verbose(_('Element type should be "raster" and not "%s"') % type, env=env)
result = []
for line in read_command(
@@ -1520,7 +1520,9 @@ def list_grouped(
flag += "t"
for i in range(len(types)):
if types[i] == "cell":
- verbose(_('Element type should be "raster" and not "%s"') % types[i])
+ verbose(
+ _('Element type should be "raster" and not "%s"') % types[i], env=env
+ )
types[i] = "raster"
result = {}
if check_search_path:
@@ -1543,7 +1545,7 @@ def list_grouped(
try:
name, mapset = line.split("@")
except ValueError:
- warning(_("Invalid element '%s'") % line)
+ warning(_("Invalid element '%s'") % line, env=env)
continue
if store_types:
@@ -1701,7 +1703,7 @@ def mapsets(search_path=False, env=None):
flags = "p" if search_path else "l"
mapsets = read_command("g.mapsets", flags=flags, sep="newline", quiet=True, env=env)
if not mapsets:
- fatal(_("Unable to list mapsets"))
+ fatal(_("Unable to list mapsets"), env=env)
return mapsets.splitlines()
diff --git a/python/grass/script/db.py b/python/grass/script/db.py
index 60813379501..5591b92d4ca 100644
--- a/python/grass/script/db.py
+++ b/python/grass/script/db.py
@@ -55,7 +55,7 @@ def db_describe(table, env=None, **args):
args.pop("driver")
s = read_command("db.describe", flags="c", table=table, env=env, **args)
if not s:
- fatal(_("Unable to describe table <%s>") % table)
+ fatal(_("Unable to describe table <%s>") % table, env=env)
cols = []
result = {}
@@ -179,7 +179,8 @@ def db_select(sql=None, filename=None, table=None, env=None, **args):
"Programmer error: '%(sql)s', '%(filename)s', or '%(table)s' must be \
provided"
)
- % {"sql": "sql", "filename": "filename", "table": "table"}
+ % {"sql": "sql", "filename": "filename", "table": "table"},
+ env=env,
)
if "sep" not in args:
@@ -188,7 +189,7 @@ def db_select(sql=None, filename=None, table=None, env=None, **args):
try:
run_command("db.select", quiet=True, flags="c", output=fname, env=env, **args)
except CalledModuleError:
- fatal(_("Fetching data failed"))
+ fatal(_("Fetching data failed"), env=env)
ofile = open(fname)
result = [tuple(x.rstrip(os.linesep).split(args["sep"])) for x in ofile]
diff --git a/python/grass/script/raster.py b/python/grass/script/raster.py
index d82780d7c5c..aaf9e0179b0 100644
--- a/python/grass/script/raster.py
+++ b/python/grass/script/raster.py
@@ -66,7 +66,8 @@ def raster_history(map, overwrite=False, env=None):
"Unable to write history for <%(map)s>. "
"Raster map <%(map)s> not found in current mapset."
)
- % {"map": map}
+ % {"map": map},
+ env=env,
)
return False
@@ -143,7 +144,10 @@ def mapcalc(
overwrite=overwrite,
)
except CalledModuleError:
- fatal(_("An error occurred while running r.mapcalc with expression: %s") % e)
+ fatal(
+ _("An error occurred while running r.mapcalc with expression: %s") % e,
+ env=env,
+ )
def mapcalc_start(
diff --git a/python/grass/script/raster3d.py b/python/grass/script/raster3d.py
index e3db5398158..1a4a2782984 100644
--- a/python/grass/script/raster3d.py
+++ b/python/grass/script/raster3d.py
@@ -108,4 +108,7 @@ def mapcalc3d(
overwrite=overwrite,
)
except CalledModuleError:
- fatal(_("An error occurred while running r3.mapcalc with expression: %s") % e)
+ fatal(
+ _("An error occurred while running r3.mapcalc with expression: %s") % e,
+ env=env,
+ )
diff --git a/python/grass/script/vector.py b/python/grass/script/vector.py
index 2d484f7d590..4adf3e38da1 100644
--- a/python/grass/script/vector.py
+++ b/python/grass/script/vector.py
@@ -87,7 +87,7 @@ def vector_layer_db(map, layer, env=None):
try:
f = vector_db(map, env=env)[int(layer)]
except KeyError:
- fatal(_("Database connection not defined for layer %s") % layer)
+ fatal(_("Database connection not defined for layer %s") % layer, env=env)
return f
@@ -250,7 +250,8 @@ def vector_db_select(map, layer=1, env=None, **kwargs):
except KeyError:
error(
_("Missing layer %(layer)d in vector map <%(map)s>")
- % {"layer": layer, "map": map}
+ % {"layer": layer, "map": map},
+ env=env,
)
return {"columns": [], "values": {}}
@@ -259,13 +260,13 @@ def vector_db_select(map, layer=1, env=None, **kwargs):
if key not in kwargs["columns"].split(","):
# add key column if missing
include_key = False
- debug("Adding key column to the output")
+ debug("Adding key column to the output", env=env)
kwargs["columns"] += "," + key
ret = read_command("v.db.select", map=map, layer=layer, env=env, **kwargs)
if not ret:
- error(_("vector_db_select() failed"))
+ error(_("vector_db_select() failed"), env=env)
return {"columns": [], "values": {}}
columns = []
From 0824e8842edde3af2588d3865d12ba67493666f0 Mon Sep 17 00:00:00 2001
From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com>
Date: Sat, 2 Nov 2024 01:16:45 +0000
Subject: [PATCH 25/25] CI(deps): Update ruff to v0.7.2 (#4631)
---
.github/workflows/python-code-quality.yml | 2 +-
.pre-commit-config.yaml | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/.github/workflows/python-code-quality.yml b/.github/workflows/python-code-quality.yml
index aa6bd33724f..f7f741a7bb1 100644
--- a/.github/workflows/python-code-quality.yml
+++ b/.github/workflows/python-code-quality.yml
@@ -36,7 +36,7 @@ jobs:
# renovate: datasource=pypi depName=bandit
BANDIT_VERSION: "1.7.10"
# renovate: datasource=pypi depName=ruff
- RUFF_VERSION: "0.7.1"
+ RUFF_VERSION: "0.7.2"
runs-on: ${{ matrix.os }}
permissions:
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 2f3216877de..fd6d6c67f50 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -37,7 +37,7 @@ repos:
)
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
- rev: v0.7.1
+ rev: v0.7.2
hooks:
# Run the linter.
- id: ruff