From c5c42cf440cd037976beb58eb9cd1b9cc23ccb3e Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 23 Oct 2024 12:22:19 +0000 Subject: [PATCH 01/50] CI(deps): Update github/codeql-action action to v3.27.0 (#4575) --- .github/workflows/codeql-analysis.yml | 4 ++-- .github/workflows/python-code-quality.yml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 6672287794c..97f89578306 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -56,7 +56,7 @@ jobs: if: ${{ matrix.language == 'c-cpp' }} - name: Initialize CodeQL - uses: github/codeql-action/init@f779452ac5af1c261dce0346a8f964149f49322b # v3.26.13 + uses: github/codeql-action/init@662472033e021d55d94146f66f6058822b0b39fd # v3.27.0 with: languages: ${{ matrix.language }} config-file: ./.github/codeql/codeql-config.yml @@ -81,6 +81,6 @@ jobs: run: .github/workflows/build_ubuntu-22.04.sh "${HOME}/install" - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@f779452ac5af1c261dce0346a8f964149f49322b # v3.26.13 + uses: github/codeql-action/analyze@662472033e021d55d94146f66f6058822b0b39fd # v3.27.0 with: category: "/language:${{matrix.language}}" diff --git a/.github/workflows/python-code-quality.yml b/.github/workflows/python-code-quality.yml index 9f71c28e922..15357764d6a 100644 --- a/.github/workflows/python-code-quality.yml +++ b/.github/workflows/python-code-quality.yml @@ -135,7 +135,7 @@ jobs: path: bandit.sarif - name: Upload SARIF File into Security Tab - uses: github/codeql-action/upload-sarif@f779452ac5af1c261dce0346a8f964149f49322b # v3.26.13 + uses: github/codeql-action/upload-sarif@662472033e021d55d94146f66f6058822b0b39fd # v3.27.0 with: sarif_file: bandit.sarif From 25757837f282466a31062335ef2d99d0879fb148 Mon Sep 17 00:00:00 2001 From: Arohan Ajit Date: Wed, 23 Oct 2024 08:31:02 -0400 Subject: [PATCH 02/50] wxGUI: Fixed F841 in photo2image/ (#4573) * fixed 841 * fixed busyInfo --- .flake8 | 4 +- gui/wxpython/photo2image/g.gui.photo2image.py | 2 +- gui/wxpython/photo2image/ip2i_manager.py | 56 ++++++++----------- gui/wxpython/photo2image/ip2i_mapdisplay.py | 2 - 4 files changed, 27 insertions(+), 37 deletions(-) diff --git a/.flake8 b/.flake8 index ffa7d162eda..14224a97843 100644 --- a/.flake8 +++ b/.flake8 @@ -25,8 +25,8 @@ per-file-ignores = gui/scripts/d.wms.py: E501 gui/wxpython/image2target/g.gui.image2target.py: E501 gui/wxpython/nviz/*: E722 - gui/wxpython/photo2image/*: F841, E722, E265 - gui/wxpython/photo2image/g.gui.photo2image.py: E501, F841 + gui/wxpython/photo2image/*: E722 + gui/wxpython/photo2image/g.gui.photo2image.py: E501 gui/wxpython/psmap/*: F841, E266, E722 gui/wxpython/vdigit/*: F841, E722, F405, F403 gui/wxpython/animation/g.gui.animation.py: E501 diff --git a/gui/wxpython/photo2image/g.gui.photo2image.py b/gui/wxpython/photo2image/g.gui.photo2image.py index 65b4141873e..fe153b236cc 100755 --- a/gui/wxpython/photo2image/g.gui.photo2image.py +++ b/gui/wxpython/photo2image/g.gui.photo2image.py @@ -121,7 +121,7 @@ def main(): app = wx.App() - wizard = GCPWizard( + GCPWizard( parent=None, giface=StandaloneGrassInterface(), group=group, diff --git a/gui/wxpython/photo2image/ip2i_manager.py b/gui/wxpython/photo2image/ip2i_manager.py index 5a2a1f14f21..711ec4191af 100644 --- a/gui/wxpython/photo2image/ip2i_manager.py +++ b/gui/wxpython/photo2image/ip2i_manager.py @@ -1107,22 +1107,20 @@ def OnGeorect(self, event): else: flags = "a" - busy = wx.BusyInfo(_("Rectifying images, please wait..."), parent=self) - wx.GetApp().Yield() + with wx.BusyInfo(_("Rectifying images, please wait..."), parent=self): + wx.GetApp().Yield() - ret, msg = RunCommand( - "i.rectify", - parent=self, - getErrorMsg=True, - quiet=True, - group=self.xygroup, - extension=self.extension, - order=self.gr_order, - method=self.gr_method, - flags=flags, - ) - - del busy + ret, msg = RunCommand( + "i.rectify", + parent=self, + getErrorMsg=True, + quiet=True, + group=self.xygroup, + extension=self.extension, + order=self.gr_order, + method=self.gr_method, + flags=flags, + ) # provide feedback on failure if ret != 0: @@ -1130,21 +1128,19 @@ def OnGeorect(self, event): print(self.grwiz.src_map, file=sys.stderr) print(msg, file=sys.stderr) - busy = wx.BusyInfo( + with wx.BusyInfo( _("Writing output image to group, please wait..."), parent=self - ) - wx.GetApp().Yield() - - ret1, msg1 = RunCommand( - "i.group", - parent=self, - getErrorMsg=True, - quiet=False, - group=self.xygroup, - input="".join([self.grwiz.src_map.split("@")[0], self.extension]), - ) + ): + wx.GetApp().Yield() - del busy + ret1, msg1 = RunCommand( + "i.group", + parent=self, + getErrorMsg=True, + quiet=False, + group=self.xygroup, + input="".join([self.grwiz.src_map.split("@")[0], self.extension]), + ) if ret1 != 0: print("ip2i: Error in i.group", file=sys.stderr) @@ -1253,7 +1249,6 @@ def OnGROrder(self, event): elif self.gr_order == 2: minNumOfItems = 6 - diff = 6 - numOfItems # self.SetStatusText(_( # "Insufficient points, 6+ points needed for 2nd order")) @@ -1556,7 +1551,6 @@ def OnZoomToTarget(self, event): def OnZoomMenuGCP(self, event): """Popup Zoom menu""" - point = wx.GetMousePosition() zoommenu = Menu() # Add items to the menu @@ -2467,7 +2461,6 @@ def UpdateSettings(self): srcrender = False tgtrender = False - reload_target = False if self.new_src_map != src_map: # remove old layer layers = self.parent.grwiz.SrcMap.GetListOfLayers() @@ -2499,7 +2492,6 @@ def UpdateSettings(self): del layers[0] layers = self.parent.grwiz.TgtMap.GetListOfLayers() # self.parent.grwiz.TgtMap.DeleteAllLayers() - reload_target = True tgt_map["raster"] = self.new_tgt_map["raster"] if tgt_map["raster"] != "": diff --git a/gui/wxpython/photo2image/ip2i_mapdisplay.py b/gui/wxpython/photo2image/ip2i_mapdisplay.py index aa085f2b43a..732716a1a0c 100644 --- a/gui/wxpython/photo2image/ip2i_mapdisplay.py +++ b/gui/wxpython/photo2image/ip2i_mapdisplay.py @@ -466,7 +466,6 @@ def PrintMenu(self, event): """ Print options and output menu for map display """ - point = wx.GetMousePosition() printmenu = Menu() # Add items to the menu setup = wx.MenuItem(printmenu, wx.ID_ANY, _("Page setup")) @@ -510,7 +509,6 @@ def SaveDisplayRegion(self, event): def OnZoomMenu(self, event): """Popup Zoom menu""" - point = wx.GetMousePosition() zoommenu = Menu() # Add items to the menu From a05ed293ec9af66daa61f493e62611a6f179d2af Mon Sep 17 00:00:00 2001 From: Mohan Yelugoti Date: Wed, 23 Oct 2024 08:48:45 -0400 Subject: [PATCH 03/50] lib/db: Remove deprecated implementation of db_get_login() and replace it with that of db_get_login2() (#4302) `db_get_login()` is deprecated in 7.8.0 release with da399c52637ee5c81228459fa374a114c8fef06c. Change its function signature and implementation to match that of the currently preferred `db_get_login2()`. Technically, this is removing the old function and introducing a new one with the same name, but a different signature. Modify `db_get_login2()` to internally call `db_get_login()` function call. In the next major version, `db_get_login2()` should be removed to have only one method to get login details for simplicity. See also #4308. --------- Signed-off-by: Mohan Yelugoti --- db/drivers/mysql/db.c | 2 +- db/drivers/postgres/db.c | 4 ++-- db/drivers/postgres/listdb.c | 2 +- include/grass/defs/dbmi.h | 3 ++- lib/db/dbmi_base/connect.c | 10 +++++----- lib/db/dbmi_base/login.c | 16 +++++++--------- lib/vector/Vlib/open_pg.c | 4 ++-- vector/v.external/dsn.c | 2 +- vector/v.in.ogr/dsn.c | 2 +- vector/v.out.ogr/dsn.c | 2 +- 10 files changed, 23 insertions(+), 24 deletions(-) diff --git a/db/drivers/mysql/db.c b/db/drivers/mysql/db.c index 5c98c652e95..b83d3d7064d 100644 --- a/db/drivers/mysql/db.c +++ b/db/drivers/mysql/db.c @@ -51,7 +51,7 @@ int db__driver_open_database(dbHandle *handle) connpar.host, connpar.port, connpar.dbname, connpar.user, connpar.password); - db_get_login2("mysql", name, &user, &password, &host, &port); + db_get_login("mysql", name, &user, &password, &host, &port); connection = mysql_init(NULL); res = diff --git a/db/drivers/postgres/db.c b/db/drivers/postgres/db.c index 5343acf03d8..aa27d370419 100644 --- a/db/drivers/postgres/db.c +++ b/db/drivers/postgres/db.c @@ -54,7 +54,7 @@ int db__driver_open_database(dbHandle *handle) return DB_FAILED; } - db_get_login2("pg", name, &user, &password, &host, &port); + db_get_login("pg", name, &user, &password, &host, &port); pg_conn = PQsetdbLogin(host, port, pgconn.options, pgconn.tty, pgconn.dbname, user, password); @@ -241,7 +241,7 @@ int create_delete_db(dbHandle *handle, int create) pgconn.host, pgconn.port, pgconn.options, pgconn.tty, pgconn.dbname, pgconn.user, pgconn.password, pgconn.host, pgconn.port, pgconn.schema); - db_get_login2("pg", template_db, &user, &password, &host, &port); + db_get_login("pg", template_db, &user, &password, &host, &port); pg_conn = PQsetdbLogin(host, port, pgconn.options, pgconn.tty, pgconn.dbname, user, password); diff --git a/db/drivers/postgres/listdb.c b/db/drivers/postgres/listdb.c index 0efa0328c0f..974141f1e36 100644 --- a/db/drivers/postgres/listdb.c +++ b/db/drivers/postgres/listdb.c @@ -48,7 +48,7 @@ int db__driver_list_databases(dbString *dbpath, int npaths, dbHandle **dblist, pgconn.dbname, pgconn.user, pgconn.password, pgconn.host, pgconn.port, pgconn.options, pgconn.tty); - db_get_login2("pg", NULL, &user, &passwd, &host, &port); + db_get_login("pg", NULL, &user, &passwd, &host, &port); G_debug(1, "user = %s, passwd = %s", user, passwd ? "xxx" : ""); if (user || passwd) { diff --git a/include/grass/defs/dbmi.h b/include/grass/defs/dbmi.h index c5bf648414f..0eca1858489 100644 --- a/include/grass/defs/dbmi.h +++ b/include/grass/defs/dbmi.h @@ -389,7 +389,8 @@ unsigned int db_sizeof_string(const dbString *); int db_set_login(const char *, const char *, const char *, const char *); int db_set_login2(const char *, const char *, const char *, const char *, const char *, const char *, int); -int db_get_login(const char *, const char *, const char **, const char **); +int db_get_login(const char *, const char *, const char **, const char **, + const char **, const char **); int db_get_login2(const char *, const char *, const char **, const char **, const char **, const char **); int db_get_login_dump(FILE *); diff --git a/lib/db/dbmi_base/connect.c b/lib/db/dbmi_base/connect.c index 780d929dd3a..ced282405bd 100644 --- a/lib/db/dbmi_base/connect.c +++ b/lib/db/dbmi_base/connect.c @@ -87,11 +87,11 @@ int db_get_connection(dbConnection *connection) connection->group = (char *)G_getenv_nofatal2("DB_GROUP", G_VAR_MAPSET); /* try to get user/password */ - db_get_login2(connection->driverName, connection->databaseName, - (const char **)&(connection->user), - (const char **)&(connection->password), - (const char **)&(connection->hostName), - (const char **)&(connection->port)); + db_get_login(connection->driverName, connection->databaseName, + (const char **)&(connection->user), + (const char **)&(connection->password), + (const char **)&(connection->hostName), + (const char **)&(connection->port)); return DB_OK; } diff --git a/lib/db/dbmi_base/login.c b/lib/db/dbmi_base/login.c index d79fc84e6cf..bc84f78118c 100644 --- a/lib/db/dbmi_base/login.c +++ b/lib/db/dbmi_base/login.c @@ -346,22 +346,20 @@ static int get_login(const char *driver, const char *database, If driver/database is not found, output arguments are set to NULL. - \deprecated Use db_set_login2() instead. - - \todo: GRASS 8: to be replaced by db_set_login2(). - \param driver driver name \param database database name (can be NULL) \param[out] user name \param[out] password string + \param[out] host name + \param[out] port \return DB_OK on success \return DB_FAILED on failure */ -int db_get_login(const char *driver, const char *database, const char **user, - const char **password) +int db_get_login2(const char *driver, const char *database, const char **user, + const char **password, const char **host, const char **port) { - return get_login(driver, database, user, password, NULL, NULL); + return db_get_login(driver, database, user, password, host, port); } /*! @@ -379,8 +377,8 @@ int db_get_login(const char *driver, const char *database, const char **user, \return DB_OK on success \return DB_FAILED on failure */ -int db_get_login2(const char *driver, const char *database, const char **user, - const char **password, const char **host, const char **port) +int db_get_login(const char *driver, const char *database, const char **user, + const char **password, const char **host, const char **port) { return get_login(driver, database, user, password, host, port); } diff --git a/lib/vector/Vlib/open_pg.c b/lib/vector/Vlib/open_pg.c index 7db0113be99..293291066c2 100644 --- a/lib/vector/Vlib/open_pg.c +++ b/lib/vector/Vlib/open_pg.c @@ -535,11 +535,11 @@ void connect_db(struct Format_info_pg *pg_info) /* try connection settings for given database first, then try * any settings defined for pg driver */ - db_get_login2("pg", dbname, &user, &passwd, &host, &port); + db_get_login("pg", dbname, &user, &passwd, &host, &port); /* any settings defined for pg driver disabled - can cause problems when running multiple local/remote db clusters if (strlen(dbname) > 0 && !user && !passwd) - db_get_login2("pg", NULL, &user, &passwd, &host, &port); + db_get_login("pg", NULL, &user, &passwd, &host, &port); */ if (user || passwd || host || port) { char conninfo[DB_SQL_MAX]; diff --git a/vector/v.external/dsn.c b/vector/v.external/dsn.c index 1a0d6bc2a57..c56009a64e2 100644 --- a/vector/v.external/dsn.c +++ b/vector/v.external/dsn.c @@ -31,7 +31,7 @@ char *get_datasource_name(const char *opt_dsn, int use_ogr) /* add db.login settings (user, password, host, port) */ if (DB_OK == - db_get_login2("pg", database, &user, &passwd, &host, &port)) { + db_get_login("pg", database, &user, &passwd, &host, &port)) { if (user) { if (!G_strcasestr(opt_dsn, "user=")) { strcat(connect_str, " user="); diff --git a/vector/v.in.ogr/dsn.c b/vector/v.in.ogr/dsn.c index 2fecff7e9fb..7e483e71050 100644 --- a/vector/v.in.ogr/dsn.c +++ b/vector/v.in.ogr/dsn.c @@ -38,7 +38,7 @@ char *get_datasource_name(const char *opt_dsn, int use_ogr) /* add db.login settings (user, password, host, port) */ if (DB_OK == - db_get_login2("pg", database, &user, &passwd, &host, &port)) { + db_get_login("pg", database, &user, &passwd, &host, &port)) { if (user) { if (!G_strcasestr(opt_dsn, "user=")) { strcat(connect_str, " user="); diff --git a/vector/v.out.ogr/dsn.c b/vector/v.out.ogr/dsn.c index 31d258c05c7..bd7ce101ed2 100644 --- a/vector/v.out.ogr/dsn.c +++ b/vector/v.out.ogr/dsn.c @@ -37,7 +37,7 @@ char *get_datasource_name(const char *opt_dsn, int use_ogr) /* add db.login settings (user, password, host, port) */ if (DB_OK == - db_get_login2("pg", database, &user, &passwd, &host, &port)) { + db_get_login("pg", database, &user, &passwd, &host, &port)) { if (user) { if (!G_strcasestr(opt_dsn, "user=")) { strcat(connect_str, " user="); From 930d59a3c30235f6ac33ba53e10dd1a8e201f732 Mon Sep 17 00:00:00 2001 From: Mohan Yelugoti Date: Wed, 23 Oct 2024 08:50:28 -0400 Subject: [PATCH 04/50] lib/db: Remove deprecated implementation of db_set_login() and replace it with that of db_set_login2() (#4308) `db_set_login()` is deprecated in 7.8.0 release with da399c52637ee5c81228459fa374a114c8fef06c. Change its function signature and implementation to match that of the currently preferred `db_set_login2()`. Technically, this is removing the old function and introducing a new one with the same name, but a different signature. Modify `db_set_login2()` to internally call `db_set_login()` function call. In the next major version, `db_set_login2()` should be removed to have only one method to get login details for simplicity. See also #4308. --------- Signed-off-by: Mohan Yelugoti --- db/db.login/main.c | 6 +++--- include/grass/defs/dbmi.h | 3 ++- lib/db/dbmi_base/login.c | 21 +++++++++++---------- 3 files changed, 16 insertions(+), 14 deletions(-) diff --git a/db/db.login/main.c b/db/db.login/main.c index 9147c0e7f1f..f073b654665 100644 --- a/db/db.login/main.c +++ b/db/db.login/main.c @@ -98,9 +98,9 @@ int main(int argc, char *argv[]) exit(EXIT_SUCCESS); } - if (db_set_login2(driver->answer, database->answer, user->answer, - password->answer, host->answer, port->answer, - G_get_overwrite()) == DB_FAILED) { + if (db_set_login(driver->answer, database->answer, user->answer, + password->answer, host->answer, port->answer, + G_get_overwrite()) == DB_FAILED) { G_fatal_error(_("Unable to set user/password")); } diff --git a/include/grass/defs/dbmi.h b/include/grass/defs/dbmi.h index 0eca1858489..5af0476849d 100644 --- a/include/grass/defs/dbmi.h +++ b/include/grass/defs/dbmi.h @@ -386,7 +386,8 @@ const char *db_whoami(void); void db_zero(void *, int); void db_zero_string(dbString *); unsigned int db_sizeof_string(const dbString *); -int db_set_login(const char *, const char *, const char *, const char *); +int db_set_login(const char *, const char *, const char *, const char *, + const char *, const char *, int); int db_set_login2(const char *, const char *, const char *, const char *, const char *, const char *, int); int db_get_login(const char *, const char *, const char **, const char **, diff --git a/lib/db/dbmi_base/login.c b/lib/db/dbmi_base/login.c index bc84f78118c..9c865233d2c 100644 --- a/lib/db/dbmi_base/login.c +++ b/lib/db/dbmi_base/login.c @@ -253,22 +253,23 @@ static int set_login(const char *driver, const char *database, const char *user, /*! \brief Set login parameters for driver/database - \deprecated Use db_set_login2() instead. - - \todo: GRASS 8: to be replaced by db_set_login2(). - \param driver driver name \param database database name \param user user name \param password password string + \param host host name + \param port + \param overwrite TRUE to overwrite existing connections \return DB_OK on success \return DB_FAILED on failure */ -int db_set_login(const char *driver, const char *database, const char *user, - const char *password) +int db_set_login2(const char *driver, const char *database, const char *user, + const char *password, const char *host, const char *port, + int overwrite) { - return set_login(driver, database, user, password, NULL, NULL, FALSE); + return db_set_login(driver, database, user, password, host, port, + overwrite); } /*! @@ -285,9 +286,9 @@ int db_set_login(const char *driver, const char *database, const char *user, \return DB_OK on success \return DB_FAILED on failure */ -int db_set_login2(const char *driver, const char *database, const char *user, - const char *password, const char *host, const char *port, - int overwrite) +int db_set_login(const char *driver, const char *database, const char *user, + const char *password, const char *host, const char *port, + int overwrite) { return set_login(driver, database, user, password, host, port, overwrite); } From 5cd687092b6bcdcaed1e52feed8cd7a312ac5e30 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 23 Oct 2024 18:47:36 +0000 Subject: [PATCH 05/50] CI(deps): Update actions/checkout action to v4.2.2 (#4578) --- .github/workflows/additional_checks.yml | 2 +- .github/workflows/clang-format-check.yml | 2 +- .github/workflows/codeql-analysis.yml | 2 +- .github/workflows/coverity.yml | 2 +- .github/workflows/create_release_draft.yml | 2 +- .github/workflows/docker.yml | 2 +- .github/workflows/gcc.yml | 2 +- .github/workflows/macos.yml | 2 +- .github/workflows/osgeo4w.yml | 2 +- .github/workflows/periodic_update.yml | 2 +- .github/workflows/pytest.yml | 2 +- .github/workflows/python-code-quality.yml | 2 +- .github/workflows/super-linter.yml | 2 +- .github/workflows/test-nix.yml | 2 +- .github/workflows/titles.yml | 2 +- .github/workflows/ubuntu.yml | 2 +- 16 files changed, 16 insertions(+), 16 deletions(-) diff --git a/.github/workflows/additional_checks.yml b/.github/workflows/additional_checks.yml index a91d221f1e4..a2fbfadc36f 100644 --- a/.github/workflows/additional_checks.yml +++ b/.github/workflows/additional_checks.yml @@ -24,7 +24,7 @@ jobs: steps: - name: Checkout repository contents - uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1 + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 with: fetch-depth: 31 diff --git a/.github/workflows/clang-format-check.yml b/.github/workflows/clang-format-check.yml index 13ba5bb3cd9..489d8197c09 100644 --- a/.github/workflows/clang-format-check.yml +++ b/.github/workflows/clang-format-check.yml @@ -16,7 +16,7 @@ jobs: name: Formatting Check runs-on: ubuntu-latest steps: - - uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1 + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 with: persist-credentials: false - uses: DoozyX/clang-format-lint-action@c71d0bf4e21876ebec3e5647491186f8797fde31 # v0.18.2 diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 97f89578306..9c161300170 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -40,7 +40,7 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1 + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - name: Set up Python uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5.2.0 with: diff --git a/.github/workflows/coverity.yml b/.github/workflows/coverity.yml index 22a6b7a42a8..51ab83015ca 100644 --- a/.github/workflows/coverity.yml +++ b/.github/workflows/coverity.yml @@ -17,7 +17,7 @@ jobs: runs-on: ubuntu-22.04 if: github.repository == 'OSGeo/grass' steps: - - uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1 + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - name: Get dependencies run: | diff --git a/.github/workflows/create_release_draft.yml b/.github/workflows/create_release_draft.yml index 3112fb8b33f..6c3597599fc 100644 --- a/.github/workflows/create_release_draft.yml +++ b/.github/workflows/create_release_draft.yml @@ -30,7 +30,7 @@ jobs: contents: write steps: - name: Checks-out repository - uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1 + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 with: ref: ${{ github.ref }} fetch-depth: 0 diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 4de674ee9a2..6b2ad83629e 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -49,7 +49,7 @@ jobs: steps: - name: Checkout - uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1 + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 with: fetch-depth: 0 - name: Docker meta diff --git a/.github/workflows/gcc.yml b/.github/workflows/gcc.yml index 651cb272fba..6b6286ef3f0 100644 --- a/.github/workflows/gcc.yml +++ b/.github/workflows/gcc.yml @@ -26,7 +26,7 @@ jobs: fail-fast: false steps: - - uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1 + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - name: Get dependencies run: | sudo apt-get update -y diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index 41ac51df8ff..cdc02ad1432 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -44,7 +44,7 @@ jobs: -mindepth 1 -maxdepth 1 -type f -print -delete # Rehash to forget about the deleted files hash -r - - uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1 + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - name: Get current date cache key segment id: date # Year and week of year so cache key changes weekly diff --git a/.github/workflows/osgeo4w.yml b/.github/workflows/osgeo4w.yml index a7694fa9b30..30add8dde09 100644 --- a/.github/workflows/osgeo4w.yml +++ b/.github/workflows/osgeo4w.yml @@ -31,7 +31,7 @@ jobs: run: | git config --global core.autocrlf false git config --global core.eol lf - - uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1 + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - uses: msys2/setup-msys2@ddf331adaebd714795f1042345e6ca57bd66cea8 # v2.24.1 with: path-type: inherit diff --git a/.github/workflows/periodic_update.yml b/.github/workflows/periodic_update.yml index 17855d6149e..d27b8664c55 100644 --- a/.github/workflows/periodic_update.yml +++ b/.github/workflows/periodic_update.yml @@ -21,7 +21,7 @@ jobs: - name: Create URL to the run output id: vars run: echo "run-url=https://github.com/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID" >> $GITHUB_OUTPUT - - uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1 + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - name: "Check that autoconf scripts are up-to-date:" run: | rm -f config.guess config.sub diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml index e1b3b84b54e..b28fb40ad14 100644 --- a/.github/workflows/pytest.yml +++ b/.github/workflows/pytest.yml @@ -32,7 +32,7 @@ jobs: PYTHONWARNINGS: always steps: - - uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1 + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - name: Set up Python uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5.2.0 diff --git a/.github/workflows/python-code-quality.yml b/.github/workflows/python-code-quality.yml index 15357764d6a..94a8d0be26b 100644 --- a/.github/workflows/python-code-quality.yml +++ b/.github/workflows/python-code-quality.yml @@ -54,7 +54,7 @@ jobs: echo Bandit: ${{ env.BANDIT_VERSION }} echo Ruff: ${{ env.RUFF_VERSION }} - - uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1 + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - name: Set up Python uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5.2.0 diff --git a/.github/workflows/super-linter.yml b/.github/workflows/super-linter.yml index 62328723f77..ab2168cd1a3 100644 --- a/.github/workflows/super-linter.yml +++ b/.github/workflows/super-linter.yml @@ -25,7 +25,7 @@ jobs: statuses: write steps: - - uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1 + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 with: # super-linter needs the full git history to get the # list of files that changed across commits diff --git a/.github/workflows/test-nix.yml b/.github/workflows/test-nix.yml index ba14e0747ab..43a1b5d40ab 100644 --- a/.github/workflows/test-nix.yml +++ b/.github/workflows/test-nix.yml @@ -28,7 +28,7 @@ jobs: contents: read steps: - - uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1 + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - name: Install nix uses: DeterminateSystems/nix-installer-action@da36cb69b1c3247ad7a1f931ebfd954a1105ef14 # v14 diff --git a/.github/workflows/titles.yml b/.github/workflows/titles.yml index f202fdafe02..9821a209a87 100644 --- a/.github/workflows/titles.yml +++ b/.github/workflows/titles.yml @@ -21,7 +21,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout base repository (doesn't include the PR changes) - uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1 + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - name: Call PR title validation function run: python utils/generate_release_notes.py check "${PR_TITLE}" "" "" env: diff --git a/.github/workflows/ubuntu.yml b/.github/workflows/ubuntu.yml index 966dbfe21ab..9023df7d1b3 100644 --- a/.github/workflows/ubuntu.yml +++ b/.github/workflows/ubuntu.yml @@ -59,7 +59,7 @@ jobs: fail-fast: false steps: - - uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1 + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - name: Invert inclusion list to an exclusion list id: get-exclude From 533070dbc9807657e96ec376f23ab6db64fbdc9a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edouard=20Choini=C3=A8re?= <27212526+echoix@users.noreply.github.com> Date: Wed, 23 Oct 2024 17:12:02 -0400 Subject: [PATCH 06/50] style: Fix unused-import (F401) (#4521) * t.rast.accumulate: Remove unused SimpleModule import in test_accumulation * temporal: Fix unused-import (F401) in testsuite * grass.temporal: Fix unused-import (F401) * grass.benchmark: Fix unused-import (F401) by defining __all__ * grass.pygrass.vector: Fix unused-import (F401) for testsuite * grass.pygrass.vector: Sort imports * vector: Fix unused-import (F401) for testsuite * scripts: Fix unused-import (F401) for testsuite * raster: Fix unused-import (F401) for testsuite * v.fill.holes: Fix unused-import (F401) * doc: Fix unused-import (F401) * grass.semantic_label: Fix unused-import (F401) by defining __all__ in __init__ * grass.pygrass.rpc: Fix unused-import (F401) in __init__ * grass.pygrass.modules.interface: Fix unused-import (F401) by defining __all__ in __init__ * grass.pygrass.modules.interface: Apply isort * grass.pygrass.modules.grid: Fix unused-import (F401) by defining __all__ in __init__ * grass.pygrass.modules: Fix unused-import (F401) by defining __all__ in __init__ * grass.pygrass.modules: Apply isort * grass.imaging: Fix unused-import (F401) by defining __all__ in __init__ * grass.imaging: Apply isort * grass.jupyter: Fix unused-import (F401) by defining __all__ in __init__ * grass.jupyter: Apply isort * pygrass: Ignore F401 (unused imports) Ignored inline where the import is justified and isn't to fix later, and ignored in a per-file exclusion where the imports seemed to be for commented-out test case lines * lib/gis: Fix F401 unused platform import in test_gis_lib_getl * grass.script: Ignore F401 in `__init__.py` for setup import * style: Remove exclusion for F401 ruff rule * style: Remove unneeded flake8 exclusions for F401 * Apply suggestions from code review --- .flake8 | 14 +++++--------- doc/notebooks/hydrology.ipynb | 1 - doc/notebooks/jupyter_tutorial.ipynb | 1 - doc/notebooks/parallelization_tutorial.ipynb | 1 - doc/notebooks/solar_potential.ipynb | 1 - doc/notebooks/viewshed_analysis.ipynb | 1 - lib/gis/testsuite/test_gis_lib_getl.py | 1 - pyproject.toml | 3 ++- python/grass/benchmark/__init__.py | 14 ++++++++++++++ python/grass/imaging/__init__.py | 15 +++++++++++++-- python/grass/jupyter/__init__.py | 13 ++++++++++++- python/grass/pygrass/modules/__init__.py | 9 ++++++++- python/grass/pygrass/modules/grid/__init__.py | 2 ++ .../pygrass/modules/interface/__init__.py | 18 ++++++++++++------ .../modules/testsuite/test_import_isolation.py | 9 ++++++--- python/grass/pygrass/rpc/__init__.py | 3 --- .../pygrass/vector/testsuite/test_filters.py | 1 - .../pygrass/vector/testsuite/test_geometry.py | 11 ++++------- .../vector/testsuite/test_geometry_attrs.py | 8 -------- .../testsuite/test_pygrass_vector_doctests.py | 3 --- .../pygrass/vector/testsuite/test_table.py | 5 ++--- .../pygrass/vector/testsuite/test_vector.py | 2 -- .../pygrass/vector/testsuite/test_vector3d.py | 6 +----- python/grass/script/__init__.py | 2 +- python/grass/semantic_label/__init__.py | 2 ++ .../unittests_temporal_algebra_grs.py | 1 - .../unittests_temporal_algebra_mixed_stds.py | 1 - .../unittests_temporal_conditionals.py | 1 - raster/r.in.ascii/testsuite/test_r_in_ascii.py | 1 - .../testsuite/test_r_object_geometry.py | 2 -- raster/r.viewshed/testsuite/test_r_viewshed.py | 1 - scripts/db.in.ogr/testsuite/test_db_in_ogr.py | 1 - .../r.fillnulls/testsuite/test_r_fillnulls.py | 2 -- scripts/r.grow/testsuite/test_r_grow.py | 1 - scripts/v.dissolve/v_dissolve.ipynb | 1 - .../testsuite/test_accumulation.py | 1 - .../testsuite/test_aggregation_absolute.py | 1 - .../test_aggregation_absolute_parallel.py | 1 - .../testsuite/test_aggregation_relative.py | 1 - .../testsuite/test_raster_algebra_operators.py | 1 - .../testsuite/test_t_rast_extract.py | 3 --- .../t.rast.gapfill/testsuite/test_gapfill.py | 2 -- .../testsuite/test_neighbors.py | 1 + .../t.rast.series/testsuite/test_series.py | 1 - .../testsuite/test_strds_to_rast3.py | 4 ---- .../t.rast.to.vect/testsuite/test_to_vect.py | 2 -- .../testsuite/test_t_rast_univar.py | 1 + .../testsuite/test_t_rast3d_extract.py | 3 --- .../testsuite/test_t_rast3d_univar.py | 1 + temporal/t.shift/testsuite/test_shift.py | 2 -- temporal/t.snap/testsuite/test_snap.py | 2 -- .../t.support/testsuite/test_support_str3ds.py | 2 -- .../t.support/testsuite/test_support_strds.py | 2 -- .../t.support/testsuite/test_support_stvds.py | 2 -- .../t.unregister/testsuite/test_unregister.py | 1 - vector/v.extract/testsuite/test_v_extract.py | 1 - vector/v.fill.holes/examples.ipynb | 2 -- vector/v.in.ogr/testsuite/test_v_in_ogr.py | 1 - 58 files changed, 87 insertions(+), 109 deletions(-) diff --git a/.flake8 b/.flake8 index 14224a97843..9985b8e5a42 100644 --- a/.flake8 +++ b/.flake8 @@ -15,11 +15,10 @@ per-file-ignores = # E501 line too long # E722 do not use bare 'except' # W605 invalid escape sequence - # F401 imported but unused # F821 undefined name 'unicode' # F841 local variable assigned to but never used # E741 ambiguous variable name 'l' - __init__.py: F401, F403 + __init__.py: F403 man/build_html.py: E501 doc/python/m.distance.py: E501 gui/scripts/d.wms.py: E501 @@ -66,10 +65,8 @@ per-file-ignores = python/grass/pygrass/vector/__init__.py: E402 python/grass/pygrass/raster/__init__.py: E402 python/grass/pygrass/vector/__init__.py: E402 - python/grass/pygrass/modules/interface/*.py: F401 - python/grass/pygrass/modules/grid/*.py: F401 python/grass/pygrass/raster/category.py: E721 - python/grass/pygrass/rpc/__init__.py: F401, F403 + python/grass/pygrass/rpc/__init__.py: F403 python/grass/pygrass/utils.py: E402 python/grass/temporal/abstract_space_time_dataset.py: E722 python/grass/temporal/c_libraries_interface.py: E722 @@ -82,17 +79,16 @@ per-file-ignores = python/grass/temporal/temporal_topology_dataset_connector.py: E722 # Current benchmarks/tests are changing sys.path before import. # Possibly, a different approach should be taken there anyway. - python/grass/pygrass/tests/benchmark.py: E402, F401, F821 + python/grass/pygrass/tests/benchmark.py: E402, F821 # Configuration file for Sphinx: # Ignoring import/code mix and line length. # Files not managed by Black python/grass/imaging/images2gif.py: E226 # Unused imports in init files - # F401 imported but unused # F403 star import used; unable to detect undefined names python/grass/*/__init__.py: F401, F403 - python/grass/*/*/__init__.py: F401, F403 - python/grass/*/*/*/__init__.py: F401, F403 + 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 diff --git a/doc/notebooks/hydrology.ipynb b/doc/notebooks/hydrology.ipynb index b9e23acf3c1..f5c853de9a2 100644 --- a/doc/notebooks/hydrology.ipynb +++ b/doc/notebooks/hydrology.ipynb @@ -25,7 +25,6 @@ "outputs": [], "source": [ "# Import Python standard library and IPython packages we need.\n", - "import os\n", "import subprocess\n", "import sys\n", "import csv\n", diff --git a/doc/notebooks/jupyter_tutorial.ipynb b/doc/notebooks/jupyter_tutorial.ipynb index 71852c226e6..6dfdfb63625 100644 --- a/doc/notebooks/jupyter_tutorial.ipynb +++ b/doc/notebooks/jupyter_tutorial.ipynb @@ -30,7 +30,6 @@ "source": [ "# Import Python standard library and IPython packages we need.\n", "import subprocess\n", - "import time\n", "import sys\n", "\n", "# Ask GRASS GIS where its Python packages are.\n", diff --git a/doc/notebooks/parallelization_tutorial.ipynb b/doc/notebooks/parallelization_tutorial.ipynb index 2c5d902e9a4..4611f5d1c24 100644 --- a/doc/notebooks/parallelization_tutorial.ipynb +++ b/doc/notebooks/parallelization_tutorial.ipynb @@ -21,7 +21,6 @@ "metadata": {}, "outputs": [], "source": [ - "import os\n", "import subprocess\n", "import sys\n", "\n", diff --git a/doc/notebooks/solar_potential.ipynb b/doc/notebooks/solar_potential.ipynb index 98253ad6450..07da1af77e2 100644 --- a/doc/notebooks/solar_potential.ipynb +++ b/doc/notebooks/solar_potential.ipynb @@ -28,7 +28,6 @@ "outputs": [], "source": [ "# Import Python standard library and IPython packages we need.\n", - "import os\n", "import subprocess\n", "import sys\n", "\n", diff --git a/doc/notebooks/viewshed_analysis.ipynb b/doc/notebooks/viewshed_analysis.ipynb index a4f0b61744a..5cfe69c4dae 100644 --- a/doc/notebooks/viewshed_analysis.ipynb +++ b/doc/notebooks/viewshed_analysis.ipynb @@ -30,7 +30,6 @@ "outputs": [], "source": [ "# Import Python standard library and IPython packages we need.\n", - "import os\n", "import subprocess\n", "import sys\n", "\n", diff --git a/lib/gis/testsuite/test_gis_lib_getl.py b/lib/gis/testsuite/test_gis_lib_getl.py index 98092955ab2..72e8992ad39 100644 --- a/lib/gis/testsuite/test_gis_lib_getl.py +++ b/lib/gis/testsuite/test_gis_lib_getl.py @@ -5,7 +5,6 @@ import ctypes import pathlib -import platform import unittest import grass.lib.gis as libgis diff --git a/pyproject.toml b/pyproject.toml index 4b7856bab3b..a428c79106f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -131,7 +131,6 @@ ignore = [ "E722", # bare-except "E731", # lambda-assignment "E741", # ambiguous-variable-name - "F401", # unused-import "F403", # undefined-local-with-import-star "F405", # undefined-local-with-import-star-usage "F811", # redefined-while-unused @@ -319,7 +318,9 @@ ignore = [ "python/grass/jupyter/testsuite/map_test.py" = ["PGH004"] "python/grass/pydispatch/signal.py" = ["A005"] "python/grass/pygrass/modules/grid/grid.py" = ["SIM115"] +"python/grass/pygrass/modules/grid/testsuite/test_*_modules_grid_doctests.py" = ["F401"] "python/grass/pygrass/modules/interface/env.py" = ["SIM115"] +"python/grass/pygrass/modules/testsuite/test_pygrass_modules_doctests.py" = ["F401"] "python/grass/pygrass/raster/segment.py" = ["SIM115"] "python/grass/pygrass/tests/*.py" = ["SIM115"] "python/grass/pygrass/vector/geometry.py" = ["PYI024"] diff --git a/python/grass/benchmark/__init__.py b/python/grass/benchmark/__init__.py index a4a7bf4e991..62a6a85c3e1 100644 --- a/python/grass/benchmark/__init__.py +++ b/python/grass/benchmark/__init__.py @@ -34,3 +34,17 @@ save_results_to_file, ) from .runners import benchmark_nprocs, benchmark_resolutions, benchmark_single + +__all__ = [ + "benchmark_nprocs", + "benchmark_resolutions", + "benchmark_single", + "join_results", + "join_results_from_files", + "load_results", + "load_results_from_file", + "nprocs_plot", + "num_cells_plot", + "save_results", + "save_results_to_file", +] diff --git a/python/grass/imaging/__init__.py b/python/grass/imaging/__init__.py index 41626697f8e..7434942abe0 100644 --- a/python/grass/imaging/__init__.py +++ b/python/grass/imaging/__init__.py @@ -1,4 +1,15 @@ -from grass.imaging.images2gif import readGif, writeGif -from grass.imaging.images2swf import readSwf, writeSwf from grass.imaging.images2avi import readAvi, writeAvi +from grass.imaging.images2gif import readGif, writeGif from grass.imaging.images2ims import readIms, writeIms +from grass.imaging.images2swf import readSwf, writeSwf + +__all__ = [ + "readAvi", + "readGif", + "readIms", + "readSwf", + "writeAvi", + "writeGif", + "writeIms", + "writeSwf", +] diff --git a/python/grass/jupyter/__init__.py b/python/grass/jupyter/__init__.py index 91457f07ac3..21223c2cd47 100644 --- a/python/grass/jupyter/__init__.py +++ b/python/grass/jupyter/__init__.py @@ -109,6 +109,17 @@ from .interactivemap import InteractiveMap, Raster, Vector from .map import Map from .map3d import Map3D +from .seriesmap import SeriesMap from .setup import init from .timeseriesmap import TimeSeriesMap -from .seriesmap import SeriesMap + +__all__ = [ + "InteractiveMap", + "Map", + "Map3D", + "Raster", + "SeriesMap", + "TimeSeriesMap", + "Vector", + "init", +] diff --git a/python/grass/pygrass/modules/__init__.py b/python/grass/pygrass/modules/__init__.py index 61073791599..ce4d169fedd 100644 --- a/python/grass/pygrass/modules/__init__.py +++ b/python/grass/pygrass/modules/__init__.py @@ -1,2 +1,9 @@ -from grass.pygrass.modules.interface import Module, MultiModule, ParallelModuleQueue from grass.pygrass.modules import shortcuts +from grass.pygrass.modules.interface import Module, MultiModule, ParallelModuleQueue + +__all__ = [ + "Module", + "MultiModule", + "ParallelModuleQueue", + "shortcuts", +] diff --git a/python/grass/pygrass/modules/grid/__init__.py b/python/grass/pygrass/modules/grid/__init__.py index 1c971174998..0d770ed3ad2 100644 --- a/python/grass/pygrass/modules/grid/__init__.py +++ b/python/grass/pygrass/modules/grid/__init__.py @@ -1 +1,3 @@ from grass.pygrass.modules.grid.grid import GridModule + +__all__ = ["GridModule"] diff --git a/python/grass/pygrass/modules/interface/__init__.py b/python/grass/pygrass/modules/interface/__init__.py index a05211e21c3..bde59049c6e 100644 --- a/python/grass/pygrass/modules/interface/__init__.py +++ b/python/grass/pygrass/modules/interface/__init__.py @@ -4,14 +4,20 @@ @author: pietro """ -from grass.pygrass.modules.interface import flag -from grass.pygrass.modules.interface import parameter -from grass.pygrass.modules.interface import module -from grass.pygrass.modules.interface import typedict -from grass.pygrass.modules.interface import read - +from grass.pygrass.modules.interface import flag, module, parameter, read, typedict from grass.pygrass.modules.interface.module import ( Module, MultiModule, ParallelModuleQueue, ) + +__all__ = [ + "Module", + "MultiModule", + "ParallelModuleQueue", + "flag", + "module", + "parameter", + "read", + "typedict", +] diff --git a/python/grass/pygrass/modules/testsuite/test_import_isolation.py b/python/grass/pygrass/modules/testsuite/test_import_isolation.py index d1321a554d0..af643ec2fee 100644 --- a/python/grass/pygrass/modules/testsuite/test_import_isolation.py +++ b/python/grass/pygrass/modules/testsuite/test_import_isolation.py @@ -36,14 +36,17 @@ def test_import_isolation(self): isolate, check(*self.patterns), msg="Test isolation before any import." ) # same import done in __init__ file - from grass.pygrass.modules.interface import Module, ParallelModuleQueue - from grass.pygrass.modules import shortcuts + from grass.pygrass.modules.interface import ( + Module, # noqa: F401 + ParallelModuleQueue, # noqa: F401 + ) + from grass.pygrass.modules import shortcuts # noqa: F401 self.assertEqual( isolate, check(*self.patterns), msg="Test isolation after import Module." ) # test the other way round - from grass.pygrass.vector import VectorTopo + from grass.pygrass.vector import VectorTopo # noqa: F401 self.assertNotEqual( isolate, diff --git a/python/grass/pygrass/rpc/__init__.py b/python/grass/pygrass/rpc/__init__.py index 07cbfe6503a..a6ab19b9369 100644 --- a/python/grass/pygrass/rpc/__init__.py +++ b/python/grass/pygrass/rpc/__init__.py @@ -10,8 +10,6 @@ :authors: Soeren Gebbert """ -import time -import threading import sys from multiprocessing import Process, Lock, Pipe from ctypes import CFUNCTYPE, c_void_p @@ -24,7 +22,6 @@ from .base import RPCServerBase from grass.pygrass.gis.region import Region from grass.pygrass import utils -import logging ############################################################################### ############################################################################### diff --git a/python/grass/pygrass/vector/testsuite/test_filters.py b/python/grass/pygrass/vector/testsuite/test_filters.py index 9252b134c02..9adba4cdefc 100644 --- a/python/grass/pygrass/vector/testsuite/test_filters.py +++ b/python/grass/pygrass/vector/testsuite/test_filters.py @@ -6,7 +6,6 @@ from grass.gunittest.case import TestCase from grass.gunittest.main import test - from grass.pygrass.vector.table import Filters diff --git a/python/grass/pygrass/vector/testsuite/test_geometry.py b/python/grass/pygrass/vector/testsuite/test_geometry.py index b2a7a1e37df..6957a473165 100644 --- a/python/grass/pygrass/vector/testsuite/test_geometry.py +++ b/python/grass/pygrass/vector/testsuite/test_geometry.py @@ -6,18 +6,15 @@ import sys import unittest + import numpy as np +import grass.lib.vector as libvect from grass.gunittest.case import TestCase from grass.gunittest.main import test - -import grass.lib.vector as libvect -from grass.script.core import run_command - -from grass.pygrass.vector import Vector, VectorTopo -from grass.pygrass.vector.geometry import Point, Line, Node -from grass.pygrass.vector.geometry import Area, Boundary, Centroid +from grass.pygrass.vector import VectorTopo from grass.pygrass.vector.basic import Bbox +from grass.pygrass.vector.geometry import Area, Line, Node, Point class PointTestCase(TestCase): diff --git a/python/grass/pygrass/vector/testsuite/test_geometry_attrs.py b/python/grass/pygrass/vector/testsuite/test_geometry_attrs.py index 356a55ec4d7..cba638b1901 100644 --- a/python/grass/pygrass/vector/testsuite/test_geometry_attrs.py +++ b/python/grass/pygrass/vector/testsuite/test_geometry_attrs.py @@ -4,16 +4,8 @@ @author: pietro """ -import sys -import unittest -import numpy as np - from grass.gunittest.case import TestCase from grass.gunittest.main import test - -import grass.lib.vector as libvect -from grass.script.core import run_command - from grass.pygrass.vector import VectorTopo diff --git a/python/grass/pygrass/vector/testsuite/test_pygrass_vector_doctests.py b/python/grass/pygrass/vector/testsuite/test_pygrass_vector_doctests.py index b3d26220ec1..2cf0d0ba0c5 100644 --- a/python/grass/pygrass/vector/testsuite/test_pygrass_vector_doctests.py +++ b/python/grass/pygrass/vector/testsuite/test_pygrass_vector_doctests.py @@ -7,10 +7,7 @@ import grass.gunittest.case import grass.gunittest.main import grass.gunittest.utils - import grass.pygrass.vector as gvector -import grass.pygrass.utils as gutils - # doctest does not allow changing the base classes of test case, skip test case # and test suite, so we need to create a new type which inherits from our class diff --git a/python/grass/pygrass/vector/testsuite/test_table.py b/python/grass/pygrass/vector/testsuite/test_table.py index d87786fb3bd..c77233400b1 100644 --- a/python/grass/pygrass/vector/testsuite/test_table.py +++ b/python/grass/pygrass/vector/testsuite/test_table.py @@ -7,16 +7,15 @@ import os import sqlite3 import tempfile as tmp -from string import ascii_letters, digits from random import choice +from string import ascii_letters, digits + import numpy as np from grass.gunittest.case import TestCase from grass.gunittest.main import test - from grass.pygrass.vector.table import Table, get_path - # dictionary that generate random data RNG = np.random.default_rng() COL2VALS = { diff --git a/python/grass/pygrass/vector/testsuite/test_vector.py b/python/grass/pygrass/vector/testsuite/test_vector.py index 5d16333c31f..b4eebb2ab1e 100644 --- a/python/grass/pygrass/vector/testsuite/test_vector.py +++ b/python/grass/pygrass/vector/testsuite/test_vector.py @@ -6,8 +6,6 @@ from grass.gunittest.case import TestCase from grass.gunittest.main import test - -from grass.script.core import run_command from grass.pygrass.vector import VectorTopo diff --git a/python/grass/pygrass/vector/testsuite/test_vector3d.py b/python/grass/pygrass/vector/testsuite/test_vector3d.py index 796f85ca529..84e688d22e8 100644 --- a/python/grass/pygrass/vector/testsuite/test_vector3d.py +++ b/python/grass/pygrass/vector/testsuite/test_vector3d.py @@ -8,13 +8,9 @@ from grass.gunittest.case import TestCase from grass.gunittest.main import test - -from grass.script.core import run_command - +from grass.pygrass.gis.region import Region from grass.pygrass.vector import VectorTopo from grass.pygrass.vector.geometry import Point -from grass.pygrass.gis.region import Region -from grass.pygrass.utils import get_mapset_vector def generate_coordinates(number, bbox=None, with_z=False): diff --git a/python/grass/script/__init__.py b/python/grass/script/__init__.py index 8589e8a1521..ea82c2fe451 100644 --- a/python/grass/script/__init__.py +++ b/python/grass/script/__init__.py @@ -7,4 +7,4 @@ from .raster3d import * from .vector import * from .utils import * -from . import setup +from . import setup # noqa: F401 diff --git a/python/grass/semantic_label/__init__.py b/python/grass/semantic_label/__init__.py index 9f0b9b6caed..58bfe11a418 100644 --- a/python/grass/semantic_label/__init__.py +++ b/python/grass/semantic_label/__init__.py @@ -1 +1,3 @@ from .reader import SemanticLabelReader, SemanticLabelReaderError + +__all__ = ["SemanticLabelReader", "SemanticLabelReaderError"] diff --git a/python/grass/temporal/testsuite/unittests_temporal_algebra_grs.py b/python/grass/temporal/testsuite/unittests_temporal_algebra_grs.py index 7e0db57a8ce..d7a81bcb34d 100644 --- a/python/grass/temporal/testsuite/unittests_temporal_algebra_grs.py +++ b/python/grass/temporal/testsuite/unittests_temporal_algebra_grs.py @@ -8,7 +8,6 @@ """ import datetime -import os import grass.temporal as tgis from grass.gunittest.case import TestCase diff --git a/python/grass/temporal/testsuite/unittests_temporal_algebra_mixed_stds.py b/python/grass/temporal/testsuite/unittests_temporal_algebra_mixed_stds.py index cf0e9c82bb7..ce911839049 100644 --- a/python/grass/temporal/testsuite/unittests_temporal_algebra_mixed_stds.py +++ b/python/grass/temporal/testsuite/unittests_temporal_algebra_mixed_stds.py @@ -8,7 +8,6 @@ """ import datetime -import os import grass.temporal as tgis from grass.gunittest.case import TestCase diff --git a/python/grass/temporal/testsuite/unittests_temporal_conditionals.py b/python/grass/temporal/testsuite/unittests_temporal_conditionals.py index ff0703aec1d..800c7d30bf6 100644 --- a/python/grass/temporal/testsuite/unittests_temporal_conditionals.py +++ b/python/grass/temporal/testsuite/unittests_temporal_conditionals.py @@ -8,7 +8,6 @@ """ import datetime -import os import grass.temporal as tgis from grass.gunittest.case import TestCase diff --git a/raster/r.in.ascii/testsuite/test_r_in_ascii.py b/raster/r.in.ascii/testsuite/test_r_in_ascii.py index baa892d83a8..8db06f83517 100644 --- a/raster/r.in.ascii/testsuite/test_r_in_ascii.py +++ b/raster/r.in.ascii/testsuite/test_r_in_ascii.py @@ -11,7 +11,6 @@ from grass.gunittest.case import TestCase from grass.gunittest.main import test -from grass.script.core import read_command INPUT_NOQUOTES = """north: 4299000.00 south: 4247000.00 diff --git a/raster/r.object.geometry/testsuite/test_r_object_geometry.py b/raster/r.object.geometry/testsuite/test_r_object_geometry.py index 419df4d780b..279d46ae4f0 100644 --- a/raster/r.object.geometry/testsuite/test_r_object_geometry.py +++ b/raster/r.object.geometry/testsuite/test_r_object_geometry.py @@ -6,11 +6,9 @@ import json import os -from sys import stderr from grass.gunittest.case import TestCase from grass.gunittest.main import test -from grass.gunittest.gmodules import call_module from grass.gunittest.gmodules import SimpleModule diff --git a/raster/r.viewshed/testsuite/test_r_viewshed.py b/raster/r.viewshed/testsuite/test_r_viewshed.py index 2b136abd551..a341d8e97b5 100644 --- a/raster/r.viewshed/testsuite/test_r_viewshed.py +++ b/raster/r.viewshed/testsuite/test_r_viewshed.py @@ -1,6 +1,5 @@ from grass.gunittest.case import TestCase from grass.gunittest.main import test -from grass.gunittest.gmodules import call_module class TestViewshed(TestCase): diff --git a/scripts/db.in.ogr/testsuite/test_db_in_ogr.py b/scripts/db.in.ogr/testsuite/test_db_in_ogr.py index 423917e1b93..b79efa1f096 100644 --- a/scripts/db.in.ogr/testsuite/test_db_in_ogr.py +++ b/scripts/db.in.ogr/testsuite/test_db_in_ogr.py @@ -8,7 +8,6 @@ from grass.gunittest.main import test from grass.gunittest.gmodules import SimpleModule -from grass.script.core import run_command from grass.script.utils import decode import os diff --git a/scripts/r.fillnulls/testsuite/test_r_fillnulls.py b/scripts/r.fillnulls/testsuite/test_r_fillnulls.py index 975fd5330f2..dda6d99ed95 100644 --- a/scripts/r.fillnulls/testsuite/test_r_fillnulls.py +++ b/scripts/r.fillnulls/testsuite/test_r_fillnulls.py @@ -4,8 +4,6 @@ @author: Sanjeet Bhatti """ -import os - from grass.gunittest.case import TestCase from grass.gunittest.main import test from grass.gunittest.gmodules import SimpleModule diff --git a/scripts/r.grow/testsuite/test_r_grow.py b/scripts/r.grow/testsuite/test_r_grow.py index 3d54b9ab993..1c9488b4180 100644 --- a/scripts/r.grow/testsuite/test_r_grow.py +++ b/scripts/r.grow/testsuite/test_r_grow.py @@ -7,7 +7,6 @@ from grass.gunittest.case import TestCase from grass.gunittest.main import test from grass.gunittest.gmodules import SimpleModule -from grass.script.core import run_command class TestRGrow(TestCase): diff --git a/scripts/v.dissolve/v_dissolve.ipynb b/scripts/v.dissolve/v_dissolve.ipynb index f90907a704d..085b23828d8 100644 --- a/scripts/v.dissolve/v_dissolve.ipynb +++ b/scripts/v.dissolve/v_dissolve.ipynb @@ -19,7 +19,6 @@ "metadata": {}, "outputs": [], "source": [ - "import os\n", "import json\n", "import subprocess\n", "import sys\n", diff --git a/temporal/t.rast.accumulate/testsuite/test_accumulation.py b/temporal/t.rast.accumulate/testsuite/test_accumulation.py index 566c1971f99..6c277c320cf 100644 --- a/temporal/t.rast.accumulate/testsuite/test_accumulation.py +++ b/temporal/t.rast.accumulate/testsuite/test_accumulation.py @@ -12,7 +12,6 @@ import grass.temporal as tgis from grass.gunittest.case import TestCase -from grass.gunittest.gmodules import SimpleModule class TestAccumulate(TestCase): diff --git a/temporal/t.rast.aggregate/testsuite/test_aggregation_absolute.py b/temporal/t.rast.aggregate/testsuite/test_aggregation_absolute.py index 924e3950ca8..e7702ba23b5 100644 --- a/temporal/t.rast.aggregate/testsuite/test_aggregation_absolute.py +++ b/temporal/t.rast.aggregate/testsuite/test_aggregation_absolute.py @@ -10,7 +10,6 @@ import os -import grass.pygrass.modules as pymod import grass.temporal as tgis from grass.gunittest.case import TestCase from grass.gunittest.gmodules import SimpleModule diff --git a/temporal/t.rast.aggregate/testsuite/test_aggregation_absolute_parallel.py b/temporal/t.rast.aggregate/testsuite/test_aggregation_absolute_parallel.py index 2b56dd30615..5ad25e2e32c 100644 --- a/temporal/t.rast.aggregate/testsuite/test_aggregation_absolute_parallel.py +++ b/temporal/t.rast.aggregate/testsuite/test_aggregation_absolute_parallel.py @@ -11,7 +11,6 @@ import os from datetime import datetime -import grass.pygrass.modules as pymod import grass.temporal as tgis from grass.gunittest.case import TestCase from grass.gunittest.gmodules import SimpleModule diff --git a/temporal/t.rast.aggregate/testsuite/test_aggregation_relative.py b/temporal/t.rast.aggregate/testsuite/test_aggregation_relative.py index 244b0d519d5..dc1da4c1cc3 100644 --- a/temporal/t.rast.aggregate/testsuite/test_aggregation_relative.py +++ b/temporal/t.rast.aggregate/testsuite/test_aggregation_relative.py @@ -10,7 +10,6 @@ import os -import grass.pygrass.modules as pymod import grass.temporal as tgis from grass.gunittest.case import TestCase from grass.gunittest.gmodules import SimpleModule diff --git a/temporal/t.rast.algebra/testsuite/test_raster_algebra_operators.py b/temporal/t.rast.algebra/testsuite/test_raster_algebra_operators.py index cf3d12a1aae..f07fabc9106 100644 --- a/temporal/t.rast.algebra/testsuite/test_raster_algebra_operators.py +++ b/temporal/t.rast.algebra/testsuite/test_raster_algebra_operators.py @@ -12,7 +12,6 @@ import grass.temporal as tgis from grass.gunittest.case import TestCase -from grass.gunittest.gmodules import SimpleModule from grass.gunittest.main import test diff --git a/temporal/t.rast.extract/testsuite/test_t_rast_extract.py b/temporal/t.rast.extract/testsuite/test_t_rast_extract.py index ca3c1a4c1db..b9fff4753c2 100644 --- a/temporal/t.rast.extract/testsuite/test_t_rast_extract.py +++ b/temporal/t.rast.extract/testsuite/test_t_rast_extract.py @@ -8,9 +8,6 @@ @author Soeren Gebbert """ -import subprocess - -import grass.pygrass.modules as pymod from grass.gunittest.case import TestCase from grass.gunittest.gmodules import SimpleModule diff --git a/temporal/t.rast.gapfill/testsuite/test_gapfill.py b/temporal/t.rast.gapfill/testsuite/test_gapfill.py index 7b083617d08..bfc8f48f581 100644 --- a/temporal/t.rast.gapfill/testsuite/test_gapfill.py +++ b/temporal/t.rast.gapfill/testsuite/test_gapfill.py @@ -8,8 +8,6 @@ @author Soeren Gebbert """ -import subprocess - from grass.gunittest.case import TestCase from grass.gunittest.gmodules import SimpleModule from grass.gunittest.utils import xfail_windows diff --git a/temporal/t.rast.neighbors/testsuite/test_neighbors.py b/temporal/t.rast.neighbors/testsuite/test_neighbors.py index 414b009fb1d..b48df4df169 100644 --- a/temporal/t.rast.neighbors/testsuite/test_neighbors.py +++ b/temporal/t.rast.neighbors/testsuite/test_neighbors.py @@ -5,6 +5,7 @@ """ import os + import grass.temporal as tgis from grass.gunittest.case import TestCase from grass.gunittest.gmodules import SimpleModule diff --git a/temporal/t.rast.series/testsuite/test_series.py b/temporal/t.rast.series/testsuite/test_series.py index e936e10e0e7..97df7c048fc 100644 --- a/temporal/t.rast.series/testsuite/test_series.py +++ b/temporal/t.rast.series/testsuite/test_series.py @@ -10,7 +10,6 @@ import os -import grass.pygrass.modules as pymod import grass.temporal as tgis from grass.gunittest.case import TestCase from grass.gunittest.gmodules import SimpleModule diff --git a/temporal/t.rast.to.rast3/testsuite/test_strds_to_rast3.py b/temporal/t.rast.to.rast3/testsuite/test_strds_to_rast3.py index 3a6eb7d45cc..28853ecbff1 100644 --- a/temporal/t.rast.to.rast3/testsuite/test_strds_to_rast3.py +++ b/temporal/t.rast.to.rast3/testsuite/test_strds_to_rast3.py @@ -8,11 +8,7 @@ @author Soeren Gebbert """ -import subprocess - -import grass.pygrass.modules as pymod from grass.gunittest.case import TestCase -from grass.gunittest.gmodules import SimpleModule class TestSTRDSToRast3(TestCase): diff --git a/temporal/t.rast.to.vect/testsuite/test_to_vect.py b/temporal/t.rast.to.vect/testsuite/test_to_vect.py index 2217b46a909..b429d8bf0dc 100644 --- a/temporal/t.rast.to.vect/testsuite/test_to_vect.py +++ b/temporal/t.rast.to.vect/testsuite/test_to_vect.py @@ -8,8 +8,6 @@ @author Soeren Gebbert """ -import subprocess - from grass.gunittest.case import TestCase from grass.gunittest.gmodules import SimpleModule diff --git a/temporal/t.rast.univar/testsuite/test_t_rast_univar.py b/temporal/t.rast.univar/testsuite/test_t_rast_univar.py index 17831b9b5b9..83e5c2d6229 100644 --- a/temporal/t.rast.univar/testsuite/test_t_rast_univar.py +++ b/temporal/t.rast.univar/testsuite/test_t_rast_univar.py @@ -9,6 +9,7 @@ """ from pathlib import Path + from grass.gunittest.case import TestCase from grass.gunittest.gmodules import SimpleModule from grass.gunittest.utils import xfail_windows diff --git a/temporal/t.rast3d.extract/testsuite/test_t_rast3d_extract.py b/temporal/t.rast3d.extract/testsuite/test_t_rast3d_extract.py index 4f0d476e0e8..3ae010e8423 100644 --- a/temporal/t.rast3d.extract/testsuite/test_t_rast3d_extract.py +++ b/temporal/t.rast3d.extract/testsuite/test_t_rast3d_extract.py @@ -8,9 +8,6 @@ :authors: Soeren Gebbert """ -import subprocess - -import grass.pygrass.modules as pymod from grass.gunittest.case import TestCase from grass.gunittest.gmodules import SimpleModule diff --git a/temporal/t.rast3d.univar/testsuite/test_t_rast3d_univar.py b/temporal/t.rast3d.univar/testsuite/test_t_rast3d_univar.py index 4ca64e88442..21980921168 100644 --- a/temporal/t.rast3d.univar/testsuite/test_t_rast3d_univar.py +++ b/temporal/t.rast3d.univar/testsuite/test_t_rast3d_univar.py @@ -9,6 +9,7 @@ """ from pathlib import Path + from grass.gunittest.case import TestCase from grass.gunittest.gmodules import SimpleModule from grass.gunittest.utils import xfail_windows diff --git a/temporal/t.shift/testsuite/test_shift.py b/temporal/t.shift/testsuite/test_shift.py index ea28e165995..3d55b059b4c 100644 --- a/temporal/t.shift/testsuite/test_shift.py +++ b/temporal/t.shift/testsuite/test_shift.py @@ -10,10 +10,8 @@ import os -import grass.pygrass.modules as pymod import grass.temporal as tgis from grass.gunittest.case import TestCase -from grass.gunittest.gmodules import SimpleModule class TestShiftAbsoluteSTRDS(TestCase): diff --git a/temporal/t.snap/testsuite/test_snap.py b/temporal/t.snap/testsuite/test_snap.py index 36a71c420bf..e46e25c454d 100644 --- a/temporal/t.snap/testsuite/test_snap.py +++ b/temporal/t.snap/testsuite/test_snap.py @@ -10,10 +10,8 @@ import os -import grass.pygrass.modules as pymod import grass.temporal as tgis from grass.gunittest.case import TestCase -from grass.gunittest.gmodules import SimpleModule class TestSnapAbsoluteSTRDS(TestCase): diff --git a/temporal/t.support/testsuite/test_support_str3ds.py b/temporal/t.support/testsuite/test_support_str3ds.py index 928826dbd72..533a9649692 100644 --- a/temporal/t.support/testsuite/test_support_str3ds.py +++ b/temporal/t.support/testsuite/test_support_str3ds.py @@ -10,10 +10,8 @@ import os -import grass.pygrass.modules as pymod import grass.temporal as tgis from grass.gunittest.case import TestCase -from grass.gunittest.gmodules import SimpleModule class TestSupportAbsoluteSTR3DS(TestCase): diff --git a/temporal/t.support/testsuite/test_support_strds.py b/temporal/t.support/testsuite/test_support_strds.py index f5e9ac3aa29..397a4a5e88d 100644 --- a/temporal/t.support/testsuite/test_support_strds.py +++ b/temporal/t.support/testsuite/test_support_strds.py @@ -10,10 +10,8 @@ import os -import grass.pygrass.modules as pymod import grass.temporal as tgis from grass.gunittest.case import TestCase -from grass.gunittest.gmodules import SimpleModule class TestSupportAbsoluteSTRDS(TestCase): diff --git a/temporal/t.support/testsuite/test_support_stvds.py b/temporal/t.support/testsuite/test_support_stvds.py index 2b6e347dead..b7ecc1aee01 100644 --- a/temporal/t.support/testsuite/test_support_stvds.py +++ b/temporal/t.support/testsuite/test_support_stvds.py @@ -10,10 +10,8 @@ import os -import grass.pygrass.modules as pymod import grass.temporal as tgis from grass.gunittest.case import TestCase -from grass.gunittest.gmodules import SimpleModule class TestSupportAbsoluteSTVDS(TestCase): diff --git a/temporal/t.unregister/testsuite/test_unregister.py b/temporal/t.unregister/testsuite/test_unregister.py index a32d33c1f32..b0102095e3d 100644 --- a/temporal/t.unregister/testsuite/test_unregister.py +++ b/temporal/t.unregister/testsuite/test_unregister.py @@ -10,7 +10,6 @@ import os -import grass.pygrass.modules as pymod import grass.temporal as tgis from grass.gunittest.case import TestCase from grass.gunittest.gmodules import SimpleModule diff --git a/vector/v.extract/testsuite/test_v_extract.py b/vector/v.extract/testsuite/test_v_extract.py index 958f153d1a3..c46505a5527 100644 --- a/vector/v.extract/testsuite/test_v_extract.py +++ b/vector/v.extract/testsuite/test_v_extract.py @@ -11,7 +11,6 @@ import os from grass.gunittest.case import TestCase -from grass.gunittest.gmodules import SimpleModule from grass.script.core import read_command TABLE_1 = """cat|MAJORRDS_|ROAD_NAME|MULTILANE|PROPYEAR|OBJECTID|SHAPE_LEN diff --git a/vector/v.fill.holes/examples.ipynb b/vector/v.fill.holes/examples.ipynb index fcc006501e4..a6b3ea746ce 100644 --- a/vector/v.fill.holes/examples.ipynb +++ b/vector/v.fill.holes/examples.ipynb @@ -15,12 +15,10 @@ "metadata": {}, "outputs": [], "source": [ - "import os\n", "import sys\n", "\n", "from IPython.display import Image\n", "\n", - "import grass.script as gs\n", "import grass.jupyter as gj" ] }, diff --git a/vector/v.in.ogr/testsuite/test_v_in_ogr.py b/vector/v.in.ogr/testsuite/test_v_in_ogr.py index 167cd8747e8..31d2ef7ef3b 100644 --- a/vector/v.in.ogr/testsuite/test_v_in_ogr.py +++ b/vector/v.in.ogr/testsuite/test_v_in_ogr.py @@ -4,7 +4,6 @@ """ from grass.gunittest.case import TestCase -from grass.gunittest.gmodules import SimpleModule class TestOgrImport(TestCase): From 058270914eafaf09b4b7e8c49c0590936890d0a2 Mon Sep 17 00:00:00 2001 From: Arohan Ajit Date: Wed, 23 Oct 2024 17:13:03 -0400 Subject: [PATCH 07/50] wxGUI: Fixed F841 in psmap/ (#4574) --- .flake8 | 6 +-- gui/wxpython/psmap/dialogs.py | 24 +--------- gui/wxpython/psmap/frame.py | 74 +++++++++++++++--------------- gui/wxpython/psmap/instructions.py | 2 +- 4 files changed, 41 insertions(+), 65 deletions(-) diff --git a/.flake8 b/.flake8 index 9985b8e5a42..5d951306ad1 100644 --- a/.flake8 +++ b/.flake8 @@ -24,9 +24,9 @@ per-file-ignores = gui/scripts/d.wms.py: E501 gui/wxpython/image2target/g.gui.image2target.py: E501 gui/wxpython/nviz/*: E722 - gui/wxpython/photo2image/*: E722 - gui/wxpython/photo2image/g.gui.photo2image.py: E501 - gui/wxpython/psmap/*: F841, E266, E722 + gui/wxpython/photo2image/*: F841, E722, E265 + gui/wxpython/photo2image/g.gui.photo2image.py: E501, F841 + gui/wxpython/psmap/*: E501, E722 gui/wxpython/vdigit/*: F841, E722, F405, F403 gui/wxpython/animation/g.gui.animation.py: E501 gui/wxpython/tplot/frame.py: F841, E722 diff --git a/gui/wxpython/psmap/dialogs.py b/gui/wxpython/psmap/dialogs.py index c4784525cc9..f086d65dd36 100644 --- a/gui/wxpython/psmap/dialogs.py +++ b/gui/wxpython/psmap/dialogs.py @@ -5731,8 +5731,6 @@ def updateDialog(self): y = self.unitConv.convert(value=y, fromUnit="inch", toUnit=currUnit) self.positionPanel.position["xCtrl"].SetValue("%5.3f" % x) self.positionPanel.position["yCtrl"].SetValue("%5.3f" % y) - # EN coordinates - e, n = self.textDict["east"], self.textDict["north"] self.positionPanel.position["eCtrl"].SetValue(str(self.textDict["east"])) self.positionPanel.position["nCtrl"].SetValue(str(self.textDict["north"])) @@ -6027,7 +6025,7 @@ def OnImageSelectionChanged(self, event): pImg = PILImage.open(file) img = PilImageToWxImage(pImg) except OSError as e: - GError(message=_("Unable to read file %s") % file) + GError(message=_("Unable to read file %s: %s") % (file, str(e))) self.ClearPreview() return self.SetSizeInfoLabel(img) @@ -6140,15 +6138,6 @@ def update(self): else: self.imageDict["XY"] = False - if self.positionPanel.position["eCtrl"].GetValue(): - e = self.positionPanel.position["eCtrl"].GetValue() - else: - self.imageDict["east"] = self.imageDict["east"] - - if self.positionPanel.position["nCtrl"].GetValue(): - n = self.positionPanel.position["nCtrl"].GetValue() - else: - self.imageDict["north"] = self.imageDict["north"] x, y = PaperMapCoordinates( mapInstr=self.instruction[self.mapId], @@ -6211,7 +6200,6 @@ def updateDialog(self): self.positionPanel.position["xCtrl"].SetValue("%5.3f" % x) self.positionPanel.position["yCtrl"].SetValue("%5.3f" % y) # EN coordinates - e, n = self.imageDict["east"], self.imageDict["north"] self.positionPanel.position["eCtrl"].SetValue(str(self.imageDict["east"])) self.positionPanel.position["nCtrl"].SetValue(str(self.imageDict["north"])) @@ -6526,15 +6514,6 @@ def update(self): else: self.pointDict["XY"] = False - if self.positionPanel.position["eCtrl"].GetValue(): - e = self.positionPanel.position["eCtrl"].GetValue() - else: - self.pointDict["east"] = self.pointDict["east"] - - if self.positionPanel.position["nCtrl"].GetValue(): - n = self.positionPanel.position["nCtrl"].GetValue() - else: - self.pointDict["north"] = self.pointDict["north"] x, y = PaperMapCoordinates( mapInstr=self.instruction[self.mapId], @@ -6590,7 +6569,6 @@ def updateDialog(self): self.positionPanel.position["xCtrl"].SetValue("%5.3f" % x) self.positionPanel.position["yCtrl"].SetValue("%5.3f" % y) # EN coordinates - e, n = self.pointDict["east"], self.pointDict["north"] self.positionPanel.position["eCtrl"].SetValue(str(self.pointDict["east"])) self.positionPanel.position["nCtrl"].SetValue(str(self.pointDict["north"])) diff --git a/gui/wxpython/psmap/frame.py b/gui/wxpython/psmap/frame.py index 1d937483123..e86b277252c 100644 --- a/gui/wxpython/psmap/frame.py +++ b/gui/wxpython/psmap/frame.py @@ -195,7 +195,6 @@ def __init__( self.getInitMap() # image path - env = gs.gisenv() self.imgName = gs.tempfile() # canvas for preview @@ -513,45 +512,44 @@ def OnCmdDone(self, event): env=self.env, ) # wx.BusyInfo does not display the message - busy = wx.BusyInfo(_("Generating preview, wait please"), parent=self) - wx.GetApp().Yield() - try: - im = PILImage.open(event.userData["filename"]) - if self.instruction[self.pageId]["Orientation"] == "Landscape": - import numpy as np - - im_array = np.array(im) - im = PILImage.fromarray(np.rot90(im_array, 3)) - im.save(self.imgName, format="PNG") - except OSError: - del busy - program = self._getGhostscriptProgramName() - dlg = HyperlinkDialog( - self, - title=_("Preview not available"), - message=_( - "Preview is not available probably because Ghostscript is not " - "installed or not on PATH." - ), - hyperlink="https://www.ghostscript.com/releases/gsdnld.html", - hyperlinkLabel=_( - "You can download {program} {arch} version here." - ).format( - program=program, - arch="64bit" if "64" in program else "32bit", - ), - ) - dlg.ShowModal() - dlg.Destroy() - return + with wx.BusyInfo(_("Generating preview, wait please"), parent=self): + wx.GetApp().Yield() + try: + im = PILImage.open(event.userData["filename"]) + if self.instruction[self.pageId]["Orientation"] == "Landscape": + import numpy as np + + im_array = np.array(im) + im = PILImage.fromarray(np.rot90(im_array, 3)) + im.save(self.imgName, format="PNG") + except OSError: + del busy + program = self._getGhostscriptProgramName() + dlg = HyperlinkDialog( + self, + title=_("Preview not available"), + message=_( + "Preview is not available probably because Ghostscript is not " + "installed or not on PATH." + ), + hyperlink="https://www.ghostscript.com/releases/gsdnld.html", + hyperlinkLabel=_( + "You can download {program} {arch} version here." + ).format( + program=program, + arch="64bit" if "64" in program else "32bit", + ), + ) + dlg.ShowModal() + dlg.Destroy() + return - self.book.SetSelection(1) - self.currentPage = 1 - rect = self.previewCanvas.ImageRect() - self.previewCanvas.image = wx.Image(self.imgName, wx.BITMAP_TYPE_PNG) - self.previewCanvas.DrawImage(rect=rect) + self.book.SetSelection(1) + self.currentPage = 1 + rect = self.previewCanvas.ImageRect() + self.previewCanvas.image = wx.Image(self.imgName, wx.BITMAP_TYPE_PNG) + self.previewCanvas.DrawImage(rect=rect) - del busy self.SetStatusText(_("Preview generated"), 0) gs.try_remove(event.userData["instrFile"]) diff --git a/gui/wxpython/psmap/instructions.py b/gui/wxpython/psmap/instructions.py index 845e99b2e6a..82560353806 100644 --- a/gui/wxpython/psmap/instructions.py +++ b/gui/wxpython/psmap/instructions.py @@ -1751,7 +1751,7 @@ def EstimateHeight(self, raster, discrete, fontsize, cols=None, height=None): rinfo = gs.raster_info(raster) if rinfo["datatype"] in {"DCELL", "FCELL"}: - minim, maxim = rinfo["min"], rinfo["max"] + maxim = rinfo["max"] rows = ceil(maxim / cols) else: cat = ( From 3d7b331ba8e059217e8f6c7d1a6b2d13e6e4781e Mon Sep 17 00:00:00 2001 From: Arohan Ajit Date: Wed, 23 Oct 2024 17:17:00 -0400 Subject: [PATCH 08/50] r.in.srtm: Fix exception handling and add specific error types (#4571) --- .flake8 | 1 - scripts/r.in.srtm/r.in.srtm.py | 5 +++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.flake8 b/.flake8 index 5d951306ad1..7bc3070d15e 100644 --- a/.flake8 +++ b/.flake8 @@ -102,7 +102,6 @@ per-file-ignores = scripts/db.univar/db.univar.py: E501 scripts/d.frame/d.frame.py: E722 scripts/i.pansharpen/i.pansharpen.py: E722, E501 - scripts/r.in.srtm/r.in.srtm.py: E722 scripts/r.fillnulls/r.fillnulls.py: E722 scripts/v.what.strds/v.what.strds.py: E501 # Line too long (esp. module interface definitions) diff --git a/scripts/r.in.srtm/r.in.srtm.py b/scripts/r.in.srtm/r.in.srtm.py index b9f51415ca0..49c7cef9758 100755 --- a/scripts/r.in.srtm/r.in.srtm.py +++ b/scripts/r.in.srtm/r.in.srtm.py @@ -76,6 +76,7 @@ import atexit import grass.script as gs import zipfile as zfile +from grass.exceptions import CalledModuleError tmpl1sec = """BYTEORDER M @@ -227,7 +228,7 @@ def main(): try: zf = zfile.ZipFile(zipfile) zf.extractall() - except: + except (zfile.BadZipfile, zfile.LargeZipFile, PermissionError): gs.fatal(_("Unable to unzip file.")) gs.message(_("Converting input file to BIL...")) @@ -274,7 +275,7 @@ def main(): try: gs.run_command("r.in.gdal", input=bilfile, out=tileout) - except: + except CalledModuleError: gs.fatal(_("Unable to import data")) # nice color table From cc0fb732328f6f3a0137eddcd937c7c3e2badcab Mon Sep 17 00:00:00 2001 From: Moritz Lennert Date: Thu, 24 Oct 2024 17:39:24 +0200 Subject: [PATCH 09/50] i.segment.html: parameter names and links to other modules (#4483) --- imagery/i.segment/i.segment.html | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/imagery/i.segment/i.segment.html b/imagery/i.segment/i.segment.html index e30f21d3743..43d5e5fde68 100644 --- a/imagery/i.segment/i.segment.html +++ b/imagery/i.segment/i.segment.html @@ -100,11 +100,11 @@

Goodness of Fit

Mean shift

Mean shift image segmentation consists of 2 steps: anisotrophic filtering and 2. clustering. For anisotrophic filtering new cell values -are calculated from all pixels not farther than hs pixels away +are calculated from all pixels not farther than radius pixels away from the current pixel and with a spectral difference not larger than hr. That means that pixels that are too different from the current pixel are not considered in the calculation of new pixel values. -hs and hr are the spatial and spectral (range) bandwidths +radius and hr are the spatial and spectral (range) bandwidths for anisotrophic filtering. Cell values are iteratively recalculated (shifted to the segment's mean) until the maximum number of iterations is reached or until the largest shift is smaller than threshold. @@ -251,8 +251,6 @@

Functionality

Use of Segmentation Results

    -
  • Improve the optional output from this module, or better yet, add a -module for i.segment.metrics.
  • Providing updates to i.maxlik to ensure the segmentation output can be used as input for the existing classification functionality.
  • @@ -277,6 +275,9 @@

    REFERENCES

    SEE ALSO

    +i.segment.stats (addon), +i.segment.uspo (addon), +i.segment.hierarchical (addon) g.gui.iclass, i.group, i.maxlik, From 0860b87ec7b6f69ae48319bbee151857947cc15e Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 24 Oct 2024 23:53:58 -0400 Subject: [PATCH 10/50] CI(deps): Update ruff to v0.7.1 (#4587) --- .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 94a8d0be26b..9aaa37a7db1 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.0" + RUFF_VERSION: "0.7.1" runs-on: ${{ matrix.os }} permissions: diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 4c82e138950..2f3216877de 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.0 + rev: v0.7.1 hooks: # Run the linter. - id: ruff From bbe66e460d19d1e6ca3d51694a1c1aaf350bd8ed Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 24 Oct 2024 23:54:27 -0400 Subject: [PATCH 11/50] CI(deps): Update actions/setup-python action to v5.3.0 (#4583) --- .github/workflows/additional_checks.yml | 2 +- .github/workflows/codeql-analysis.yml | 2 +- .github/workflows/create_release_draft.yml | 2 +- .github/workflows/pytest.yml | 2 +- .github/workflows/python-code-quality.yml | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/additional_checks.yml b/.github/workflows/additional_checks.yml index a2fbfadc36f..76554f24db3 100644 --- a/.github/workflows/additional_checks.yml +++ b/.github/workflows/additional_checks.yml @@ -43,7 +43,7 @@ jobs: exclude: mswindows .*\.bat .*/testsuite/data/.* - name: Set up Python - uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5.2.0 + uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0 with: python-version: '3.10' diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 9c161300170..d98950b0818 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -42,7 +42,7 @@ jobs: - name: Checkout repository uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - name: Set up Python - uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5.2.0 + uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0 with: python-version: '3.x' - name: Install non-Python dependencies diff --git a/.github/workflows/create_release_draft.yml b/.github/workflows/create_release_draft.yml index 6c3597599fc..efefb0fd0c7 100644 --- a/.github/workflows/create_release_draft.yml +++ b/.github/workflows/create_release_draft.yml @@ -35,7 +35,7 @@ jobs: ref: ${{ github.ref }} fetch-depth: 0 - name: Set up Python - uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5.2.0 + uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0 with: python-version: '3.11' - name: Create output directory diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml index b28fb40ad14..3fea65773ce 100644 --- a/.github/workflows/pytest.yml +++ b/.github/workflows/pytest.yml @@ -35,7 +35,7 @@ jobs: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - name: Set up Python - uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5.2.0 + uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0 with: python-version: ${{ matrix.python-version }} cache: pip diff --git a/.github/workflows/python-code-quality.yml b/.github/workflows/python-code-quality.yml index 9aaa37a7db1..aa6bd33724f 100644 --- a/.github/workflows/python-code-quality.yml +++ b/.github/workflows/python-code-quality.yml @@ -57,7 +57,7 @@ jobs: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - name: Set up Python - uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5.2.0 + uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0 with: python-version: ${{ env.PYTHON_VERSION }} cache: pip From b6514ca8afc5b82a080f3b694a49a8684ff4defc Mon Sep 17 00:00:00 2001 From: Makiko Shukunobe Date: Thu, 24 Oct 2024 23:56:18 -0400 Subject: [PATCH 12/50] tests: Add regression test for r.his (#4572) * Add tests to r.his * Add assertRasterFitsUnivar * Update assertRasterFitsUnivar * Add g.region to make r.univar values consistent * Update raster/r.his/testsuite/test_r_his.py Apply the suggestion. Co-authored-by: Anna Petrasova * Update raster/r.his/testsuite/test_r_his.py Apply the suggestion. Co-authored-by: Anna Petrasova * Update raster/r.his/testsuite/test_r_his.py Black styling --------- Co-authored-by: Anna Petrasova --- raster/r.his/testsuite/test_r_his.py | 91 ++++++++++++++++++++++++++++ 1 file changed, 91 insertions(+) create mode 100644 raster/r.his/testsuite/test_r_his.py diff --git a/raster/r.his/testsuite/test_r_his.py b/raster/r.his/testsuite/test_r_his.py new file mode 100644 index 00000000000..da56d633b6d --- /dev/null +++ b/raster/r.his/testsuite/test_r_his.py @@ -0,0 +1,91 @@ +from grass.gunittest.case import TestCase +from grass.gunittest.main import test + + +class TestRHis(TestCase): + hue = "elevation" + intensity = "elevation_shaded_50" + saturation = "elevation" + red = "shadedmap_r" + green = "shadedmap_g" + blue = "shadedmap_b" + bgcolor = "none" + + @classmethod + def setUpClass(cls): + cls.use_temp_region() + cls.runModule("g.region", raster="elevation") + cls.elev_shade = "elevation_shaded_relief" + cls.runModule("r.relief", input="elevation", output=cls.elev_shade) + cls.runModule( + "r.mapcalc", expression=f"{cls.intensity} = {cls.elev_shade} * 1.5" + ) + cls.runModule("r.colors", map=cls.intensity, color="grey255") + + @classmethod + def tearDownClass(cls): + cls.runModule( + "g.remove", type="raster", flags="f", name=[cls.intensity, cls.elev_shade] + ) + cls.del_temp_region() + + def tearDown(self): + """Remove d.his generated rasters after each test method""" + self.runModule("g.remove", type="raster", flags="f", pattern="shadedmap_*") + + def test_bgcolor_none(self): + """Test r.his with bgcolor 'none'""" + self.runModule( + "r.his", + hue=self.hue, + intensity=self.intensity, + saturation=self.saturation, + red=self.red, + green=self.green, + blue=self.blue, + bgcolor=self.bgcolor, + ) + + red_value = "null_cells=5696\nmin=3\nmax=255\nmean=156.41168\nstddev=34.434612" + blue_value = "null_cells=5696\nmin=0\nmax=127\nmean=36.05560\nstddev=37.61216" + green_value = "null_cells=5696\nmin=1\nmax=255\nmean=129.62880\nstddev=34.48307" + + self.assertRasterFitsUnivar( + raster=self.red, reference=red_value, precision=1e-5 + ) + self.assertRasterFitsUnivar( + raster=self.blue, reference=blue_value, precision=1e-5 + ) + self.assertRasterFitsUnivar( + raster=self.green, reference=green_value, precision=1e-5 + ) + + def test_with_bgcolor_rgb(self): + """Test r.his with bgcolor '0:0:0'""" + self.runModule( + "r.his", + hue=self.hue, + intensity=self.intensity, + saturation=self.saturation, + red=self.red, + green=self.green, + blue=self.blue, + bgcolor="0:0:0", + ) + + red_value = "null_cells=0\nmin=0\nmax=255\nmean=155.97172\nstddev=35.36988" + blue_value = "null_cells=0\nmin=0\nmax=127\nmean=35.95417\nstddev=37.60774" + green_value = "null_cells=0\nmin=0\nmax=255\nmean=129.26418\nstddev=35.11225" + self.assertRasterFitsUnivar( + raster=self.red, reference=red_value, precision=1e-5 + ) + self.assertRasterFitsUnivar( + raster=self.blue, reference=blue_value, precision=1e-5 + ) + self.assertRasterFitsUnivar( + raster=self.green, reference=green_value, precision=1e-5 + ) + + +if __import__("__main__"): + test() From 5b94314a82de7e9c78fd6044659ea9d6c2323edb Mon Sep 17 00:00:00 2001 From: Markus Neteler Date: Fri, 25 Oct 2024 16:16:09 +0200 Subject: [PATCH 13/50] manual: mention raster semantic labels and multiple http/https fixes (#4591) * r.support/i.band.library/r.semantic.label: better mention raster semantic labels * v.db.reconnect.all: add missing keywords * URLs: selectively change http to https; fix a few broken URLs --- AUTHORS | 2 +- REQUIREMENTS.md | 4 ++-- TODO | 4 ++-- binaryInstall.src | 2 +- configure.ac | 2 +- db/drivers/mysql/grass-mesql.html | 2 +- db/drivers/mysql/grass-mysql.html | 2 +- db/drivers/odbc/INSTALL | 2 +- db/drivers/odbc/grass-odbc.html | 6 ++--- db/drivers/postgres/README | 2 +- db/drivers/postgres/grass-pg.html | 10 ++++---- db/drivers/sqlite/README | 2 +- db/drivers/sqlite/fetch.c | 2 +- db/drivers/sqlite/grass-sqlite.html | 12 +++++----- doc/debugging.txt | 2 +- doc/development/rfc/PSC_guidelines.md | 2 +- doc/development/rfc/PSC_voting_procedures.md | 6 ++--- .../legal_aspects_of_code_contributions.md | 2 +- doc/development/style_guide.md | 4 ++-- doc/gui/wxpython/example/g.gui.example.html | 2 +- doc/vector/TODO | 10 ++++---- general/g.list/g.list.html | 2 +- general/g.version/g.version.html | 4 ++-- gui/wxpython/animation/dialogs.py | 2 +- gui/wxpython/animation/g.gui.animation.html | 2 +- gui/wxpython/core/settings.py | 2 +- gui/wxpython/docs/wxGUI.html | 2 +- gui/wxpython/docs/wxgui_sphinx/src/index.rst | 2 +- gui/wxpython/iclass/dialogs.py | 2 +- gui/wxpython/iclass/g.gui.iclass.html | 6 ++--- gui/wxpython/iscatt/iscatt_core.py | 4 ++-- gui/wxpython/iscatt/plots.py | 2 +- gui/wxpython/mapswipe/g.gui.mapswipe.html | 2 +- gui/wxpython/timeline/frame.py | 2 +- gui/wxpython/timeline/g.gui.timeline.html | 4 ++-- gui/wxpython/tplot/frame.py | 2 +- gui/wxpython/tplot/g.gui.tplot.html | 2 +- imagery/i.atcorr/i.atcorr.html | 4 ++-- imagery/i.biomass/i.biomass.html | 2 +- imagery/i.cluster/i.cluster.html | 2 +- imagery/i.eb.eta/i.eb.eta.html | 6 ++--- imagery/i.eb.evapfr/i.eb.evapfr.html | 6 ++--- imagery/i.eb.hsebal01/i.eb.hsebal01.html | 6 ++--- imagery/i.eb.netrad/i.eb.netrad.html | 4 ++-- .../i.eb.soilheatflux/i.eb.soilheatflux.html | 6 ++--- imagery/i.emissivity/i.emissivity.html | 2 +- imagery/i.fft/i.fft.html | 4 ++-- imagery/i.ifft/i.ifft.html | 2 +- imagery/i.landsat.toar/i.landsat.toar.html | 2 +- imagery/i.ortho.photo/README | 2 +- imagery/i.ortho.photo/lib/TODO | 2 +- imagery/i.rectify/i.rectify.html | 4 ++-- imagery/i.vi/evi2.c | 2 +- imagery/i.vi/i.vi.html | 10 ++++---- imagery/imageryintro.html | 2 +- include/Make/Doxyfile_arch_html.in | 12 +++++----- include/Make/Doxyfile_arch_latex.in | 12 +++++----- include/grass/defs/gprojects.h | 2 +- include/grass/gprojects.h | 2 +- lib/cairodriver/cairodriver.dox | 2 +- lib/db/README | 2 +- lib/db/dbmi_base/default_name.c | 2 +- lib/db/dbmilib.dox | 6 ++--- lib/db/sqlp/sql.html | 8 +++---- lib/gmath/gmathlib.dox | 4 ++-- lib/init/variables.html | 2 +- lib/vector/Vlib/buffer2.c | 2 +- lib/vector/Vlib/legal_vname.c | 2 +- lib/vector/vectorlib_pg.dox | 4 ++-- locale/po/grassmods_ar.po | 2 +- locale/po/grassmods_bn.po | 2 +- locale/po/grassmods_cs.po | 2 +- locale/po/grassmods_de.po | 2 +- locale/po/grassmods_el.po | 2 +- locale/po/grassmods_es.po | 2 +- locale/po/grassmods_fi.po | 2 +- locale/po/grassmods_fr.po | 2 +- locale/po/grassmods_hu.po | 2 +- locale/po/grassmods_id_ID.po | 2 +- locale/po/grassmods_it.po | 2 +- locale/po/grassmods_ja.po | 2 +- locale/po/grassmods_ko.po | 2 +- locale/po/grassmods_lv.po | 2 +- locale/po/grassmods_ml.po | 2 +- locale/po/grassmods_pl.po | 2 +- locale/po/grassmods_pt.po | 2 +- locale/po/grassmods_pt_BR.po | 2 +- locale/po/grassmods_ro.po | 2 +- locale/po/grassmods_ru.po | 2 +- locale/po/grassmods_si.po | 2 +- locale/po/grassmods_sl.po | 2 +- locale/po/grassmods_ta.po | 2 +- locale/po/grassmods_th.po | 2 +- locale/po/grassmods_tr.po | 2 +- locale/po/grassmods_uk.po | 2 +- locale/po/grassmods_vi.po | 2 +- locale/po/grassmods_zh.po | 2 +- locale/po/grassmods_zh_CN.po | 2 +- locale/templates/grassmods.pot | 2 +- macosx/ReadMe.md | 2 +- mswindows/README.html | 2 +- mswindows/external/rbatch/R.bat | 4 ++-- mswindows/external/rbatch/README.grass | 2 +- mswindows/external/rbatch/Rpathset.bat | 2 +- mswindows/external/rbatch/batchfiles.md | 2 +- mswindows/external/rbatch/batchfiles.tex | 2 +- mswindows/external/rbatch/copydir.bat | 2 +- mswindows/external/rbatch/movedir.bat | 2 +- python/grass/docs/src/pygrass_index.rst | 4 ++-- python/grass/docs/src/pygrass_modules.rst | 2 +- python/grass/docs/src/temporal_framework.rst | 2 +- python/grass/gunittest/reporters.py | 2 +- python/grass/imaging/images2gif.py | 2 +- .../grass/pygrass/modules/interface/module.py | 2 +- python/grass/script/utils.py | 2 +- .../ctypesgen/parser/yacc.py | 2 +- .../ctypesgen/printer_json/printer.py | 2 +- raster/r.buildvrt/r.buildvrt.html | 4 ++-- raster/r.composite/r.composite.html | 2 +- raster/r.external.out/r.external.out.html | 2 +- raster/r.external/r.external.html | 2 +- raster/r.fill.stats/r.fill.stats.html | 2 +- raster/r.geomorphon/r.geomorphon.html | 2 +- raster/r.grow.distance/r.grow.distance.html | 4 ++-- raster/r.in.gdal/r.in.gdal.html | 6 ++--- raster/r.in.xyz/r.in.xyz.html | 2 +- raster/r.out.gdal/r.out.gdal.html | 10 ++++---- raster/r.out.mpeg/r.out.mpeg.html | 2 +- raster/r.resamp.filter/r.resamp.filter.html | 4 ++-- .../r.sim/r.sim.sediment/r.sim.sediment.html | 2 +- raster/r.sim/r.sim.water/r.sim.water.html | 2 +- raster/r.stream.extract/r.stream.extract.html | 2 +- raster/r.sun/TODO | 4 ++-- raster/r.sun/r.sun.html | 2 +- raster/r.support/r.support.html | 13 ++++++---- raster/r.surf.fractal/r.surf.fractal.html | 2 +- raster/r.watershed/front/r.watershed.html | 8 +++---- raster3d/r3.flow/r3.flow.html | 2 +- raster3d/r3.out.netcdf/main.c | 2 +- raster3d/r3.out.netcdf/r3.out.netcdf.html | 2 +- scripts/d.polar/d.polar.html | 2 +- scripts/db.in.ogr/db.in.ogr.html | 4 ++-- scripts/i.band.library/i.band.library.html | 10 ++++---- scripts/i.in.spotvgt/i.in.spotvgt.py | 6 ++--- scripts/i.pansharpen/i.pansharpen.html | 2 +- scripts/r.grow/r.grow.html | 4 ++-- scripts/r.in.wms/r.in.wms.html | 2 +- .../r.semantic.label/r.semantic.label.html | 8 +++---- scripts/v.db.dropcolumn/v.db.dropcolumn.py | 2 +- scripts/v.db.join/v.db.join.html | 6 ++--- .../v.db.reconnect.all/v.db.reconnect.all.py | 2 ++ scripts/v.import/v.import.html | 8 +++---- scripts/v.in.e00/v.in.e00.html | 2 +- scripts/v.in.geonames/v.in.geonames.html | 2 +- temporal/t.rast.algebra/t.rast.algebra.html | 4 ++-- temporal/temporalintro.html | 4 ++-- vector/v.buffer/v.buffer.html | 2 +- vector/v.cluster/v.cluster.html | 4 ++-- vector/v.external.out/v.external.out.html | 14 +++++------ vector/v.external/v.external.html | 4 ++-- vector/v.in.dxf/v.in.dxf.html | 2 +- vector/v.kernel/v.kernel.html | 6 ++--- vector/v.label.sa/v.label.sa.html | 2 +- vector/v.net.bridge/v.net.bridge.html | 4 ++-- vector/v.net.centrality/v.net.centrality.html | 2 +- vector/v.net.flow/v.net.flow.html | 2 +- vector/v.net/v.net.html | 2 +- vector/v.out.ascii/v.out.ascii.html | 2 +- vector/v.out.dxf/v.out.dxf.html | 2 +- vector/v.out.ogr/v.out.ogr.html | 24 +++++++++---------- vector/v.out.postgis/v.out.postgis.html | 4 ++-- vector/v.surf.rst/v.surf.rst.html | 2 +- vector/v.univar/main.c | 2 +- vector/v.vol.rst/v.vol.rst.html | 2 +- vector/v.voronoi/v.voronoi.html | 2 +- 175 files changed, 296 insertions(+), 293 deletions(-) diff --git a/AUTHORS b/AUTHORS index a81f5a75e39..952b369702f 100644 --- a/AUTHORS +++ b/AUTHORS @@ -206,7 +206,7 @@ MS-Windows/Cygwin: Huidae Cho Source code Quality assessment system - SOCCER Labs at Ecole Polytechnique de Montreal, Canada http://web.soccerlab.polymtl.ca/grass-evolution/grass-browsers/grass-index-en.html - http://lists.osgeo.org/mailman/listinfo/grass-qa + https://lists.osgeo.org/mailman/listinfo/grass-qa GRASS 5.7/6.0: Primary authors of new source code diff --git a/REQUIREMENTS.md b/REQUIREMENTS.md index 7b2757d38f5..5d173133716 100644 --- a/REQUIREMENTS.md +++ b/REQUIREMENTS.md @@ -49,7 +49,7 @@ Note: also the respective development packages (commonly named `xxx-dev` or [https://facebook.github.io/zstd](https://facebook.github.io/zstd) - **FFTW 2.x or 3.x** (library for computing the Discrete Fourier Transform), required for `i.fft` and `i.ifft` and other modules - [http://www.fftw.org](http://www.fftw.org) + [https://fftw.org](https://fftw.org) - **GEOS** (Geometry Engine library), needed for `v.buffer` and adds extended options to the `v.select` module [https://libgeos.org/](https://libgeos.org/) @@ -81,7 +81,7 @@ Note: also the respective development packages (commonly named `xxx-dev` or - **SQLite libraries** (for the SQLite database interface) [https://www.sqlite.org](https://www.sqlite.org) - **unixODBC** (for the ODBC database interface) - [http://www.unixodbc.org](http://www.unixodbc.org) + [https://www.unixodbc.org](https://www.unixodbc.org) - **R Statistics** (for the R statistical language interface) [https://cran.r-project.org](https://cran.r-project.org) - **FreeType2** (for TrueType font support and `d.text.freetype`) diff --git a/TODO b/TODO index 510d38dfa6b..5750175258e 100644 --- a/TODO +++ b/TODO @@ -39,6 +39,6 @@ Imagery ----------------- See also -http://trac.osgeo.org/grass/wiki/Grass7Planning +https://trac.osgeo.org/grass/wiki/Grass7Planning -http://trac.osgeo.org/grass/wiki/Grass8Planning +https://trac.osgeo.org/grass/wiki/Grass8Planning diff --git a/binaryInstall.src b/binaryInstall.src index 5ab008dd796..2bcb3165327 100755 --- a/binaryInstall.src +++ b/binaryInstall.src @@ -109,7 +109,7 @@ if [ $? -eq 0 ] ; then IFS="$IFSSAVE" if [ ! "$GUNZIP" ] ; then echo "No gunzip installed. Please get from:" - echo " http://www.gnu.org/software/gzip/gzip.html" + echo " https://www.gnu.org/software/gzip/gzip.html" exit fi else diff --git a/configure.ac b/configure.ac index 52a985960c3..fc3403163da 100644 --- a/configure.ac +++ b/configure.ac @@ -15,7 +15,7 @@ # Public License (>=v2). Read the file COPYING that # comes with GRASS for details. # -# MANUAL: http://www.gnu.org/software/autoconf/manual/autoconf.html +# MANUAL: https://www.gnu.org/software/autoconf/manual/autoconf.html # http://savannah.gnu.org/projects/autoconf/ # Website for config.guess, config.sub: # wget http://git.savannah.gnu.org/cgit/config.git/plain/config.guess diff --git a/db/drivers/mysql/grass-mesql.html b/db/drivers/mysql/grass-mesql.html index 8e2aca2155c..e04b30a2a8f 100644 --- a/db/drivers/mysql/grass-mesql.html +++ b/db/drivers/mysql/grass-mesql.html @@ -83,7 +83,7 @@

    AUTHOR

    Credits: Development of the driver was sponsored by -Faunalia (Italy) +Faunalia (Italy) as part of a project for ATAC. diff --git a/db/drivers/mysql/grass-mysql.html b/db/drivers/mysql/grass-mysql.html index 60c7fbe4f78..af8c0273d98 100644 --- a/db/drivers/mysql/grass-mysql.html +++ b/db/drivers/mysql/grass-mysql.html @@ -116,7 +116,7 @@

    SEE ALSO

    Credits

    Development of the driver was sponsored by -Faunalia (Italy) +Faunalia (Italy) as part of a project for ATAC.

    AUTHOR

    diff --git a/db/drivers/odbc/INSTALL b/db/drivers/odbc/INSTALL index 74928ff55a6..3f485ee3f20 100644 --- a/db/drivers/odbc/INSTALL +++ b/db/drivers/odbc/INSTALL @@ -1,4 +1,4 @@ -1. Download, compile, install and configure ODBC (http://www.unixodbc.org/) +1. Download, compile, install and configure ODBC (https://www.unixodbc.org/) 2. Copy ODBC include files to /usr/include/odbc 3. Compile src/libes/dbmi/drivers/odbc 4. Add row for ODBC driver to dbmscap file diff --git a/db/drivers/odbc/grass-odbc.html b/db/drivers/odbc/grass-odbc.html index 7692893ca92..75a5ca578d7 100644 --- a/db/drivers/odbc/grass-odbc.html +++ b/db/drivers/odbc/grass-odbc.html @@ -95,10 +95,10 @@

    Linux

     ConnSettings            = Configuration of an DSN without GUI is described on -http://www.unixodbc.org/odbcinst.html, +https://www.unixodbc.org/odbcinst.html, but odbc.ini and .odbc.ini may be created by the 'ODBCConfig' tool. You can easily view your DSN structure by 'DataManager'. Configuration with -GUI is described on http://www.unixodbc.org/doc/UserManual/ +GUI is described on https://www.unixodbc.org/doc/UserManual/

    To find out about your PostgreSQL protocol, run:

    @@ -159,6 +159,6 @@ 

    SEE ALSO

    db.connect, v.db.connect, -unixODBC web site, +unixODBC web site, SQL support in GRASS GIS diff --git a/db/drivers/postgres/README b/db/drivers/postgres/README index 254a0fd28c9..a2959739f6e 100644 --- a/db/drivers/postgres/README +++ b/db/drivers/postgres/README @@ -19,7 +19,7 @@ Check also for PostgreSQL data types for defining them in GRASS: Supported types in ./globals.h: -(See http://www.postgresql.org/docs/9.4/interactive/datatype.html) +(See https://www.postgresql.org/docs/9.4/interactive/datatype.html) DB_C_TYPE_INT: bit, int2, smallint, int4, int, integer, int8, bigint, serial, oid diff --git a/db/drivers/postgres/grass-pg.html b/db/drivers/postgres/grass-pg.html index 72c292aade4..cb707fa9314 100644 --- a/db/drivers/postgres/grass-pg.html +++ b/db/drivers/postgres/grass-pg.html @@ -6,7 +6,7 @@

    Creating a PostgreSQL database

    A new database is created with createdb, see -the PostgreSQL +the PostgreSQL manual for details.

    Connecting GRASS to PostgreSQL

    @@ -120,7 +120,7 @@

    Geometry Converters

  • e00pg: E00 to PostGIS filter, see also v.in.e00.
  • -
  • GDAL/OGR ogrinfo and ogr2ogr: +
  • GDAL/OGR ogrinfo and ogr2ogr: GIS vector format converter and library, e.g. ArcInfo or SHAPE to PostGIS.
    ogr2ogr -f "PostgreSQL" shapefile ??
  • @@ -141,8 +141,8 @@

    SEE ALSO

    REFERENCES

    diff --git a/db/drivers/sqlite/README b/db/drivers/sqlite/README index b0c59be7d64..955cbede58a 100644 --- a/db/drivers/sqlite/README +++ b/db/drivers/sqlite/README @@ -14,7 +14,7 @@ db.connect driver=sqlite \ The database is created automatically when used first time. That is SQLite feature followed also in the driver. -SQLite uses "type affinity", (http://www.sqlite.org/datatype3.html) +SQLite uses "type affinity", (https://www.sqlite.org/datatype3.html) that means column types are recommended, but not required. If the driver in GRASS has to determine column type, it first reads diff --git a/db/drivers/sqlite/fetch.c b/db/drivers/sqlite/fetch.c index 8e020753293..44a62b4bb4d 100644 --- a/db/drivers/sqlite/fetch.c +++ b/db/drivers/sqlite/fetch.c @@ -130,7 +130,7 @@ int db__driver_fetch(dbCursor *cn, int position, int *more) G_debug(3, "col %d, litetype %d, sqltype %d: val = '%s'", col, litetype, sqltype, text); - /* http://www.sqlite.org/capi3ref.html#sqlite3_column_type + /* https://www.sqlite.org/capi3ref.html#sqlite3_column_type SQLITE_INTEGER 1 SQLITE_FLOAT 2 SQLITE_TEXT 3 diff --git a/db/drivers/sqlite/grass-sqlite.html b/db/drivers/sqlite/grass-sqlite.html index e746f5820c0..ae59def1e52 100644 --- a/db/drivers/sqlite/grass-sqlite.html +++ b/db/drivers/sqlite/grass-sqlite.html @@ -25,8 +25,8 @@

    Supported SQL commands

    All SQL commands supported by SQLite (for limitations, see SQLite help page: -SQL As Understood By SQLite and -Unsupported SQL). +SQL As Understood By SQLite and +Unsupported SQL).

    Operators available in conditions

    @@ -46,7 +46,7 @@

    Browsing table data in DB

    The algorithm uses input parameters set by the user on the diff --git a/imagery/i.eb.eta/i.eb.eta.html b/imagery/i.eb.eta/i.eb.eta.html index ff947cb1b43..7915c7eba1a 100644 --- a/imagery/i.eb.eta/i.eb.eta.html +++ b/imagery/i.eb.eta/i.eb.eta.html @@ -24,7 +24,7 @@

    REFERENCES

    [1] Bastiaanssen, W.G.M., 1995. Estimation of Land surface parameters by remote sensing under clear-sky conditions. PhD thesis, Wageningen University, Wageningen, The Netherlands. -(PDF) +(PDF)

    [2] Chemin Y., Alexandridis T.A., 2001. Improving spatial resolution of ET seasonal for irrigated rice in Zhanghe, China. Asian Journal of Geoinformatics. @@ -33,12 +33,12 @@

    REFERENCES

    [3] Alexandridis T.K., Cherif I., Chemin Y., Silleos N.G., Stavrinos E., Zalidis G.C. Integrated methodology for estimating water use in Mediterranean agricultural areas. Remote Sensing. 2009, 1, 445-465. -(PDF) +(PDF)

    [4] Chemin, Y., 2012. A Distributed Benchmarking Framework for Actual ET Models, in: Irmak, A. (Ed.), Evapotranspiration - Remote Sensing and Modeling. InTech. -(PDF) +(PDF)

    SEE ALSO

    diff --git a/imagery/i.eb.evapfr/i.eb.evapfr.html b/imagery/i.eb.evapfr/i.eb.evapfr.html index 8d6354f36f9..9e745534728 100644 --- a/imagery/i.eb.evapfr/i.eb.evapfr.html +++ b/imagery/i.eb.evapfr/i.eb.evapfr.html @@ -18,7 +18,7 @@

    REFERENCES

    Bastiaanssen, W.G.M., 1995. Estimation of Land surface parameters by remote sensing under clear-sky conditions. PhD thesis, Wageningen University, Wageningen, The Netherlands. -(PDF) +(PDF)

    Bastiaanssen, W.G.M., Molden, D.J., Makin, I.W., 2000. Remote sensing for irrigated agriculture: examples from research and @@ -32,12 +32,12 @@

    REFERENCES

    Zalidis G.C., 2009. Integrated methodology for estimating water use in Mediterranean agricultural areas. Remote Sensing. 1, 445-465. -(PDF) +(PDF)

    Chemin, Y., 2012. A Distributed Benchmarking Framework for Actual ET Models, in: Irmak, A. (Ed.), Evapotranspiration - Remote Sensing and Modeling. InTech. -(PDF) +(PDF)

    SEE ALSO

    diff --git a/imagery/i.eb.hsebal01/i.eb.hsebal01.html b/imagery/i.eb.hsebal01/i.eb.hsebal01.html index 4b6d3953e53..4501af13c3c 100644 --- a/imagery/i.eb.hsebal01/i.eb.hsebal01.html +++ b/imagery/i.eb.hsebal01/i.eb.hsebal01.html @@ -37,7 +37,7 @@

    REFERENCES

    [1] Bastiaanssen, W.G.M., 1995. Estimation of Land surface parameters by remote sensing under clear-sky conditions. PhD thesis, Wageningen University, Wageningen, The Netherlands. -(PDF) +(PDF)

    [2] Chemin Y., Alexandridis T.A., 2001. Improving spatial resolution of ET seasonal for irrigated rice in Zhanghe, China. Asian Journal of @@ -46,12 +46,12 @@

    REFERENCES

    [3] Alexandridis T.K., Cherif I., Chemin Y., Silleos N.G., Stavrinos E., Zalidis G.C. Integrated methodology for estimating water use in Mediterranean agricultural areas. Remote Sensing. 2009, 1, 445-465. -(PDF) +(PDF)

    [4] Chemin, Y., 2012. A Distributed Benchmarking Framework for Actual ET Models, in: Irmak, A. (Ed.), Evapotranspiration - Remote Sensing and Modeling. InTech. -(PDF) +(PDF)

    SEE ALSO

    diff --git a/imagery/i.eb.netrad/i.eb.netrad.html b/imagery/i.eb.netrad/i.eb.netrad.html index 306bb39c90d..c6cba3ad484 100644 --- a/imagery/i.eb.netrad/i.eb.netrad.html +++ b/imagery/i.eb.netrad/i.eb.netrad.html @@ -28,12 +28,12 @@

    REFERENCES

    densities and moisture indicators in composite terrain; a remote sensing approach under clear skies in mediterranean climates. PhD thesis, Wageningen Agricultural Univ., The Netherland, 271 pp. -(PDF) +(PDF)
  • Chemin, Y., 2012. A Distributed Benchmarking Framework for Actual ET Models, in: Irmak, A. (Ed.), Evapotranspiration - Remote Sensing and Modeling. InTech. -(PDF)
  • +(PDF)

SEE ALSO

diff --git a/imagery/i.eb.soilheatflux/i.eb.soilheatflux.html b/imagery/i.eb.soilheatflux/i.eb.soilheatflux.html index b948d827da2..ecf62af78e9 100644 --- a/imagery/i.eb.soilheatflux/i.eb.soilheatflux.html +++ b/imagery/i.eb.soilheatflux/i.eb.soilheatflux.html @@ -41,7 +41,7 @@

REFERENCES

Bastiaanssen, W.G.M., 1995. Estimation of Land surface parameters by remote sensing under clear-sky conditions. PhD thesis, Wageningen University, Wageningen, The Netherlands. - (PDF) + (PDF)

Chemin Y., Alexandridis T.A., 2001. Improving spatial resolution of ET seasonal for irrigated rice in Zhanghe, China. Asian Journal of Geoinformatics. 5(1):3-11,2004. @@ -49,12 +49,12 @@

REFERENCES

Alexandridis T.K., Cherif I., Chemin Y., Silleos N.G., Stavrinos E., Zalidis G.C. Integrated methodology for estimating water use in Mediterranean agricultural areas. Remote Sensing. 2009, 1, 445-465. -(PDF) +(PDF)

Chemin, Y., 2012. A Distributed Benchmarking Framework for Actual ET Models, in: Irmak, A. (Ed.), Evapotranspiration - Remote Sensing and Modeling. InTech. -(PDF) +(PDF)

SEE ALSO

diff --git a/imagery/i.emissivity/i.emissivity.html b/imagery/i.emissivity/i.emissivity.html index 872ca4fddae..e6419e8f776 100644 --- a/imagery/i.emissivity/i.emissivity.html +++ b/imagery/i.emissivity/i.emissivity.html @@ -21,7 +21,7 @@

REFERENCES

  • Bastiaanssen, W.G.M., 1995. Estimation of Land surface parameters by remote sensing under clear-sky conditions. PhD thesis, Wageningen University, Wageningen, The Netherlands. - (PDF)
  • + (PDF)
  • Caselles, V., C. Coll, and E. Valor, 1997. Land surface emissivity and temperature determination in the whole HAPEX-Sahel area from AVHRR data. International Journal of Remote diff --git a/imagery/i.fft/i.fft.html b/imagery/i.fft/i.fft.html index abb7453af82..8eb63a9c8ae 100644 --- a/imagery/i.fft/i.fft.html +++ b/imagery/i.fft/i.fft.html @@ -40,12 +40,12 @@

    REFERENCES

    • M. Frigo and S. G. Johnson (1998): "FFTW: An Adaptive Software Architecture -for the FFT". See www.FFTW.org: FFTW is a C subroutine library +for the FFT". See www.FFTW.org: FFTW is a C subroutine library for computing the Discrete Fourier Transform (DFT) in one or more dimensions, of both real and complex data, and of arbitrary input size.
    • John A. Richards, 1986. Remote Sensing Digital Image Analysis, Springer-Verlag.
    • Personal communication, between program author and Ali R. Vali, -Space Research Center, University of Texas, Austin, 1990. +Space Research Center, University of Texas, Austin, 1990.

    SEE ALSO

    diff --git a/imagery/i.ifft/i.ifft.html b/imagery/i.ifft/i.ifft.html index 028f81f5895..eee7bc54e06 100644 --- a/imagery/i.ifft/i.ifft.html +++ b/imagery/i.ifft/i.ifft.html @@ -23,7 +23,7 @@

    REFERENCES

    • M. Frigo and S. G. Johnson (1998): "FFTW: An Adaptive Software -Architecture for the FFT". See www.fftw.org: +Architecture for the FFT". See www.fftw.org: FFTW is a C subroutine library for computing the Discrete Fourier Transform (DFT) in one or more dimensions, of both real and complex data, and of arbitrary input size.
    • diff --git a/imagery/i.landsat.toar/i.landsat.toar.html b/imagery/i.landsat.toar/i.landsat.toar.html index 821f7cb4cfe..4a792c26274 100644 --- a/imagery/i.landsat.toar/i.landsat.toar.html +++ b/imagery/i.landsat.toar/i.landsat.toar.html @@ -235,7 +235,7 @@

      DOS1 example

      Calculation of reflectance values from DN using DOS1 (metadata obtained -from p016r035_7x20020524.met.gz): +from p016r035_7x20020524.met.gz):
       i.landsat.toar input=lsat7_2002. output=lsat7_2002_toar. sensor=tm7 \
      diff --git a/imagery/i.ortho.photo/README b/imagery/i.ortho.photo/README
      index bc8313ce304..51260299d5b 100644
      --- a/imagery/i.ortho.photo/README
      +++ b/imagery/i.ortho.photo/README
      @@ -49,7 +49,7 @@ Workflow description:
       Open Source GIS: A GRASS GIS Approach, Second Edition, 2004
       by Markus Neteler and Helena Mitasova,
       Chapter 10 – PROCESSING OF AERIAL PHOTOS
      -http://grassbook.org/extra/sample-chapter/
      +https://grassbook.org/extra/sample-chapter/
       --> PDF
       
       ######################################################################
      diff --git a/imagery/i.ortho.photo/lib/TODO b/imagery/i.ortho.photo/lib/TODO
      index 792cb581378..df02ac3cf5d 100644
      --- a/imagery/i.ortho.photo/lib/TODO
      +++ b/imagery/i.ortho.photo/lib/TODO
      @@ -30,4 +30,4 @@ Possibly a lot is already done in lib/image3/ ?
       -----------------
       See also
       
      -http://trac.osgeo.org/grass/wiki/Grass7Planning
      +https://trac.osgeo.org/grass/wiki/Grass7Planning
      diff --git a/imagery/i.rectify/i.rectify.html b/imagery/i.rectify/i.rectify.html
      index 6451c8c9be9..7ef374b948e 100644
      --- a/imagery/i.rectify/i.rectify.html
      +++ b/imagery/i.rectify/i.rectify.html
      @@ -11,8 +11,8 @@ 

      DESCRIPTION

      are first, second, and third order polynomial and thin plate spline. Thin plate spline is recommended for ungeoreferenced satellite imagery where ground control points (GCPs) are included. Examples are -NOAA/AVHRR -and ENVISAT +NOAA/AVHRR +and ENVISAT imagery which include throusands of GCPs.

      diff --git a/imagery/i.vi/evi2.c b/imagery/i.vi/evi2.c index c56ad2f62e0..502fba957ab 100644 --- a/imagery/i.vi/evi2.c +++ b/imagery/i.vi/evi2.c @@ -7,7 +7,7 @@ * 2-band enhanced vegetation index without a blue band and its application to * AVHRR data Proc. SPIE 6679, Remote Sensing and Modeling of Ecosystems for * Sustainability IV, 667905 (October 09, 2007) doi:10.1117/12.734933 - * http://dx.doi.org/10.1117/12.734933 + * https://doi.org/10.1117/12.734933 */ double e_vi2(double redchan, double nirchan) { diff --git a/imagery/i.vi/i.vi.html b/imagery/i.vi/i.vi.html index 7e600600678..3597dc5f500 100644 --- a/imagery/i.vi/i.vi.html +++ b/imagery/i.vi/i.vi.html @@ -134,7 +134,7 @@

      Vegetation Indices

      vegetation index without a blue band and its application to AVHRR data. Proc. SPIE 6679, Remote Sensing and Modeling of Ecosystems for Sustainability IV, 667905 (october 09, 2007) -doi:10.1117/12.734933). +doi:10.1117/12.734933).
       evi2( redchan, nirchan )
      @@ -150,7 +150,7 @@ 

      Vegetation Indices

      Gitelson, Anatoly A.; Kaufman, Yoram J.; Merzlyak, Mark N. (1996) Use of a green channel in remote sensing of global vegetation from EOS- MODIS, Remote Sensing of Environment 58 (3), 289-298. -doi:10.1016/s0034-4257(96)00072-7 +doi:10.1016/s0034-4257(96)00072-7
       gari( redchan, nirchan, bluechan, greenchan )
      @@ -508,7 +508,7 @@ 

      Preparation: DN to reflectance

      Calculation of reflectance values from DN using DOS1 (metadata obtained -from p016r035_7x20020524.met.gz): +from p016r035_7x20020524.met.gz):

      @@ -596,8 +596,8 @@ 

      REFERENCES

      densities and moisture indicators in composite terrain; a remote sensing approach under clear skies in mediterranean climates. PhD thesis, Wageningen Agricultural Univ., The Netherland, 271 pp. -(PDF) -
    • Index DataBase: List of available Indices
    • +(PDF) +
    • Index DataBase: List of available Indices

    SEE ALSO

    diff --git a/imagery/imageryintro.html b/imagery/imageryintro.html index 9018b4871ae..c0ef2a48616 100644 --- a/imagery/imageryintro.html +++ b/imagery/imageryintro.html @@ -59,7 +59,7 @@

    Image processing in general

    using the DOS correction method. The more accurate way is using i.atcorr (which supports many satellite sensors). The atmospherically corrected sensor data represent -surface reflectance, +surface reflectance, which ranges theoretically from 0% to 100%. Note that this level of data correction is the proper level of correction to calculate vegetation indices. diff --git a/include/Make/Doxyfile_arch_html.in b/include/Make/Doxyfile_arch_html.in index 3f1e828494c..4c60088412a 100644 --- a/include/Make/Doxyfile_arch_html.in +++ b/include/Make/Doxyfile_arch_html.in @@ -18,7 +18,7 @@ # that follow. The default is UTF-8 which is also the encoding used for all # text before the first occurrence of this tag. Doxygen uses libiconv (or the # iconv built into libc) for the transcoding. See -# http://www.gnu.org/software/libiconv for the list of possible encodings. +# https://www.gnu.org/software/libiconv for the list of possible encodings. DOXYFILE_ENCODING = UTF-8 @@ -573,7 +573,7 @@ LAYOUT_FILE = # containing the references data. This must be a list of .bib files. The # .bib extension is automatically appended if omitted. Using this command # requires the bibtex tool to be installed. See also -# http://en.wikipedia.org/wiki/BibTeX for more info. For LaTeX the style +# https://en.wikipedia.org/wiki/BibTeX for more info. For LaTeX the style # of the bibliography can be controlled using LATEX_BIB_STYLE. To use this # feature you need bibtex and perl available in the search path. @@ -644,7 +644,7 @@ INPUT = . # This tag can be used to specify the character encoding of the source files # that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is # also the default input encoding. Doxygen uses libiconv (or the iconv built -# into libc) for the transcoding. See http://www.gnu.org/software/libiconv for +# into libc) for the transcoding. See https://www.gnu.org/software/libiconv for # the list of possible encodings. INPUT_ENCODING = UTF-8 @@ -851,7 +851,7 @@ REFERENCES_LINK_SOURCE = YES # If the USE_HTAGS tag is set to YES then the references to source code # will point to the HTML generated by the htags(1) tool instead of doxygen # built-in source browser. The htags tool is part of GNU's global source -# tagging system (see http://www.gnu.org/software/global/global.html). You +# tagging system (see https://www.gnu.org/software/global/global.html). You # will need version 4.8.6 or higher. USE_HTAGS = NO @@ -946,7 +946,7 @@ HTML_EXTRA_FILES = # The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. # Doxygen will adjust the colors in the style sheet and background images # according to this color. Hue is specified as an angle on a colorwheel, -# see http://en.wikipedia.org/wiki/Hue for more information. +# see https://en.wikipedia.org/wiki/Hue for more information. # For instance the value 0 represents red, 60 is yellow, 120 is green, # 180 is cyan, 240 is blue, 300 purple, and 360 is red again. # The allowed range is 0 to 359. @@ -1337,7 +1337,7 @@ LATEX_SOURCE_CODE = NO # The LATEX_BIB_STYLE tag can be used to specify the style to use for the # bibliography, e.g. plainnat, or ieeetr. The default style is "plain". See -# http://en.wikipedia.org/wiki/BibTeX for more info. +# https://en.wikipedia.org/wiki/BibTeX for more info. LATEX_BIB_STYLE = plain diff --git a/include/Make/Doxyfile_arch_latex.in b/include/Make/Doxyfile_arch_latex.in index 1962073feec..25f6ac1592f 100644 --- a/include/Make/Doxyfile_arch_latex.in +++ b/include/Make/Doxyfile_arch_latex.in @@ -18,7 +18,7 @@ # that follow. The default is UTF-8 which is also the encoding used for all # text before the first occurrence of this tag. Doxygen uses libiconv (or the # iconv built into libc) for the transcoding. See -# http://www.gnu.org/software/libiconv for the list of possible encodings. +# https://www.gnu.org/software/libiconv for the list of possible encodings. DOXYFILE_ENCODING = UTF-8 @@ -573,7 +573,7 @@ LAYOUT_FILE = # containing the references data. This must be a list of .bib files. The # .bib extension is automatically appended if omitted. Using this command # requires the bibtex tool to be installed. See also -# http://en.wikipedia.org/wiki/BibTeX for more info. For LaTeX the style +# https://en.wikipedia.org/wiki/BibTeX for more info. For LaTeX the style # of the bibliography can be controlled using LATEX_BIB_STYLE. To use this # feature you need bibtex and perl available in the search path. @@ -644,7 +644,7 @@ INPUT = . # This tag can be used to specify the character encoding of the source files # that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is # also the default input encoding. Doxygen uses libiconv (or the iconv built -# into libc) for the transcoding. See http://www.gnu.org/software/libiconv for +# into libc) for the transcoding. See https://www.gnu.org/software/libiconv for # the list of possible encodings. INPUT_ENCODING = UTF-8 @@ -851,7 +851,7 @@ REFERENCES_LINK_SOURCE = YES # If the USE_HTAGS tag is set to YES then the references to source code # will point to the HTML generated by the htags(1) tool instead of doxygen # built-in source browser. The htags tool is part of GNU's global source -# tagging system (see http://www.gnu.org/software/global/global.html). You +# tagging system (see https://www.gnu.org/software/global/global.html). You # will need version 4.8.6 or higher. USE_HTAGS = NO @@ -946,7 +946,7 @@ HTML_EXTRA_FILES = # The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. # Doxygen will adjust the colors in the style sheet and background images # according to this color. Hue is specified as an angle on a colorwheel, -# see http://en.wikipedia.org/wiki/Hue for more information. +# see https://en.wikipedia.org/wiki/Hue for more information. # For instance the value 0 represents red, 60 is yellow, 120 is green, # 180 is cyan, 240 is blue, 300 purple, and 360 is red again. # The allowed range is 0 to 359. @@ -1337,7 +1337,7 @@ LATEX_SOURCE_CODE = NO # The LATEX_BIB_STYLE tag can be used to specify the style to use for the # bibliography, e.g. plainnat, or ieeetr. The default style is "plain". See -# http://en.wikipedia.org/wiki/BibTeX for more info. +# https://en.wikipedia.org/wiki/BibTeX for more info. LATEX_BIB_STYLE = plain diff --git a/include/grass/defs/gprojects.h b/include/grass/defs/gprojects.h index 7ab5e47ddd6..e96200c1480 100644 --- a/include/grass/defs/gprojects.h +++ b/include/grass/defs/gprojects.h @@ -65,7 +65,7 @@ void GPJ_free_ellps(struct gpj_ellps *); #ifndef HAVE_PROJ_H /* PROJ.4's private datastructures copied from projects.h as removed from upstream; pending better solution. see: - http://trac.osgeo.org/proj/ticket/98 */ + https://trac.osgeo.org/proj/ticket/98 */ int pj_factors(LP, void *, double, struct FACTORS *); diff --git a/include/grass/gprojects.h b/include/grass/gprojects.h index 7872d6cb4b6..35f795d87ad 100644 --- a/include/grass/gprojects.h +++ b/include/grass/gprojects.h @@ -112,7 +112,7 @@ struct gpj_ellps { #ifndef HAVE_PROJ_H /* PROJ.4's private datastructures copied from projects.h as removed from upstream; pending better solution. see: - http://trac.osgeo.org/proj/ticket/98 */ + https://trac.osgeo.org/proj/ticket/98 */ /* In PROJ 5, the 'struct FACTORS' is back in as 'struct P5_FACTORS', * and old 'struct LP' is now back in as 'PJ_UV' */ diff --git a/lib/cairodriver/cairodriver.dox b/lib/cairodriver/cairodriver.dox index d7ce1ab60e2..ca3ac067e06 100644 --- a/lib/cairodriver/cairodriver.dox +++ b/lib/cairodriver/cairodriver.dox @@ -11,7 +11,7 @@ output, see Cairo website for details. GRASS Cairo display %driver was originally written by Lars Ahlzen (announcement). +href="https://lists.osgeo.org/pipermail/grass-dev/2007-October/033524.html">announcement). \section cairofunctions List of functions diff --git a/lib/db/README b/lib/db/README index 7268b4e182f..9dc8faf9ab6 100644 --- a/lib/db/README +++ b/lib/db/README @@ -26,7 +26,7 @@ DBMI Library Original author: Joel Jones (jjones * zorro.cecer.army.mil | jjones * uiuc.edu ) - Ref: http://lists.osgeo.org/pipermail/grass-dev/1995-February/002015.html + Ref: https://lists.osgeo.org/pipermail/grass-dev/1995-February/002015.html Directory contents: diff --git a/lib/db/dbmi_base/default_name.c b/lib/db/dbmi_base/default_name.c index f9904651a06..839060b44d9 100644 --- a/lib/db/dbmi_base/default_name.c +++ b/lib/db/dbmi_base/default_name.c @@ -123,7 +123,7 @@ int db_set_default_connection(void) * that here?) or $MAPSET/sqlite/mapname.sql as with dbf? */ - /* http://www.sqlite.org/lockingv3.html + /* https://www.sqlite.org/lockingv3.html * When SQLite creates a journal file on Unix, it opens the * directory that contains that file and calls fsync() on the * directory, in an effort to push the directory information to disk. diff --git a/lib/db/dbmilib.dox b/lib/db/dbmilib.dox index fdbac5fab36..0c85715e7f0 100644 --- a/lib/db/dbmilib.dox +++ b/lib/db/dbmilib.dox @@ -15,10 +15,10 @@ Interface) with its integrated drivers. At time of this writing following DBMI drivers for attribute storage are available: - DBF: xBase files (default) - - ODBC: to interface from http://www.unixodbc.org - - PostgreSQL driver (note that PostgreSQL can also be accessed through ODBC): http://www.postgresql.org + - ODBC: to interface from https://www.unixodbc.org + - PostgreSQL driver (note that PostgreSQL can also be accessed through ODBC): https://www.postgresql.org - mySQL: http://mysql.com/ - - SQLite: http://www.sqlite.org + - SQLite: https://www.sqlite.org These drivers are compiled depending on present DB related libraries and 'configure' settings. Only the DBF driver is always compiled. The diff --git a/lib/db/sqlp/sql.html b/lib/db/sqlp/sql.html index 730d0462c2a..eaed6a74b70 100644 --- a/lib/db/sqlp/sql.html +++ b/lib/db/sqlp/sql.html @@ -9,9 +9,9 @@ attribute table.

    GRASS GIS supports various RDBMS -(Relational +(Relational database management system) and embedded databases. SQL -(Structured Query +(Structured Query Language) queries are directly passed to the underlying database system. The set of supported SQL commands depends on the RDMBS and database driver selected. @@ -44,10 +44,10 @@

    Database drivers

    http://mysql.org/ --> odbcData storage via UnixODBC (PostgreSQL, Oracle, etc.) -http://www.unixodbc.org/ +https://www.unixodbc.org/ ogrData storage in OGR files -http://gdal.org/ +https://gdal.org/

    NOTES

    diff --git a/lib/gmath/gmathlib.dox b/lib/gmath/gmathlib.dox index a404595de04..77b516b8ebd 100644 --- a/lib/gmath/gmathlib.dox +++ b/lib/gmath/gmathlib.dox @@ -464,8 +464,8 @@ implemented.

    Getting BLAS/LAPACK (one package) if not already provided by the system: -
    http://www.netlib.org/lapack/ -
    http://netlib.bell-labs.com/netlib/master/readme.html +
    https://www.netlib.org/lapack/ +
    https://netlib.bell-labs.com/netlib/master/readme.html

    Pre-compiled binaries of LAPACK/BLAS are provided on many Linux diff --git a/lib/init/variables.html b/lib/init/variables.html index 6fd10d7f173..5dfd113dd85 100644 --- a/lib/init/variables.html +++ b/lib/init/variables.html @@ -392,7 +392,7 @@

    List of selected (GRASS related) shell environment variables

    TMPDIR, TEMP, TMP
    [Various GRASS GIS commands and wxGUI]
    - + The default wxGUI temporary directory is chosen from a platform-dependent list, but the user can control the selection of this directory by setting one of the TMPDIR, TEMP or TMP diff --git a/lib/vector/Vlib/buffer2.c b/lib/vector/Vlib/buffer2.c index 102b1ca350b..ce628d761ef 100644 --- a/lib/vector/Vlib/buffer2.c +++ b/lib/vector/Vlib/buffer2.c @@ -118,7 +118,7 @@ static void elliptic_tangent(double x, double y, double da, double db, /* * !!! This is not line in GRASS' sense. See - * http://en.wikipedia.org/wiki/Line_%28mathematics%29 + * https://en.wikipedia.org/wiki/Line_%28mathematics%29 */ static void line_coefficients(double x1, double y1, double x2, double y2, double *a, double *b, double *c) diff --git a/lib/vector/Vlib/legal_vname.c b/lib/vector/Vlib/legal_vname.c index cd2aa0f14ba..f51df6ace66 100644 --- a/lib/vector/Vlib/legal_vname.c +++ b/lib/vector/Vlib/legal_vname.c @@ -32,7 +32,7 @@ int Vect_legal_filename(const char *s) { /* full list of SQL keywords available at - http://www.postgresql.org/docs/8.2/static/sql-keywords-appendix.html + https://www.postgresql.org/docs/8.2/static/sql-keywords-appendix.html */ static const char *keywords[] = {"and", "or", "not", NULL}; char buf[GNAME_MAX]; diff --git a/lib/vector/vectorlib_pg.dox b/lib/vector/vectorlib_pg.dox index c3a072c6a14..d95b3dec1c2 100644 --- a/lib/vector/vectorlib_pg.dox +++ b/lib/vector/vectorlib_pg.dox @@ -10,14 +10,14 @@ by GRASS Development Team (https://grass.osgeo.org) write PostGIS data directly without any external library (like in the case of \ref vlibOgr). GRASS-PostGIS data provider is implemented using libpq +href="https://www.postgresql.org/docs/9.2/static/libpq.html">libpq library. Note that GRASS-PostGIS data provider is compiled only when GRASS is configured with --with-postgres switch. See the trac +href="https://trac.osgeo.org/grass/wiki/Grass7/VectorLib/PostGISInterface">trac page for more info. \section vlibFn List of functions diff --git a/locale/po/grassmods_ar.po b/locale/po/grassmods_ar.po index b21aefa5d0b..cbb43ec6e9e 100644 --- a/locale/po/grassmods_ar.po +++ b/locale/po/grassmods_ar.po @@ -71377,7 +71377,7 @@ msgid "Either or must be given" msgstr "طبقتين يجب تحديدهم" #: ../scripts/i.in.spotvgt/i.in.spotvgt.py:129 -msgid "'gdalinfo' not found, install GDAL tools first (http://www.gdal.org)" +msgid "'gdalinfo' not found, install GDAL tools first (https://gdal.org)" msgstr "" #: ../scripts/i.in.spotvgt/i.in.spotvgt.py:146 diff --git a/locale/po/grassmods_bn.po b/locale/po/grassmods_bn.po index 17a11f251b8..f3526d45180 100644 --- a/locale/po/grassmods_bn.po +++ b/locale/po/grassmods_bn.po @@ -65839,7 +65839,7 @@ msgid "Either or must be given" msgstr "" #: ../scripts/i.in.spotvgt/i.in.spotvgt.py:129 -msgid "'gdalinfo' not found, install GDAL tools first (http://www.gdal.org)" +msgid "'gdalinfo' not found, install GDAL tools first (https://gdal.org)" msgstr "" #: ../scripts/i.in.spotvgt/i.in.spotvgt.py:146 diff --git a/locale/po/grassmods_cs.po b/locale/po/grassmods_cs.po index c6f5f75df4c..0d17c962990 100644 --- a/locale/po/grassmods_cs.po +++ b/locale/po/grassmods_cs.po @@ -68271,7 +68271,7 @@ msgid "Either or must be given" msgstr "" #: ../scripts/i.in.spotvgt/i.in.spotvgt.py:129 -msgid "'gdalinfo' not found, install GDAL tools first (http://www.gdal.org)" +msgid "'gdalinfo' not found, install GDAL tools first (https://gdal.org)" msgstr "" #: ../scripts/i.in.spotvgt/i.in.spotvgt.py:146 diff --git a/locale/po/grassmods_de.po b/locale/po/grassmods_de.po index 8603cfda94d..7e994f4b379 100644 --- a/locale/po/grassmods_de.po +++ b/locale/po/grassmods_de.po @@ -68907,7 +68907,7 @@ msgid "Either or must be given" msgstr "" #: ../scripts/i.in.spotvgt/i.in.spotvgt.py:129 -msgid "'gdalinfo' not found, install GDAL tools first (http://www.gdal.org)" +msgid "'gdalinfo' not found, install GDAL tools first (https://gdal.org)" msgstr "" #: ../scripts/i.in.spotvgt/i.in.spotvgt.py:146 diff --git a/locale/po/grassmods_el.po b/locale/po/grassmods_el.po index 5b07d819bd2..e183723b634 100644 --- a/locale/po/grassmods_el.po +++ b/locale/po/grassmods_el.po @@ -66429,7 +66429,7 @@ msgid "Either or must be given" msgstr "" #: ../scripts/i.in.spotvgt/i.in.spotvgt.py:129 -msgid "'gdalinfo' not found, install GDAL tools first (http://www.gdal.org)" +msgid "'gdalinfo' not found, install GDAL tools first (https://gdal.org)" msgstr "" #: ../scripts/i.in.spotvgt/i.in.spotvgt.py:146 diff --git a/locale/po/grassmods_es.po b/locale/po/grassmods_es.po index 676e7382c2d..ca8a6727270 100644 --- a/locale/po/grassmods_es.po +++ b/locale/po/grassmods_es.po @@ -70595,7 +70595,7 @@ msgid "Either or must be given" msgstr "" #: ../scripts/i.in.spotvgt/i.in.spotvgt.py:129 -msgid "'gdalinfo' not found, install GDAL tools first (http://www.gdal.org)" +msgid "'gdalinfo' not found, install GDAL tools first (https://gdal.org)" msgstr "" #: ../scripts/i.in.spotvgt/i.in.spotvgt.py:146 diff --git a/locale/po/grassmods_fi.po b/locale/po/grassmods_fi.po index 15504ea84ae..692d9c0d9f2 100644 --- a/locale/po/grassmods_fi.po +++ b/locale/po/grassmods_fi.po @@ -65889,7 +65889,7 @@ msgid "Either or must be given" msgstr "" #: ../scripts/i.in.spotvgt/i.in.spotvgt.py:129 -msgid "'gdalinfo' not found, install GDAL tools first (http://www.gdal.org)" +msgid "'gdalinfo' not found, install GDAL tools first (https://gdal.org)" msgstr "" #: ../scripts/i.in.spotvgt/i.in.spotvgt.py:146 diff --git a/locale/po/grassmods_fr.po b/locale/po/grassmods_fr.po index f13cc33269f..8f4602fc6ec 100644 --- a/locale/po/grassmods_fr.po +++ b/locale/po/grassmods_fr.po @@ -68934,7 +68934,7 @@ msgid "Either or must be given" msgstr "" #: ../scripts/i.in.spotvgt/i.in.spotvgt.py:129 -msgid "'gdalinfo' not found, install GDAL tools first (http://www.gdal.org)" +msgid "'gdalinfo' not found, install GDAL tools first (https://gdal.org)" msgstr "" #: ../scripts/i.in.spotvgt/i.in.spotvgt.py:146 diff --git a/locale/po/grassmods_hu.po b/locale/po/grassmods_hu.po index 193acc17813..ee0f0929c11 100644 --- a/locale/po/grassmods_hu.po +++ b/locale/po/grassmods_hu.po @@ -66112,7 +66112,7 @@ msgid "Either or must be given" msgstr "" #: ../scripts/i.in.spotvgt/i.in.spotvgt.py:129 -msgid "'gdalinfo' not found, install GDAL tools first (http://www.gdal.org)" +msgid "'gdalinfo' not found, install GDAL tools first (https://gdal.org)" msgstr "" #: ../scripts/i.in.spotvgt/i.in.spotvgt.py:146 diff --git a/locale/po/grassmods_id_ID.po b/locale/po/grassmods_id_ID.po index c7159086153..d9a39bafe24 100644 --- a/locale/po/grassmods_id_ID.po +++ b/locale/po/grassmods_id_ID.po @@ -65729,7 +65729,7 @@ msgid "Either or must be given" msgstr "" #: ../scripts/i.in.spotvgt/i.in.spotvgt.py:129 -msgid "'gdalinfo' not found, install GDAL tools first (http://www.gdal.org)" +msgid "'gdalinfo' not found, install GDAL tools first (https://gdal.org)" msgstr "" #: ../scripts/i.in.spotvgt/i.in.spotvgt.py:146 diff --git a/locale/po/grassmods_it.po b/locale/po/grassmods_it.po index 3120ef6c35b..94368222e52 100644 --- a/locale/po/grassmods_it.po +++ b/locale/po/grassmods_it.po @@ -68276,7 +68276,7 @@ msgid "Either or must be given" msgstr "" #: ../scripts/i.in.spotvgt/i.in.spotvgt.py:129 -msgid "'gdalinfo' not found, install GDAL tools first (http://www.gdal.org)" +msgid "'gdalinfo' not found, install GDAL tools first (https://gdal.org)" msgstr "" #: ../scripts/i.in.spotvgt/i.in.spotvgt.py:146 diff --git a/locale/po/grassmods_ja.po b/locale/po/grassmods_ja.po index 3444ccaf5db..0dd3735b064 100644 --- a/locale/po/grassmods_ja.po +++ b/locale/po/grassmods_ja.po @@ -67358,7 +67358,7 @@ msgid "Either or must be given" msgstr "" #: ../scripts/i.in.spotvgt/i.in.spotvgt.py:129 -msgid "'gdalinfo' not found, install GDAL tools first (http://www.gdal.org)" +msgid "'gdalinfo' not found, install GDAL tools first (https://gdal.org)" msgstr "" #: ../scripts/i.in.spotvgt/i.in.spotvgt.py:146 diff --git a/locale/po/grassmods_ko.po b/locale/po/grassmods_ko.po index 5e3acc44adc..8d255c6f5ad 100644 --- a/locale/po/grassmods_ko.po +++ b/locale/po/grassmods_ko.po @@ -67003,7 +67003,7 @@ msgid "Either or must be given" msgstr "" #: ../scripts/i.in.spotvgt/i.in.spotvgt.py:129 -msgid "'gdalinfo' not found, install GDAL tools first (http://www.gdal.org)" +msgid "'gdalinfo' not found, install GDAL tools first (https://gdal.org)" msgstr "" #: ../scripts/i.in.spotvgt/i.in.spotvgt.py:146 diff --git a/locale/po/grassmods_lv.po b/locale/po/grassmods_lv.po index 717f25bac27..43e408d8721 100644 --- a/locale/po/grassmods_lv.po +++ b/locale/po/grassmods_lv.po @@ -67248,7 +67248,7 @@ msgid "Either or must be given" msgstr "2 līmeņiem jābūt norādītiem" #: ../scripts/i.in.spotvgt/i.in.spotvgt.py:129 -msgid "'gdalinfo' not found, install GDAL tools first (http://www.gdal.org)" +msgid "'gdalinfo' not found, install GDAL tools first (https://gdal.org)" msgstr "" #: ../scripts/i.in.spotvgt/i.in.spotvgt.py:146 diff --git a/locale/po/grassmods_ml.po b/locale/po/grassmods_ml.po index 201460df7bb..a3693866979 100644 --- a/locale/po/grassmods_ml.po +++ b/locale/po/grassmods_ml.po @@ -65839,7 +65839,7 @@ msgid "Either or must be given" msgstr "" #: ../scripts/i.in.spotvgt/i.in.spotvgt.py:129 -msgid "'gdalinfo' not found, install GDAL tools first (http://www.gdal.org)" +msgid "'gdalinfo' not found, install GDAL tools first (https://gdal.org)" msgstr "" #: ../scripts/i.in.spotvgt/i.in.spotvgt.py:146 diff --git a/locale/po/grassmods_pl.po b/locale/po/grassmods_pl.po index 8edda3da8e1..dccca2f5d0f 100644 --- a/locale/po/grassmods_pl.po +++ b/locale/po/grassmods_pl.po @@ -67713,7 +67713,7 @@ msgid "Either or must be given" msgstr "" #: ../scripts/i.in.spotvgt/i.in.spotvgt.py:129 -msgid "'gdalinfo' not found, install GDAL tools first (http://www.gdal.org)" +msgid "'gdalinfo' not found, install GDAL tools first (https://gdal.org)" msgstr "" #: ../scripts/i.in.spotvgt/i.in.spotvgt.py:146 diff --git a/locale/po/grassmods_pt.po b/locale/po/grassmods_pt.po index 63404997a1a..4a28f18ff64 100644 --- a/locale/po/grassmods_pt.po +++ b/locale/po/grassmods_pt.po @@ -67030,7 +67030,7 @@ msgid "Either or must be given" msgstr "" #: ../scripts/i.in.spotvgt/i.in.spotvgt.py:129 -msgid "'gdalinfo' not found, install GDAL tools first (http://www.gdal.org)" +msgid "'gdalinfo' not found, install GDAL tools first (https://gdal.org)" msgstr "" #: ../scripts/i.in.spotvgt/i.in.spotvgt.py:146 diff --git a/locale/po/grassmods_pt_BR.po b/locale/po/grassmods_pt_BR.po index 673f09c2d8c..d7bcb3c7f41 100644 --- a/locale/po/grassmods_pt_BR.po +++ b/locale/po/grassmods_pt_BR.po @@ -68320,7 +68320,7 @@ msgid "Either or must be given" msgstr "" #: ../scripts/i.in.spotvgt/i.in.spotvgt.py:129 -msgid "'gdalinfo' not found, install GDAL tools first (http://www.gdal.org)" +msgid "'gdalinfo' not found, install GDAL tools first (https://gdal.org)" msgstr "" #: ../scripts/i.in.spotvgt/i.in.spotvgt.py:146 diff --git a/locale/po/grassmods_ro.po b/locale/po/grassmods_ro.po index 46ac81a4b36..3f4174329a4 100644 --- a/locale/po/grassmods_ro.po +++ b/locale/po/grassmods_ro.po @@ -67214,7 +67214,7 @@ msgid "Either or must be given" msgstr "" #: ../scripts/i.in.spotvgt/i.in.spotvgt.py:129 -msgid "'gdalinfo' not found, install GDAL tools first (http://www.gdal.org)" +msgid "'gdalinfo' not found, install GDAL tools first (https://gdal.org)" msgstr "" #: ../scripts/i.in.spotvgt/i.in.spotvgt.py:146 diff --git a/locale/po/grassmods_ru.po b/locale/po/grassmods_ru.po index cc9bdc51a78..2630e39adcf 100644 --- a/locale/po/grassmods_ru.po +++ b/locale/po/grassmods_ru.po @@ -66746,7 +66746,7 @@ msgid "Either or must be given" msgstr "" #: ../scripts/i.in.spotvgt/i.in.spotvgt.py:129 -msgid "'gdalinfo' not found, install GDAL tools first (http://www.gdal.org)" +msgid "'gdalinfo' not found, install GDAL tools first (https://gdal.org)" msgstr "" #: ../scripts/i.in.spotvgt/i.in.spotvgt.py:146 diff --git a/locale/po/grassmods_si.po b/locale/po/grassmods_si.po index 7f42447aee9..b2f15092dbc 100644 --- a/locale/po/grassmods_si.po +++ b/locale/po/grassmods_si.po @@ -65839,7 +65839,7 @@ msgid "Either or must be given" msgstr "" #: ../scripts/i.in.spotvgt/i.in.spotvgt.py:129 -msgid "'gdalinfo' not found, install GDAL tools first (http://www.gdal.org)" +msgid "'gdalinfo' not found, install GDAL tools first (https://gdal.org)" msgstr "" #: ../scripts/i.in.spotvgt/i.in.spotvgt.py:146 diff --git a/locale/po/grassmods_sl.po b/locale/po/grassmods_sl.po index e2b72f76d56..56c5e73fd60 100644 --- a/locale/po/grassmods_sl.po +++ b/locale/po/grassmods_sl.po @@ -71740,7 +71740,7 @@ msgid "Either or must be given" msgstr "Uporabiš lahko ali 'from_table' ali 'select'" #: ../scripts/i.in.spotvgt/i.in.spotvgt.py:129 -msgid "'gdalinfo' not found, install GDAL tools first (http://www.gdal.org)" +msgid "'gdalinfo' not found, install GDAL tools first (https://gdal.org)" msgstr "" #: ../scripts/i.in.spotvgt/i.in.spotvgt.py:146 diff --git a/locale/po/grassmods_ta.po b/locale/po/grassmods_ta.po index d76c586fc00..4bd45b751d5 100644 --- a/locale/po/grassmods_ta.po +++ b/locale/po/grassmods_ta.po @@ -65897,7 +65897,7 @@ msgid "Either or must be given" msgstr "" #: ../scripts/i.in.spotvgt/i.in.spotvgt.py:129 -msgid "'gdalinfo' not found, install GDAL tools first (http://www.gdal.org)" +msgid "'gdalinfo' not found, install GDAL tools first (https://gdal.org)" msgstr "" #: ../scripts/i.in.spotvgt/i.in.spotvgt.py:146 diff --git a/locale/po/grassmods_th.po b/locale/po/grassmods_th.po index bb0898b05f1..a38947544d5 100644 --- a/locale/po/grassmods_th.po +++ b/locale/po/grassmods_th.po @@ -66270,7 +66270,7 @@ msgid "Either or must be given" msgstr "" #: ../scripts/i.in.spotvgt/i.in.spotvgt.py:129 -msgid "'gdalinfo' not found, install GDAL tools first (http://www.gdal.org)" +msgid "'gdalinfo' not found, install GDAL tools first (https://gdal.org)" msgstr "" #: ../scripts/i.in.spotvgt/i.in.spotvgt.py:146 diff --git a/locale/po/grassmods_tr.po b/locale/po/grassmods_tr.po index 6e58f486013..ef10aa29895 100644 --- a/locale/po/grassmods_tr.po +++ b/locale/po/grassmods_tr.po @@ -67181,7 +67181,7 @@ msgid "Either or must be given" msgstr "" #: ../scripts/i.in.spotvgt/i.in.spotvgt.py:129 -msgid "'gdalinfo' not found, install GDAL tools first (http://www.gdal.org)" +msgid "'gdalinfo' not found, install GDAL tools first (https://gdal.org)" msgstr "" #: ../scripts/i.in.spotvgt/i.in.spotvgt.py:146 diff --git a/locale/po/grassmods_uk.po b/locale/po/grassmods_uk.po index 8bf34d792ef..ded3fc09c7a 100644 --- a/locale/po/grassmods_uk.po +++ b/locale/po/grassmods_uk.po @@ -66059,7 +66059,7 @@ msgid "Either or must be given" msgstr "" #: ../scripts/i.in.spotvgt/i.in.spotvgt.py:129 -msgid "'gdalinfo' not found, install GDAL tools first (http://www.gdal.org)" +msgid "'gdalinfo' not found, install GDAL tools first (https://gdal.org)" msgstr "" #: ../scripts/i.in.spotvgt/i.in.spotvgt.py:146 diff --git a/locale/po/grassmods_vi.po b/locale/po/grassmods_vi.po index bfe8eb81909..cb4f0aa95a9 100644 --- a/locale/po/grassmods_vi.po +++ b/locale/po/grassmods_vi.po @@ -66307,7 +66307,7 @@ msgid "Either or must be given" msgstr "" #: ../scripts/i.in.spotvgt/i.in.spotvgt.py:129 -msgid "'gdalinfo' not found, install GDAL tools first (http://www.gdal.org)" +msgid "'gdalinfo' not found, install GDAL tools first (https://gdal.org)" msgstr "" #: ../scripts/i.in.spotvgt/i.in.spotvgt.py:146 diff --git a/locale/po/grassmods_zh.po b/locale/po/grassmods_zh.po index f5926443d90..3ec8942025d 100644 --- a/locale/po/grassmods_zh.po +++ b/locale/po/grassmods_zh.po @@ -66768,7 +66768,7 @@ msgid "Either or must be given" msgstr "" #: ../scripts/i.in.spotvgt/i.in.spotvgt.py:129 -msgid "'gdalinfo' not found, install GDAL tools first (http://www.gdal.org)" +msgid "'gdalinfo' not found, install GDAL tools first (https://gdal.org)" msgstr "" #: ../scripts/i.in.spotvgt/i.in.spotvgt.py:146 diff --git a/locale/po/grassmods_zh_CN.po b/locale/po/grassmods_zh_CN.po index 9ba4d09e886..476cc510193 100644 --- a/locale/po/grassmods_zh_CN.po +++ b/locale/po/grassmods_zh_CN.po @@ -65730,7 +65730,7 @@ msgid "Either or must be given" msgstr "" #: ../scripts/i.in.spotvgt/i.in.spotvgt.py:129 -msgid "'gdalinfo' not found, install GDAL tools first (http://www.gdal.org)" +msgid "'gdalinfo' not found, install GDAL tools first (https://gdal.org)" msgstr "" #: ../scripts/i.in.spotvgt/i.in.spotvgt.py:146 diff --git a/locale/templates/grassmods.pot b/locale/templates/grassmods.pot index c339eb81069..3476f2faa63 100644 --- a/locale/templates/grassmods.pot +++ b/locale/templates/grassmods.pot @@ -65839,7 +65839,7 @@ msgid "Either or must be given" msgstr "" #: ../scripts/i.in.spotvgt/i.in.spotvgt.py:129 -msgid "'gdalinfo' not found, install GDAL tools first (http://www.gdal.org)" +msgid "'gdalinfo' not found, install GDAL tools first (https://gdal.org)" msgstr "" #: ../scripts/i.in.spotvgt/i.in.spotvgt.py:146 diff --git a/macosx/ReadMe.md b/macosx/ReadMe.md index ac19f4c57de..86fb1c0ba38 100644 --- a/macosx/ReadMe.md +++ b/macosx/ReadMe.md @@ -230,7 +230,7 @@ build)*: To install the new Python GUI (see [REQUIREMENTS.html](../REQUIREMENTS.html) and [gui/wxpython/README](../gui/wxpython/README), wxpython installer -available at [wxpython.org](http://wxpython.org/)), add this to configure (fill +available at [wxpython.org](https://wxpython.org/)), add this to configure (fill in the correct version at x.x.x.x for the wxpython you have installed): ```bash diff --git a/mswindows/README.html b/mswindows/README.html index 2b6f87db703..91be0f9afbb 100644 --- a/mswindows/README.html +++ b/mswindows/README.html @@ -7,7 +7,7 @@ Instructions how to prepare a WinGRASS package installer has been moved to -the wiki +the wiki page. diff --git a/mswindows/external/rbatch/R.bat b/mswindows/external/rbatch/R.bat index d55a6b395a8..fd28421d126 100644 --- a/mswindows/external/rbatch/R.bat +++ b/mswindows/external/rbatch/R.bat @@ -1,7 +1,7 @@ @Echo OFF :: Software and documentation is (c) 2013 GKX Associates Inc. and -:: licensed under [GPL 2.0](http://www.gnu.org/licenses/gpl-2.0.html). +:: licensed under [GPL 2.0](https://www.gnu.org/licenses/gpl-2.0.html). :: Help is at bottom of script or just run script with single argument: help @@ -520,7 +520,7 @@ goto:eof :Rhelp echo (c) 2013 G. Grothendieck -echo License: GPL 2.0 ( http://www.gnu.org/licenses/gpl-2.0.html ) +echo License: GPL 2.0 ( https://www.gnu.org/licenses/gpl-2.0.html ) echo Launch script for R and associated functions. echo Usage: R.bat [subcommand] [arguments] echo Subcommands where (0) means takes no arguments; (A) means may need Admin priv diff --git a/mswindows/external/rbatch/README.grass b/mswindows/external/rbatch/README.grass index 85f32b7a9be..40bc7a307a7 100644 --- a/mswindows/external/rbatch/README.grass +++ b/mswindows/external/rbatch/README.grass @@ -13,7 +13,7 @@ at svn-revision 104 (2012-08-31). -- -See http://trac.osgeo.org/grass/ticket/1149#comment:9 +See https://trac.osgeo.org/grass/ticket/1149#comment:9 -- diff --git a/mswindows/external/rbatch/Rpathset.bat b/mswindows/external/rbatch/Rpathset.bat index 7873fc01907..590e9a58980 100644 --- a/mswindows/external/rbatch/Rpathset.bat +++ b/mswindows/external/rbatch/Rpathset.bat @@ -1,5 +1,5 @@ :: Software and documentation is (c) 2013 GKX Associates Inc. and -:: licensed under [GPL 2.0](http://www.gnu.org/licenses/gpl-2.0.html). +:: licensed under [GPL 2.0](https://www.gnu.org/licenses/gpl-2.0.html). :: Purpose: setup path to use R, Rtools and other utilities from cmd line. :: diff --git a/mswindows/external/rbatch/batchfiles.md b/mswindows/external/rbatch/batchfiles.md index 2c10e2bcf75..de26ff2748f 100644 --- a/mswindows/external/rbatch/batchfiles.md +++ b/mswindows/external/rbatch/batchfiles.md @@ -3,7 +3,7 @@ G. Grothendieck Software and documentation is (c) 2013 GKX Associates Inc. and licensed -under [GPL 2.0](http://www.gnu.org/licenses/gpl-2.0.html). +under [GPL 2.0](https://www.gnu.org/licenses/gpl-2.0.html). ## Introduction ## diff --git a/mswindows/external/rbatch/batchfiles.tex b/mswindows/external/rbatch/batchfiles.tex index da8d64664b7..acfa8c6e634 100644 --- a/mswindows/external/rbatch/batchfiles.tex +++ b/mswindows/external/rbatch/batchfiles.tex @@ -3,7 +3,7 @@ \section{Windows Batch Files for R} G. Grothendieck Software and documentation is (c) 2013 GKX Associates Inc. and licensed -under \href{http://www.gnu.org/licenses/gpl-2.0.html}{GPL 2.0}. +under \href{https://www.gnu.org/licenses/gpl-2.0.html}{GPL 2.0}. \subsection{Introduction} diff --git a/mswindows/external/rbatch/copydir.bat b/mswindows/external/rbatch/copydir.bat index f346560b3f0..9ab646e6e0c 100644 --- a/mswindows/external/rbatch/copydir.bat +++ b/mswindows/external/rbatch/copydir.bat @@ -1,6 +1,6 @@ @echo off :: Software and documentation is (c) 2013 GKX Associates Inc. and -:: licensed under [GPL 2.0](http://www.gnu.org/licenses/gpl-2.0.html). +:: licensed under [GPL 2.0](https://www.gnu.org/licenses/gpl-2.0.html). setlocal if not "%2"=="" goto:run echo Usage: copydir fromdir todir diff --git a/mswindows/external/rbatch/movedir.bat b/mswindows/external/rbatch/movedir.bat index 104d6a0d5f0..57fb0a7a498 100644 --- a/mswindows/external/rbatch/movedir.bat +++ b/mswindows/external/rbatch/movedir.bat @@ -1,6 +1,6 @@ @echo off :: Software and documentation is (c) 2013 GKX Associates Inc. and -:: licensed under [GPL 2.0](http://www.gnu.org/licenses/gpl-2.0.html). +:: licensed under [GPL 2.0](https://www.gnu.org/licenses/gpl-2.0.html). setlocal if not "%2"=="" goto:run echo Usage: copydir fromdir todir diff --git a/python/grass/docs/src/pygrass_index.rst b/python/grass/docs/src/pygrass_index.rst index 9e782e4c452..844e5578ae8 100644 --- a/python/grass/docs/src/pygrass_index.rst +++ b/python/grass/docs/src/pygrass_index.rst @@ -46,7 +46,7 @@ References Resources Analysis Support System (GRASS) Geographic Information System (GIS)*. ISPRS International Journal of Geo-Information. 2(1):201-219. `doi:10.3390/ijgi2010201 - `_ + `_ * `Python related articles in the GRASS GIS Wiki `_ * `GRASS GIS 8 Programmer's Manual @@ -54,7 +54,7 @@ References This project has been funded with support from the `Google Summer of Code 2012 -`_ +`_ .. Indices and tables diff --git a/python/grass/docs/src/pygrass_modules.rst b/python/grass/docs/src/pygrass_modules.rst index a668739a34f..854119057d6 100644 --- a/python/grass/docs/src/pygrass_modules.rst +++ b/python/grass/docs/src/pygrass_modules.rst @@ -200,4 +200,4 @@ Multiple GRASS modules can be joined into one object by :class:`~pygrass.modules.interface.module.MultiModule`. -.. _Popen: http://docs.python.org/library/subprocess.html#Popen +.. _Popen: https://docs.python.org/library/subprocess.html#Popen diff --git a/python/grass/docs/src/temporal_framework.rst b/python/grass/docs/src/temporal_framework.rst index 7e68de132a9..2443098b26a 100644 --- a/python/grass/docs/src/temporal_framework.rst +++ b/python/grass/docs/src/temporal_framework.rst @@ -414,7 +414,7 @@ Temporal shifting References ---------- -* Gebbert, S., Pebesma, E., 2014. *TGRASS: A temporal GIS for field based environmental modeling*. Environmental Modelling & Software. 2(1):201-219. `doi:10.1016/j.envsoft.2013.11.001 `_ +* Gebbert, S., Pebesma, E., 2014. *TGRASS: A temporal GIS for field based environmental modeling*. Environmental Modelling & Software. 2(1):201-219. `doi:10.1016/j.envsoft.2013.11.001 `_ * `TGRASS related articles in the GRASS GIS Wiki `_ * Supplementary material of the publication *The GRASS GIS Temporal Framework* to be published in diff --git a/python/grass/gunittest/reporters.py b/python/grass/gunittest/reporters.py index 57b0a8fc643..7c93872a656 100644 --- a/python/grass/gunittest/reporters.py +++ b/python/grass/gunittest/reporters.py @@ -107,7 +107,7 @@ def get_source_url(path, revision, line=None): :param revision: SVN revision (should be a number) :param line: line in the file (should be None for directories) """ - tracurl = "http://trac.osgeo.org/grass/browser/" + tracurl = "https://trac.osgeo.org/grass/browser/" if line: return "{tracurl}{path}?rev={revision}#L{line}".format(**locals()) return "{tracurl}{path}?rev={revision}".format(**locals()) diff --git a/python/grass/imaging/images2gif.py b/python/grass/imaging/images2gif.py index 4084dade509..d37ec0c4e32 100644 --- a/python/grass/imaging/images2gif.py +++ b/python/grass/imaging/images2gif.py @@ -58,7 +58,7 @@ Useful links: * http://tronche.com/computer-graphics/gif/ - * http://en.wikipedia.org/wiki/Graphics_Interchange_Format + * https://en.wikipedia.org/wiki/Graphics_Interchange_Format * http://www.w3.org/Graphics/GIF/spec-gif89a.txt """ diff --git a/python/grass/pygrass/modules/interface/module.py b/python/grass/pygrass/modules/interface/module.py index 392d7571015..7f70d82bac1 100644 --- a/python/grass/pygrass/modules/interface/module.py +++ b/python/grass/pygrass/modules/interface/module.py @@ -559,7 +559,7 @@ def __init__(self, cmd, *args, **kargs): # get the xml of the module self.xml = get_cmd_xml.communicate()[0] # transform and parse the xml into an Element class: - # http://docs.python.org/library/xml.etree.elementtree.html + # https://docs.python.org/library/xml.etree.elementtree.html tree = fromstring(self.xml) for e in tree: diff --git a/python/grass/script/utils.py b/python/grass/script/utils.py index 25eb70190c5..0a32a9e7b4e 100644 --- a/python/grass/script/utils.py +++ b/python/grass/script/utils.py @@ -321,7 +321,7 @@ def split(s): # source: -# http://stackoverflow.com/questions/4836710/ +# https://stackoverflow.com/questions/4836710/ # does-python-have-a-built-in-function-for-string-natural-sort/4836734#4836734 def natural_sort(items): """Returns sorted list using natural sort diff --git a/python/libgrass_interface_generator/ctypesgen/parser/yacc.py b/python/libgrass_interface_generator/ctypesgen/parser/yacc.py index f30cadb7a1a..9b57d110231 100644 --- a/python/libgrass_interface_generator/ctypesgen/parser/yacc.py +++ b/python/libgrass_interface_generator/ctypesgen/parser/yacc.py @@ -311,7 +311,7 @@ def restart(self): # certain kinds of advanced parsing situations where the lexer and parser interact with # each other or change states (i.e., manipulation of scope, lexer states, etc.). # - # See: http://www.gnu.org/software/bison/manual/html_node/Default-Reductions.html#Default-Reductions + # See: https://www.gnu.org/software/bison/manual/html_node/Default-Reductions.html#Default-Reductions def set_defaulted_states(self): self.defaulted_states = {} for state, actions in self.action.items(): diff --git a/python/libgrass_interface_generator/ctypesgen/printer_json/printer.py b/python/libgrass_interface_generator/ctypesgen/printer_json/printer.py index ab88af4dc40..4a201aa5702 100755 --- a/python/libgrass_interface_generator/ctypesgen/printer_json/printer.py +++ b/python/libgrass_interface_generator/ctypesgen/printer_json/printer.py @@ -7,7 +7,7 @@ # From: -# http://stackoverflow.com/questions/1036409/recursively-convert-python-object-graph-to-dictionary +# https://stackoverflow.com/questions/1036409/recursively-convert-python-object-graph-to-dictionary def todict(obj, classkey="Klass"): if isinstance(obj, dict): for k in obj.keys(): diff --git a/raster/r.buildvrt/r.buildvrt.html b/raster/r.buildvrt/r.buildvrt.html index d3a6d507bc1..67368179efb 100644 --- a/raster/r.buildvrt/r.buildvrt.html +++ b/raster/r.buildvrt/r.buildvrt.html @@ -20,7 +20,7 @@

    NOTES

    A GRASS virtual raster can be regarded as a simplified version of GDAL's -virtual raster format. +virtual raster format. The GRASS equivalent is simpler because issues like nodata, projection, resolution, resampling, masking are already handled by native GRASS raster routines. @@ -59,7 +59,7 @@

    SEE ALSO

    The equivalent GDAL utility -gdalbuildvrt +gdalbuildvrt

    AUTHOR

    diff --git a/raster/r.composite/r.composite.html b/raster/r.composite/r.composite.html index 4bd8e49cbe4..0ddd72592ea 100644 --- a/raster/r.composite/r.composite.html +++ b/raster/r.composite/r.composite.html @@ -47,7 +47,7 @@

    SEE ALSO

    r.rgb

    -Wikipedia Entry: Floyd-Steinberg dithering +Wikipedia Entry: Floyd-Steinberg dithering

    AUTHOR

    diff --git a/raster/r.external.out/r.external.out.html b/raster/r.external.out/r.external.out.html index baf48466ed3..c4b3bc65af1 100644 --- a/raster/r.external.out/r.external.out.html +++ b/raster/r.external.out/r.external.out.html @@ -70,7 +70,7 @@

    Complete workflow using only external geodata while processing in GRASS GIS<

    REFERENCES

    -GDAL Pages: http://www.gdal.org/
    +GDAL Pages: https://gdal.org/

    SEE ALSO

    diff --git a/raster/r.external/r.external.html b/raster/r.external/r.external.html index f20c3e059d6..1c69b2d3c3f 100644 --- a/raster/r.external/r.external.html +++ b/raster/r.external/r.external.html @@ -62,7 +62,7 @@

    Processing workflow without data import and export

    REFERENCES

    -GDAL Pages: http://www.gdal.org/
    +GDAL Pages: https://gdal.org/

    SEE ALSO

    diff --git a/raster/r.fill.stats/r.fill.stats.html b/raster/r.fill.stats/r.fill.stats.html index 3151d2c245a..fdc60119243 100644 --- a/raster/r.fill.stats/r.fill.stats.html +++ b/raster/r.fill.stats/r.fill.stats.html @@ -509,7 +509,7 @@

    SEE ALSO

    -Inverse Distance Weighting in Wikipedia +Inverse Distance Weighting in Wikipedia

    AUTHOR

    diff --git a/raster/r.geomorphon/r.geomorphon.html b/raster/r.geomorphon/r.geomorphon.html index 0eb675451f3..54af307b007 100644 --- a/raster/r.geomorphon/r.geomorphon.html +++ b/raster/r.geomorphon/r.geomorphon.html @@ -187,7 +187,7 @@

    REFERENCES

    109-112 (PDF)
  • Jasiewicz, J., Stepinski, T., 2013, Geomorphons - a pattern recognition approach to classification and mapping of landforms, -Geomorphology, vol. 182, 147-156 (DOI: 10.1016/j.geomorph.2012.11.005)
  • +Geomorphology, vol. 182, 147-156 (DOI: 10.1016/j.geomorph.2012.11.005)

    SEE ALSO

    diff --git a/raster/r.grow.distance/r.grow.distance.html b/raster/r.grow.distance/r.grow.distance.html index bc2788aae44..ee5e276a550 100644 --- a/raster/r.grow.distance/r.grow.distance.html +++ b/raster/r.grow.distance/r.grow.distance.html @@ -127,9 +127,9 @@

    SEE ALSO

    -Wikipedia Entry: +Wikipedia Entry: Euclidean Metric
    -Wikipedia Entry: +Wikipedia Entry: Manhattan Metric
    diff --git a/raster/r.in.gdal/r.in.gdal.html b/raster/r.in.gdal/r.in.gdal.html index f21f5682226..5af167a78e0 100644 --- a/raster/r.in.gdal/r.in.gdal.html +++ b/raster/r.in.gdal/r.in.gdal.html @@ -20,7 +20,7 @@

    GDAL supported raster formats

    Full details on all GDAL supported formats are available at:

    -http://www.gdal.org/formats_list.html +https://gdal.org/formats_list.html

    Selected formats out of the more than 140 supported formats: @@ -363,7 +363,7 @@

    GLOBE DEM

    Raster file import over network

    Since GDAL 2.x it is possible to import raster data over the network -(see GDAL Virtual File Systems) +(see GDAL Virtual File Systems) including Cloud Optimized GeoTIFF, i.e. access uncompressed and compressed raster data via a http(s) or ftp connection. As an example the import of the global SRTMGL1 V003 tiles at 1 arc second (about 30 meters) @@ -398,7 +398,7 @@

    HDF

    REFERENCES

    -GDAL Pages: http://www.gdal.org/ +GDAL Pages: https://gdal.org/

    SEE ALSO

    diff --git a/raster/r.in.xyz/r.in.xyz.html b/raster/r.in.xyz/r.in.xyz.html index 15d9f3565aa..42e5e1ee7f8 100644 --- a/raster/r.in.xyz/r.in.xyz.html +++ b/raster/r.in.xyz/r.in.xyz.html @@ -245,7 +245,7 @@

    Import of x,y,z ASCII into DEM

    Import of LiDAR data and DEM creation

    -Import the Jockey's +Import the Jockey's Ridge, NC, LIDAR dataset (compressed file "lidaratm2.txt.gz"), and process it into a clean DEM: diff --git a/raster/r.out.gdal/r.out.gdal.html b/raster/r.out.gdal/r.out.gdal.html index 9cb5b9d8156..06d269944c5 100644 --- a/raster/r.out.gdal/r.out.gdal.html +++ b/raster/r.out.gdal/r.out.gdal.html @@ -9,7 +9,7 @@

    DESCRIPTION

    (createopt="TFW=YES,COMPRESS=DEFLATE").

    For possible createopt and metaopt parameters please consult the individual -supported formats +supported formats pages on the GDAL website. The createopt parameter may be used to create TFW or World files ("TFW=YES","WORLDFILE=ON"). @@ -25,7 +25,7 @@

    DESCRIPTION

    SUPPORTED RASTER FORMATS

    -The set of supported +The set of supported raster formats written by r.out.gdal depends on the local GDAL installation, printed with the -l flag. Available may be (incomplete list):

    @@ -66,9 +66,9 @@

    NOTES

    Moreover, some GDAL-supported formats do not support all the data types possible in GDAL and GRASS. Use r.info to check the data type and range for your GRASS raster, refer to specific -format documentation (on the GDAL website), +format documentation (on the GDAL website), format vendor's documentation, and e.g. the Wikipedia article - + Typical boundaries of primitive integral types for details. @@ -368,7 +368,7 @@

    GDAL RELATED ERROR MESSAGES

    REFERENCES

    -GDAL Pages: https://gdal.org +GDAL Pages: https://gdal.org

    SEE ALSO

    diff --git a/raster/r.out.mpeg/r.out.mpeg.html b/raster/r.out.mpeg/r.out.mpeg.html index e035fce04c5..eb282acbbd9 100644 --- a/raster/r.out.mpeg/r.out.mpeg.html +++ b/raster/r.out.mpeg/r.out.mpeg.html @@ -2,7 +2,7 @@

    DESCRIPTION

    r.out.mpeg is a tool for combining a series of GRASS raster maps into a single MPEG-1 -(Motion +(Motion Pictures Experts Group) format file. MPEG-1 is a "lossy" video compression format, so the quality of each resulting frame of the animation will be much diminished from the diff --git a/raster/r.resamp.filter/r.resamp.filter.html b/raster/r.resamp.filter/r.resamp.filter.html index 0690a090b74..2872efd8774 100644 --- a/raster/r.resamp.filter/r.resamp.filter.html +++ b/raster/r.resamp.filter/r.resamp.filter.html @@ -14,7 +14,7 @@

    DESCRIPTION

    r.resamp.filter implements FIR (finite impulse response) filtering. All of the functions are low-pass filters, as they are symmetric. See -Wikipedia: Window function +Wikipedia: Window function for examples of common window functions and their frequency responses.

    @@ -63,7 +63,7 @@

    NOTES

    cover 3 times as large a time interval) as lanczos1 in order to get a similar frequency response (higher-order filters will fall off faster, but the frequency at which the fall-off starts should be the same). See -Wikipedia: Lanczos-kernel.svg +Wikipedia: Lanczos-kernel.svg for an illustration. If both graphs were drawn on the same axes, they would have roughly the same shape, but the a=3 window would have a longer tail. By scaling the axes to the same width, the a=3 window has a narrower diff --git a/raster/r.sim/r.sim.sediment/r.sim.sediment.html b/raster/r.sim/r.sim.sediment/r.sim.sediment.html index 025fa3f72b1..caebb9c308c 100644 --- a/raster/r.sim/r.sim.sediment/r.sim.sediment.html +++ b/raster/r.sim/r.sim.sediment/r.sim.sediment.html @@ -71,7 +71,7 @@

    REFERENCES

    In: Landscape erosion and landscape evolution modeling, Harmon R. and Doe W. eds., Kluwer Academic/Plenum Publishers, pp. 321-347.

    - + Neteler, M. and Mitasova, H., 2008, Open Source GIS: A GRASS GIS Approach. Third Edition. The International Series in Engineering and Computer Science: Volume 773. Springer New York Inc, p. 406. diff --git a/raster/r.sim/r.sim.water/r.sim.water.html b/raster/r.sim/r.sim.water/r.sim.water.html index 3c920473ca9..79cef1bfadc 100644 --- a/raster/r.sim/r.sim.water/r.sim.water.html +++ b/raster/r.sim/r.sim.water/r.sim.water.html @@ -237,7 +237,7 @@

    REFERENCES

    April 2015
  • Neteler, M. and Mitasova, H., 2008, -Open Source GIS: A GRASS GIS Approach. Third Edition. +Open Source GIS: A GRASS GIS Approach. Third Edition. The International Series in Engineering and Computer Science: Volume 773. Springer New York Inc, p. 406. diff --git a/raster/r.stream.extract/r.stream.extract.html b/raster/r.stream.extract/r.stream.extract.html index 22877936c93..acc9030d0b0 100644 --- a/raster/r.stream.extract/r.stream.extract.html +++ b/raster/r.stream.extract/r.stream.extract.html @@ -258,7 +258,7 @@

    REFERENCES

  • Holmgren, P. (1994). Multiple flow direction algorithms for runoff modelling in grid based elevation models: An empirical evaluation. -Hydrological Processes Vol 8(4), pp 327-334. DOI: 10.1002/hyp.3360080405
  • +Hydrological Processes Vol 8(4), pp 327-334. DOI: 10.1002/hyp.3360080405
  • Montgomery, D.R., Foufoula-Georgiou, E. (1993). Channel network source representation using digital elevation models. Water Resources Research Vol 29(12), pp 3925-3934.
  • diff --git a/raster/r.sun/TODO b/raster/r.sun/TODO index 3e54873977e..4d31c0314df 100644 --- a/raster/r.sun/TODO +++ b/raster/r.sun/TODO @@ -16,10 +16,10 @@ Update https://grasswiki.osgeo.org/wiki/R.sun #### -Fix http://trac.osgeo.org/grass/ticket/498 +Fix https://trac.osgeo.org/grass/ticket/498 pseudo-data test-case -http://trac.osgeo.org/grass/ticket/498#comment:22 +https://trac.osgeo.org/grass/ticket/498#comment:22 #spearfish (further north than NC so more defined shadows) g.region -d r.mapcalc "undulates = (2 + sin( row() * 2 ) + cos( col() * 2 )) * 500" diff --git a/raster/r.sun/r.sun.html b/raster/r.sun/r.sun.html index 189633f9f48..ec43813d51c 100644 --- a/raster/r.sun/r.sun.html +++ b/raster/r.sun/r.sun.html @@ -345,7 +345,7 @@

    REFERENCES

  • Neteler, M., Mitasova, H. (2002): Open Source GIS: A GRASS GIS Approach, Kluwer Academic Publishers. (Appendix explains formula; -r.sun script download) +r.sun script download)
  • Page, J. ed. (1986). Prediction of solar radiation on inclined surfaces. Solar energy R&D in the European Community, series F - Solar radiation data, diff --git a/raster/r.support/r.support.html b/raster/r.support/r.support.html index 111e46f653d..13fdf2a26af 100644 --- a/raster/r.support/r.support.html +++ b/raster/r.support/r.support.html @@ -5,12 +5,13 @@

    DESCRIPTION

    history, semantic label elements and title is supported. Category labels can also be copied from another raster map. -

    Raster band management

    +

    Raster semantic labels and band management

    + Raster semantic label concept is similar to dimension name in other GIS and -remote sensing applications. Most common usage will be assigning a -remote sensing platform sensor band ID to the raster, although any -identifier is supported. Raster semantic label is suggested to work with -imagery classification tools.
    +remote sensing applications. Most common usage will be assigning a remote +sensing platform sensor band identifier to the raster map metadata, although +any identifier is supported (see i.band.library). +Raster semantic label is suggested to work with imagery classification tools.

    EXAMPLES

    @@ -57,12 +58,14 @@

    NOTES

    SEE ALSO

    +i.band.library, r.category, r.describe, r.info, r.null, r.region, r.report, +r.semantic.label, r.timestamp diff --git a/raster/r.surf.fractal/r.surf.fractal.html b/raster/r.surf.fractal/r.surf.fractal.html index d564cbec4e1..2a2a3e3a060 100644 --- a/raster/r.surf.fractal/r.surf.fractal.html +++ b/raster/r.surf.fractal/r.surf.fractal.html @@ -11,7 +11,7 @@

    DESCRIPTION

    NOTE

    -This module requires the FFTW library +This module requires the FFTW library for computing Discrete Fourier Transforms.

    EXAMPLE

    diff --git a/raster/r.watershed/front/r.watershed.html b/raster/r.watershed/front/r.watershed.html index abe352a6948..d9a226412af 100644 --- a/raster/r.watershed/front/r.watershed.html +++ b/raster/r.watershed/front/r.watershed.html @@ -520,7 +520,7 @@

    REFERENCES

  • Holmgren P. (1994). Multiple flow direction algorithms for runoff modelling in grid based elevation models: An empirical evaluation. Hydrological Processes Vol 8(4), 327-334.
    -DOI: 10.1002/hyp.3360080405 +DOI: 10.1002/hyp.3360080405
  • Kinner D., Mitasova H., Harmon R., Toma L., Stallard R. (2005). GIS-based Stream Network Analysis for The Chagres River Basin, @@ -535,19 +535,19 @@

    REFERENCES

  • Metz M., Mitasova H., Harmon R. (2011). Efficient extraction of drainage networks from massive, radar-based elevation models with least cost path search, Hydrol. Earth Syst. Sci. Vol 15, 667-678.
    -DOI: 10.5194/hess-15-667-2011 +DOI: 10.5194/hess-15-667-2011
  • Moore I.D., Grayson R.B., Ladson A.R. (1991). Digital terrain modelling: a review of hydrogical, geomorphological, and biological applications, Hydrological Processes, Vol 5(1), 3-30
    -DOI: 10.1002/hyp.3360050103 +DOI: 10.1002/hyp.3360050103
  • Quinn P., K. Beven K., Chevallier P., Planchon O. (1991). The prediction of hillslope flow paths for distributed hydrological modelling using Digital Elevation Models, Hydrological Processes Vol 5(1), p.59-79.
    -DOI: 10.1002/hyp.3360050106 +DOI: 10.1002/hyp.3360050106
  • Weltz M. A., Renard K.G., Simanton J. R. (1987). Revised Universal Soil Loss Equation for Western Rangelands, U.S.A./Mexico Symposium of diff --git a/raster3d/r3.flow/r3.flow.html b/raster3d/r3.flow/r3.flow.html index f4f9510e7df..7a7c60fd21d 100644 --- a/raster3d/r3.flow/r3.flow.html +++ b/raster3d/r3.flow/r3.flow.html @@ -41,7 +41,7 @@

    Attributes

    NOTES

    r3.flow uses Runge-Kutta with adaptive step size -(Cash-Karp method). +(Cash-Karp method).

    EXAMPLES

    diff --git a/raster3d/r3.out.netcdf/main.c b/raster3d/r3.out.netcdf/main.c index 6bcdcbaf9f5..144c9085eef 100644 --- a/raster3d/r3.out.netcdf/main.c +++ b/raster3d/r3.out.netcdf/main.c @@ -17,7 +17,7 @@ * here: * http://cf-pcmdi.llnl.gov/documents/cf-conventions/1.6/cf-conventions.html#coordinate-system * https://cf-pcmdi.llnl.gov/trac/wiki/Cf2CrsWkt - * http://trac.osgeo.org/gdal/wiki/NetCDF_ProjectionTestingStatus + * https://trac.osgeo.org/gdal/wiki/NetCDF_ProjectionTestingStatus * *****************************************************************************/ diff --git a/raster3d/r3.out.netcdf/r3.out.netcdf.html b/raster3d/r3.out.netcdf/r3.out.netcdf.html index 9fb256a06d3..2dc69701d4d 100644 --- a/raster3d/r3.out.netcdf/r3.out.netcdf.html +++ b/raster3d/r3.out.netcdf/r3.out.netcdf.html @@ -22,7 +22,7 @@

    NOTES

    Spatial coordinates are exported as cell centered coordinates. The projection can be optionally stored in the metadata as crs attributes . The netCDF projection metadata storage follows the spatial_ref GDAL/netCDF suggestion -here +here and the netCDF CF 1.6 convention here using WKT projection information. Additional a PROJ string is diff --git a/scripts/d.polar/d.polar.html b/scripts/d.polar/d.polar.html index fad50649371..d1bbc2e6586 100644 --- a/scripts/d.polar/d.polar.html +++ b/scripts/d.polar/d.polar.html @@ -62,7 +62,7 @@

    REFERENCES

    J. Hofierka, H. Mitasova, and M. Neteler (2009): Terrain parameterization in GRASS. In T. Hengl and H.I. Reuter, editors, Geomorphometry: concepts, software, applications. Elsevier -(DOI) +(DOI)

    AUTHORS

    diff --git a/scripts/db.in.ogr/db.in.ogr.html b/scripts/db.in.ogr/db.in.ogr.html index 322f22840f0..70e7dddc1b1 100644 --- a/scripts/db.in.ogr/db.in.ogr.html +++ b/scripts/db.in.ogr/db.in.ogr.html @@ -1,7 +1,7 @@

    DESCRIPTION

    db.in.ogr imports attribute tables in various formats as -supported by the OGR library +supported by the OGR library on the local system (DBF, CSV, PostgreSQL, SQLite, MySQL, ODBC, etc.). Optionally a unique key (ID) column can be added to the table. @@ -12,7 +12,7 @@

    Import CSV file

    Limited type recognition can be done for Integer, Real, String, Date, Time and DateTime columns through a descriptive file with same name as the CSV file, but .csvt extension -(see details here). +(see details here).
     # NOTE: create koeppen_gridcode.csvt first for automated type recognition
    diff --git a/scripts/i.band.library/i.band.library.html b/scripts/i.band.library/i.band.library.html
    index b5d98d2607b..196f1319e3a 100644
    --- a/scripts/i.band.library/i.band.library.html
    +++ b/scripts/i.band.library/i.band.library.html
    @@ -95,11 +95,11 @@ 

    Band reference and semantic label relation

    NOTES

    -Semantic label concept is supported by temporal GRASS modules, -see t.register, -t.rast.list, -t.info -and t.rast.mapcalc +Semantic label concept is supported by temporal GRASS modules, see +t.register, +t.rast.list, +t.info +and t.rast.mapcalc modules for examples.

    Image collections

    diff --git a/scripts/i.in.spotvgt/i.in.spotvgt.py b/scripts/i.in.spotvgt/i.in.spotvgt.py index 666f3721761..9885caea5ec 100755 --- a/scripts/i.in.spotvgt/i.in.spotvgt.py +++ b/scripts/i.in.spotvgt/i.in.spotvgt.py @@ -20,7 +20,7 @@ ############################################################################# # # REQUIREMENTS: -# - gdal: http://www.gdal.org +# - gdal: https://gdal.org # # Notes: # * According to the faq (http://www.vgt.vito.be/faq/faq.html), SPOT vegetation @@ -125,9 +125,7 @@ def main(): # check for gdalinfo (just to check if installation is complete) if not gs.find_program("gdalinfo", "--help"): - gs.fatal( - _("'gdalinfo' not found, install GDAL tools first (http://www.gdal.org)") - ) + gs.fatal(_("'gdalinfo' not found, install GDAL tools first (https://gdal.org)")) pid = str(os.getpid()) tmpfile = gs.tempfile() diff --git a/scripts/i.pansharpen/i.pansharpen.html b/scripts/i.pansharpen/i.pansharpen.html index 9a50b84bc4e..0db14283be9 100644 --- a/scripts/i.pansharpen/i.pansharpen.html +++ b/scripts/i.pansharpen/i.pansharpen.html @@ -235,7 +235,7 @@

    REFERENCES

  • Neteler, M, D. Grasso, I. Michelazzi, L. Miori, S. Merler, and C. Furlanello (2005). An integrated toolbox for image registration, fusion and classification. International Journal of Geoinformatics, 1(1):51-61 - (PDF) + (PDF)
  • Pohl, C, and J.L van Genderen (1998). Multisensor image fusion in remote sensing: concepts, methods and application. Int. J. of Rem. Sens., 19, 823-854. diff --git a/scripts/r.grow/r.grow.html b/scripts/r.grow/r.grow.html index cbf0088ca3c..b1b037fe5bd 100644 --- a/scripts/r.grow/r.grow.html +++ b/scripts/r.grow/r.grow.html @@ -80,8 +80,8 @@

    SEE ALSO

    r.patch
    -

    Wikipedia Entry: Euclidean Metric
    -Wikipedia Entry: Manhattan Metric +

    Wikipedia Entry: Euclidean Metric
    +Wikipedia Entry: Manhattan Metric

    AUTHORS

    diff --git a/scripts/r.in.wms/r.in.wms.html b/scripts/r.in.wms/r.in.wms.html index ff95f3851ea..0031627991c 100644 --- a/scripts/r.in.wms/r.in.wms.html +++ b/scripts/r.in.wms/r.in.wms.html @@ -22,7 +22,7 @@

    NOTES

    When using GDAL WMS driver (driver=WMS_GDAL), the GDAL library needs to be built with WMS support, -see GDAL WMS manual page +see GDAL WMS manual page for details.

    Tiled WMS

    diff --git a/scripts/r.semantic.label/r.semantic.label.html b/scripts/r.semantic.label/r.semantic.label.html index 9ebcfce10a6..45ac7b9373e 100644 --- a/scripts/r.semantic.label/r.semantic.label.html +++ b/scripts/r.semantic.label/r.semantic.label.html @@ -25,10 +25,10 @@

    NOTES

    Semantic labels are supported by temporal GRASS modules. Name of STRDS can be extended by band identifier in order to filter the result by a semantic label. See -t.register, -t.rast.list, -t.info -and t.rast.mapcalc +t.register, +t.rast.list, +t.info +and t.rast.mapcalc modules for examples.

    EXAMPLES

    diff --git a/scripts/v.db.dropcolumn/v.db.dropcolumn.py b/scripts/v.db.dropcolumn/v.db.dropcolumn.py index 298a29133b3..fd34f36893f 100755 --- a/scripts/v.db.dropcolumn/v.db.dropcolumn.py +++ b/scripts/v.db.dropcolumn/v.db.dropcolumn.py @@ -86,7 +86,7 @@ def main(): if driver == "sqlite": # echo "Using special trick for SQLite" - # http://www.sqlite.org/faq.html#q11 + # https://www.sqlite.org/faq.html#q11 colnames = [] coltypes = [] for f in gs.db_describe(table, database=database, driver=driver)["cols"]: diff --git a/scripts/v.db.join/v.db.join.html b/scripts/v.db.join/v.db.join.html index e44705c55b5..436c86a7d43 100644 --- a/scripts/v.db.join/v.db.join.html +++ b/scripts/v.db.join/v.db.join.html @@ -16,8 +16,8 @@

    EXAMPLES

    Exercise to join North Carolina geological classes from a CSV table to the "geology" map of the North Carolina sample dataset (requires download -of legend CSV file nc_geology.csv -from External data for NC sample dataset): +of legend CSV file nc_geology.csv +from External data for NC sample dataset):
     # check original map attributes
    @@ -49,7 +49,7 @@ 

    EXAMPLES

    Soil map table join

    Joining the soil type explanations from table soils_legend -into the Spearfish soils map (download legend): +into the Spearfish soils map (download legend):
     g.copy vect=soils,mysoils
    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 9a9d46356a9..7a422f47f7f 100755
    --- a/scripts/v.db.reconnect.all/v.db.reconnect.all.py
    +++ b/scripts/v.db.reconnect.all/v.db.reconnect.all.py
    @@ -19,6 +19,8 @@
     # % keyword: vector
     # % keyword: attribute table
     # % keyword: database
    +# % keyword: DBF
    +# % keyword: SQLite
     # %end
     # %flag
     # % key: c
    diff --git a/scripts/v.import/v.import.html b/scripts/v.import/v.import.html
    index a530f5f3662..281136939e2 100644
    --- a/scripts/v.import/v.import.html
    +++ b/scripts/v.import/v.import.html
    @@ -1,7 +1,7 @@
     

    DESCRIPTION

    v.import imports vector data from files and database connections -supported by the OGR library into the +supported by the OGR library into the current project (previously called location) and mapset. If the coordinate reference system (CRS) of the input does not match the CRS of the project, the input is reprojected @@ -11,13 +11,13 @@

    DESCRIPTION

    Supported Vector Formats

    v.import uses the OGR library which supports various vector data -formats including ESRI -Shapefile, Mapinfo +formats including ESRI +Shapefile, Mapinfo File, UK .NTF, SDTS, TIGER, IHO S-57 (ENC), DGN, GML, GPX, AVCBin, REC, Memory, OGDI, and PostgreSQL, depending on the local OGR installation. For details see the OGR web site. The OGR (Simple Features Library) is part of the -GDAL library, hence GDAL needs to be +GDAL library, hence GDAL needs to be installed to use v.import.

    diff --git a/scripts/v.in.e00/v.in.e00.html b/scripts/v.in.e00/v.in.e00.html index ef027c192e2..931bec50cf6 100644 --- a/scripts/v.in.e00/v.in.e00.html +++ b/scripts/v.in.e00/v.in.e00.html @@ -12,7 +12,7 @@

    NOTES

    REFERENCES

    AVCE00 library (providing 'avcimport' and 'e00conv')
    -OGR vector library +OGR vector library

    SEE ALSO

    diff --git a/scripts/v.in.geonames/v.in.geonames.html b/scripts/v.in.geonames/v.in.geonames.html index f2657c878c3..a38aa770cc5 100644 --- a/scripts/v.in.geonames/v.in.geonames.html +++ b/scripts/v.in.geonames/v.in.geonames.html @@ -78,4 +78,4 @@

    SEE ALSO

    AUTHOR

    -Markus Neteler +Markus Neteler diff --git a/temporal/t.rast.algebra/t.rast.algebra.html b/temporal/t.rast.algebra/t.rast.algebra.html index 126ed5df9c2..b7fda851224 100644 --- a/temporal/t.rast.algebra/t.rast.algebra.html +++ b/temporal/t.rast.algebra/t.rast.algebra.html @@ -608,10 +608,10 @@

    REFERENCES

    Related publications:
    • Gebbert, S., Pebesma, E. 2014. TGRASS: A temporal GIS for field based environmental modeling. - Environmental Modelling & Software 53, 1-12 (DOI) + Environmental Modelling & Software 53, 1-12 (DOI) - preprint PDF
    • Gebbert, S., Pebesma, E. 2017. The GRASS GIS temporal framework. International Journal of - Geographical Information Science 31, 1273-1292 (DOI)
    • + Geographical Information Science 31, 1273-1292 (DOI)
    • Gebbert, S., Leppelt, T., Pebesma, E., 2019. A topology based spatio-temporal map algebra for big data analysis. Data 4, 86. (DOI)
    diff --git a/temporal/temporalintro.html b/temporal/temporalintro.html index c5eca6ead2c..2780efd8c85 100644 --- a/temporal/temporalintro.html +++ b/temporal/temporalintro.html @@ -262,11 +262,11 @@

    See also

    • Gebbert, S., Pebesma, E. 2014. TGRASS: A temporal GIS for field based environmental modeling. - Environmental Modelling & Software 53, 1-12 (DOI) + Environmental Modelling & Software 53, 1-12 (DOI) - preprint PDF
    • Gebbert, S., Pebesma, E. 2017. The GRASS GIS temporal framework. International Journal of - Geographical Information Science 31, 1273-1292 (DOI)
    • + Geographical Information Science 31, 1273-1292 (DOI)
    • Gebbert, S., Leppelt, T., Pebesma, E., 2019. A topology based spatio-temporal map algebra for big data analysis. Data 4, 86. (DOI)
    • diff --git a/vector/v.buffer/v.buffer.html b/vector/v.buffer/v.buffer.html index 8c835331630..06b2828cdfb 100644 --- a/vector/v.buffer/v.buffer.html +++ b/vector/v.buffer/v.buffer.html @@ -154,7 +154,7 @@

      Buffer inside input areas

      REFERENCES

      SEE ALSO

      diff --git a/vector/v.cluster/v.cluster.html b/vector/v.cluster/v.cluster.html index 0e92f266eb9..9447538afab 100644 --- a/vector/v.cluster/v.cluster.html +++ b/vector/v.cluster/v.cluster.html @@ -21,7 +21,7 @@

      DESCRIPTION

      separately for each observed density (distance to the farthest neighbor).

      dbscan

      -The Density-Based Spatial +The Density-Based Spatial Clustering of Applications with Noise is a commonly used clustering algorithm. A new cluster is started for a point with at least min - 1 neighbors within the maximum distance. These neighbors @@ -46,7 +46,7 @@

      density

      optics

      This method is Ordering Points to +href="https://en.wikipedia.org/wiki/OPTICS_algorithm">Ordering Points to Identify the Clustering Structure. It is controlled by the number of neighbor points (option min - 1). The core distance of a point is the distance to the farthest neighbor. The reachability of a diff --git a/vector/v.external.out/v.external.out.html b/vector/v.external.out/v.external.out.html index 1d82620f17c..f9c3575aa88 100644 --- a/vector/v.external.out/v.external.out.html +++ b/vector/v.external.out/v.external.out.html @@ -2,9 +2,9 @@

      DESCRIPTION

      v.external.out instructs GRASS to write vector maps in external data format (e.g. ESRI Shapefile, Mapinfo, and others) -using OGR library. PostGIS data can +using OGR library. PostGIS data can be also written by -built-in GRASS-PostGIS +built-in GRASS-PostGIS data provider.

      NOTES

      @@ -26,9 +26,9 @@

      NOTES

      by format option. See the list of valid creation options at OGR formats specification page, example -for ESRI +for ESRI Shapefile -or PostgreSQL/PostGIS +or PostgreSQL/PostGIS format (section "Layer Creation Options"). Options are comma-separated pairs (key=value), the options are case-insensitive, @@ -180,10 +180,10 @@

      Restore settings

      REFERENCES

      SEE ALSO

      diff --git a/vector/v.external/v.external.html b/vector/v.external/v.external.html index fb1512f8942..200d3726363 100644 --- a/vector/v.external/v.external.html +++ b/vector/v.external/v.external.html @@ -3,7 +3,7 @@

      DESCRIPTION

      v.external creates new vector map as a link to external OGR layer or PostGIS feature table. OGR (Simple Features Library) is part of the -GDAL library, so you need to install +GDAL library, so you need to install GDAL to use v.external for external OGR layers. Note that a PostGIS feature table can be linked also using built-in GRASS-PostGIS data driver (requires GRASS to be built with PostgreSQL support). @@ -140,7 +140,7 @@

      SEE ALSO

      -GDAL Library +GDAL Library
      PostGIS diff --git a/vector/v.in.dxf/v.in.dxf.html b/vector/v.in.dxf/v.in.dxf.html index 85d05623344..a08d2fbb5ee 100644 --- a/vector/v.in.dxf/v.in.dxf.html +++ b/vector/v.in.dxf/v.in.dxf.html @@ -45,7 +45,7 @@

      DESCRIPTION

      REFERENCES

      -AutoCad DXF (from Wikipedia, the free encyclopedia)
      +AutoCad DXF (from Wikipedia, the free encyclopedia)
      DXF References (Autodesk-supplied documentation)

      SEE ALSO

      diff --git a/vector/v.kernel/v.kernel.html b/vector/v.kernel/v.kernel.html index c2bd14c87b5..3a5a0162129 100644 --- a/vector/v.kernel/v.kernel.html +++ b/vector/v.kernel/v.kernel.html @@ -2,7 +2,7 @@

      DESCRIPTION

      v.kernel generates a raster density map from vector points data using a moving -kernel. Available kernel +kernel. Available kernel density functions are uniform, triangular, epanechnikov, quartic, triweight, gaussian, cosine, default is gaussian. @@ -20,7 +20,7 @@

      NOTES

      (integer). The density result stored as category may be multiplied by this number.

      For the gaussian kernel, standard deviation for the -gaussian function +gaussian function is set to 1/4 of the radius.

      With the -o flag (experimental) the command tries to calculate an @@ -54,7 +54,7 @@

      REFERENCES

      method for networks, its computational method and a GIS-based tool. International Journal of Geographical Information Science, Vol 23(1), pp. 7-32.
      -DOI: 10.1080/13658810802475491 +DOI: 10.1080/13658810802475491

    SEE ALSO

    diff --git a/vector/v.label.sa/v.label.sa.html b/vector/v.label.sa/v.label.sa.html index 65864c78a2e..2376c70771c 100644 --- a/vector/v.label.sa/v.label.sa.html +++ b/vector/v.label.sa/v.label.sa.html @@ -41,7 +41,7 @@

    SEE ALSO

    d.label
    d.labels
    ps.map -Wikipedia article on simulated annealing +Wikipedia article on simulated annealing

    AUTHOR

    diff --git a/vector/v.net.bridge/v.net.bridge.html b/vector/v.net.bridge/v.net.bridge.html index fedb0559d6c..accd2484a33 100644 --- a/vector/v.net.bridge/v.net.bridge.html +++ b/vector/v.net.bridge/v.net.bridge.html @@ -8,8 +8,8 @@

    NOTES

    the (sub-)network. A node is an articulation point if its removal would disconnect the (sub-)network. For more information and formal definitions check the wikipedia entries: -bridge -and articulation +bridge +and articulation point.

    The output of the module contains the selected diff --git a/vector/v.net.centrality/v.net.centrality.html b/vector/v.net.centrality/v.net.centrality.html index bd122149d34..28871b660e3 100644 --- a/vector/v.net.centrality/v.net.centrality.html +++ b/vector/v.net.centrality/v.net.centrality.html @@ -9,7 +9,7 @@

    NOTES

    stores them in the given columns of an attribute table, which is created and linked to the output map. For the description of these, please check the following -wikipedia article. +wikipedia article. If the column name is not given for a measure then that measure is not computed. If -a flag is set then points are added on nodes without points. Also, the points for which the output is computed diff --git a/vector/v.net.flow/v.net.flow.html b/vector/v.net.flow/v.net.flow.html index 66a617cb0e6..9a15c95301e 100644 --- a/vector/v.net.flow/v.net.flow.html +++ b/vector/v.net.flow/v.net.flow.html @@ -23,7 +23,7 @@

    NOTES

    flowing in the backward direction. Cut map contains the edges in the minimum cut.
    -A famous result +A famous result says that the total amount of water flowing is equal to the minimum cut. diff --git a/vector/v.net/v.net.html b/vector/v.net/v.net.html index ab112155589..baef25e5484 100644 --- a/vector/v.net/v.net.html +++ b/vector/v.net/v.net.html @@ -154,7 +154,7 @@

    NOTES

    EXAMPLES

    -The examples are North Carolina dataset based. +The examples are North Carolina dataset based.

    Create nodes globally for all line ends and intersections

    diff --git a/vector/v.out.ascii/v.out.ascii.html b/vector/v.out.ascii/v.out.ascii.html index 2eff87a01fa..d8b6440b1c7 100644 --- a/vector/v.out.ascii/v.out.ascii.html +++ b/vector/v.out.ascii/v.out.ascii.html @@ -109,7 +109,7 @@

    Point mode

    WKT mode

    WKT is abbreviation -for Well-known +for Well-known text.
    diff --git a/vector/v.out.dxf/v.out.dxf.html b/vector/v.out.dxf/v.out.dxf.html
    index 853e19472bd..95057f05f22 100644
    --- a/vector/v.out.dxf/v.out.dxf.html
    +++ b/vector/v.out.dxf/v.out.dxf.html
    @@ -12,7 +12,7 @@ 

    NOTES

    REFERENCES

    -AutoCad DXF (from Wikipedia, the free encyclopedia) +AutoCad DXF (from Wikipedia, the free encyclopedia)

    SEE ALSO

    diff --git a/vector/v.out.ogr/v.out.ogr.html b/vector/v.out.ogr/v.out.ogr.html index d9a2c84049b..664a5c35a1a 100644 --- a/vector/v.out.ogr/v.out.ogr.html +++ b/vector/v.out.ogr/v.out.ogr.html @@ -1,27 +1,27 @@

    DESCRIPTION

    v.out.ogr converts GRASS vector map layer to any of the -supported OGR vector formats +supported OGR vector formats (including OGC GeoPackage, ESRI Shapefile, SpatiaLite or GML).

    OGR (Simple Features Library) is part of the -GDAL library, so you need to +GDAL library, so you need to install this library to use v.out.ogr.

    The OGR library supports many various formats including:

    @@ -193,7 +193,7 @@

    Export to KML (Google Earth)

    REFERENCES

    diff --git a/vector/v.out.postgis/v.out.postgis.html b/vector/v.out.postgis/v.out.postgis.html index 104a9ad2dae..aa9bd459778 100644 --- a/vector/v.out.postgis/v.out.postgis.html +++ b/vector/v.out.postgis/v.out.postgis.html @@ -65,8 +65,8 @@

    NOTES

    "geom". Name of the geometry column can be changed by options=GEOMETRY_NAME=<column>. Note that for exporting vector features as simple features can be alternatively -used PostgreSQL driver -from OGR library +used PostgreSQL driver +from OGR library through v.out.ogr module.

    diff --git a/vector/v.surf.rst/v.surf.rst.html b/vector/v.surf.rst/v.surf.rst.html index 66a39ebc6f8..199ca4fc3ca 100644 --- a/vector/v.surf.rst/v.surf.rst.html +++ b/vector/v.surf.rst/v.surf.rst.html @@ -389,7 +389,7 @@

    REFERENCES

  • Mitas, L., and Mitasova H., 1988, General variational approach to the approximation problem, Computers and Mathematics with Applications, v.16, p. 983-992.
  • -
  • +
  • Neteler, M. and Mitasova, H., 2008, Open Source GIS: A GRASS GIS Approach, 3rd Edition, Springer, New York, 406 pages.
  • Talmi, A. and Gilat, G., 1977 : Method for Smooth Approximation of Data, diff --git a/vector/v.univar/main.c b/vector/v.univar/main.c index f84bf118fab..85217498035 100644 --- a/vector/v.univar/main.c +++ b/vector/v.univar/main.c @@ -19,7 +19,7 @@ /* TODO * - add flag to weigh by line/boundary length and area size * Roger Bivand on GRASS devel ml on July 2 2004 - * http://lists.osgeo.org/pipermail/grass-dev/2004-July/014976.html + * https://lists.osgeo.org/pipermail/grass-dev/2004-July/014976.html * "[...] calculating weighted means, weighting by line length * or area surface size [does not make sense]. I think it would be * better to treat each line or area as a discrete, unweighted, unit diff --git a/vector/v.vol.rst/v.vol.rst.html b/vector/v.vol.rst/v.vol.rst.html index 06fc55e5118..571a162162c 100644 --- a/vector/v.vol.rst/v.vol.rst.html +++ b/vector/v.vol.rst/v.vol.rst.html @@ -85,7 +85,7 @@

    Cross validation procedure

    representing the whole dataset.

    Example - (based on Slovakia3d dataset): + (based on Slovakia3d dataset):

     v.info -c precip3d
     g.region n=5530000 s=5275000 w=4186000 e=4631000 res=500 -p
    diff --git a/vector/v.voronoi/v.voronoi.html b/vector/v.voronoi/v.voronoi.html
    index 0b2c9e4cd40..e719c2c0038 100644
    --- a/vector/v.voronoi/v.voronoi.html
    +++ b/vector/v.voronoi/v.voronoi.html
    @@ -82,7 +82,7 @@ 

    REFERENCES

    Steve J. Fortune, (1987). A Sweepline Algorithm for Voronoi Diagrams, Algorithmica 2, 153-174 - (DOI). + (DOI).

    SEE ALSO

    From 86693f6ce763abc2fd1fd563b4b442bba2da8d3c Mon Sep 17 00:00:00 2001 From: Arohan Ajit Date: Fri, 25 Oct 2024 13:32:09 -0400 Subject: [PATCH 14/50] wxGUI: FIxed bare except in photo2image/ (#4582) --- .flake8 | 3 +-- gui/wxpython/photo2image/ip2i_manager.py | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/.flake8 b/.flake8 index 7bc3070d15e..e73cc6d94c5 100644 --- a/.flake8 +++ b/.flake8 @@ -24,8 +24,7 @@ per-file-ignores = gui/scripts/d.wms.py: E501 gui/wxpython/image2target/g.gui.image2target.py: E501 gui/wxpython/nviz/*: E722 - gui/wxpython/photo2image/*: F841, E722, E265 - gui/wxpython/photo2image/g.gui.photo2image.py: E501, F841 + gui/wxpython/photo2image/g.gui.photo2image.py: E501 gui/wxpython/psmap/*: E501, E722 gui/wxpython/vdigit/*: F841, E722, F405, F403 gui/wxpython/animation/g.gui.animation.py: E501 diff --git a/gui/wxpython/photo2image/ip2i_manager.py b/gui/wxpython/photo2image/ip2i_manager.py index 711ec4191af..d0726a3bae2 100644 --- a/gui/wxpython/photo2image/ip2i_manager.py +++ b/gui/wxpython/photo2image/ip2i_manager.py @@ -163,7 +163,7 @@ def __init__( if p.returncode == 0: print("returncode = ", str(p.returncode)) self.Map.region = self.Map.GetRegion() - except: + except Exception: pass self.SwitchEnv("source") From 1a04b6401f7a3e1723e01fd213df6939ec7cf638 Mon Sep 17 00:00:00 2001 From: Arohan Ajit Date: Fri, 25 Oct 2024 13:33:31 -0400 Subject: [PATCH 15/50] r.fillnulls: Removed bare except from r.fillnulls (#4581) --- .flake8 | 1 - scripts/r.fillnulls/r.fillnulls.py | 8 ++++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/.flake8 b/.flake8 index e73cc6d94c5..c29f447c597 100644 --- a/.flake8 +++ b/.flake8 @@ -101,7 +101,6 @@ per-file-ignores = scripts/db.univar/db.univar.py: E501 scripts/d.frame/d.frame.py: E722 scripts/i.pansharpen/i.pansharpen.py: E722, E501 - scripts/r.fillnulls/r.fillnulls.py: E722 scripts/v.what.strds/v.what.strds.py: E501 # Line too long (esp. module interface definitions) scripts/*/*.py: E501 diff --git a/scripts/r.fillnulls/r.fillnulls.py b/scripts/r.fillnulls/r.fillnulls.py index a53d19a8a72..b22550db497 100755 --- a/scripts/r.fillnulls/r.fillnulls.py +++ b/scripts/r.fillnulls/r.fillnulls.py @@ -273,7 +273,7 @@ def main(): type="area", quiet=quiet, ) - except: + except CalledModuleError: gs.fatal( _( "abandoned. Removing temporary maps, restoring " @@ -481,7 +481,7 @@ def main(): tmp_rmaps.remove(holename + "_edges") tmp_rmaps.remove(holename + "_dem") tmp_vmaps.remove(holename) - except: + except ValueError: pass gs.warning( _( @@ -545,7 +545,7 @@ def main(): tmp_rmaps.remove(holename + "_grown") tmp_rmaps.remove(holename + "_edges") tmp_rmaps.remove(holename + "_dem") - except: + except ValueError: pass try: gs.run_command( @@ -569,7 +569,7 @@ def main(): ) try: tmp_vmaps.remove(holename) - except: + except ValueError: pass try: gs.run_command( From 9e1e85d6079f36962f19b32793b31f43c23b5a4f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edouard=20Choini=C3=A8re?= <27212526+echoix@users.noreply.github.com> Date: Fri, 25 Oct 2024 13:34:52 -0400 Subject: [PATCH 16/50] style: Fix if-else-block-instead-of-if-exp (SIM108) (part 3) (#4570) * style: Fix if-else-block-instead-of-if-exp (SIM108) in scripts/ Ruff rule: https://docs.astral.sh/ruff/rules/if-else-block-instead-of-if-exp * style: Fix if-else-block-instead-of-if-exp (SIM108) in python/ Ruff rule: https://docs.astral.sh/ruff/rules/if-else-block-instead-of-if-exp * checks: Rename inner variable shadowing type to _type in python/grass/temporal/gui_support.py * style: Manual fixes for if-else-block-instead-of-if-exp (SIM108) in python/ Ruff rule: https://docs.astral.sh/ruff/rules/if-else-block-instead-of-if-exp * style: Fix if-else-block-instead-of-if-exp (SIM108) in gui/ Ruff rule: https://docs.astral.sh/ruff/rules/if-else-block-instead-of-if-exp * checks: Rename inner variable shadowing list to _list in gui/wxpython/core/render.py * style: Manual fixes for if-else-block-instead-of-if-exp (SIM108) in gui/ Ruff rule: https://docs.astral.sh/ruff/rules/if-else-block-instead-of-if-exp * python: Add type annotations for grass.script.core.parser() * python: Add type annotations for is_time_absolute() and is_time_relative() in grass.temporal.AbstractDataset * style: Enable Checking for SIM108 * Update pyproject.toml to remove fixed issues * Update base.py Co-authored-by: Anna Petrasova --------- Co-authored-by: Anna Petrasova --- gui/wxpython/animation/dialogs.py | 5 +- gui/wxpython/animation/frame.py | 17 ++---- gui/wxpython/animation/temporal_manager.py | 6 +-- gui/wxpython/core/gcmd.py | 5 +- gui/wxpython/core/gconsole.py | 10 +--- gui/wxpython/core/menutree.py | 32 +++-------- gui/wxpython/core/render.py | 45 ++++------------ gui/wxpython/core/settings.py | 5 +- gui/wxpython/core/treemodel.py | 7 +-- gui/wxpython/core/utils.py | 5 +- gui/wxpython/core/workspace.py | 22 ++------ gui/wxpython/datacatalog/tree.py | 5 +- gui/wxpython/dbmgr/base.py | 37 +++---------- gui/wxpython/dbmgr/dialogs.py | 10 +--- gui/wxpython/dbmgr/sqlbuilder.py | 10 +--- gui/wxpython/gcp/manager.py | 21 ++------ gui/wxpython/gmodeler/dialogs.py | 16 ++---- gui/wxpython/gmodeler/model.py | 62 +++++----------------- gui/wxpython/gmodeler/panels.py | 14 ++--- gui/wxpython/gui_core/dialogs.py | 15 ++---- gui/wxpython/gui_core/forms.py | 41 +++----------- gui/wxpython/gui_core/gselect.py | 27 ++-------- gui/wxpython/gui_core/mapdisp.py | 5 +- gui/wxpython/gui_core/menu.py | 5 +- gui/wxpython/gui_core/preferences.py | 5 +- gui/wxpython/gui_core/prompt.py | 5 +- gui/wxpython/gui_core/treeview.py | 5 +- gui/wxpython/iclass/dialogs.py | 6 +-- gui/wxpython/iclass/digit.py | 12 ++--- gui/wxpython/image2target/ii2t_gis_set.py | 5 +- gui/wxpython/image2target/ii2t_manager.py | 22 ++------ gui/wxpython/iscatt/controllers.py | 10 +--- gui/wxpython/iscatt/core_c.py | 6 +-- gui/wxpython/iscatt/frame.py | 6 +-- gui/wxpython/iscatt/iscatt_core.py | 6 +-- gui/wxpython/lmgr/frame.py | 10 +--- gui/wxpython/lmgr/layertree.py | 24 ++------- gui/wxpython/lmgr/menudata.py | 10 +--- gui/wxpython/location_wizard/wizard.py | 5 +- gui/wxpython/main_window/frame.py | 10 +--- gui/wxpython/mapdisp/frame.py | 11 ++-- gui/wxpython/mapdisp/toolbars.py | 5 +- gui/wxpython/mapwin/buffered.py | 25 ++------- gui/wxpython/mapwin/decorations.py | 10 +--- gui/wxpython/modules/colorrules.py | 25 ++------- gui/wxpython/modules/extensions.py | 6 +-- gui/wxpython/modules/import_export.py | 10 +--- gui/wxpython/modules/mcalc_builder.py | 5 +- gui/wxpython/nviz/mapwindow.py | 5 +- gui/wxpython/nviz/tools.py | 42 ++++----------- gui/wxpython/nviz/workspace.py | 5 +- gui/wxpython/nviz/wxnviz.py | 17 ++---- gui/wxpython/photo2image/ip2i_manager.py | 15 ++---- gui/wxpython/psmap/dialogs.py | 57 ++++---------------- gui/wxpython/psmap/frame.py | 35 +++--------- gui/wxpython/psmap/utils.py | 10 +--- gui/wxpython/rdigit/controller.py | 5 +- gui/wxpython/timeline/frame.py | 14 +++-- gui/wxpython/tools/update_menudata.py | 5 +- gui/wxpython/tplot/frame.py | 5 +- gui/wxpython/vdigit/dialogs.py | 5 +- gui/wxpython/vdigit/mapwindow.py | 10 +--- gui/wxpython/vdigit/preferences.py | 22 ++------ gui/wxpython/vdigit/toolbars.py | 5 +- gui/wxpython/vdigit/wxdigit.py | 5 +- gui/wxpython/vdigit/wxdisplay.py | 12 ++--- gui/wxpython/vnet/dialogs.py | 7 +-- gui/wxpython/vnet/vnet_data.py | 32 +++-------- gui/wxpython/vnet/vnet_utils.py | 5 +- gui/wxpython/web_services/widgets.py | 10 +--- gui/wxpython/wxgui.py | 5 +- gui/wxpython/wxplot/scatter.py | 6 +-- pyproject.toml | 3 +- python/grass/script/core.py | 10 ++-- python/grass/temporal/abstract_dataset.py | 6 ++- 75 files changed, 225 insertions(+), 804 deletions(-) diff --git a/gui/wxpython/animation/dialogs.py b/gui/wxpython/animation/dialogs.py index 644553ec328..5a634b3bb16 100644 --- a/gui/wxpython/animation/dialogs.py +++ b/gui/wxpython/animation/dialogs.py @@ -1619,10 +1619,7 @@ def SetStdsProperties(self, layer): dlg.CenterOnParent() if dlg.ShowModal() == wx.ID_OK: layer = dlg.GetLayer() - if hidden: - signal = self.layerAdded - else: - signal = self.cmdChanged + signal = self.layerAdded if hidden else self.cmdChanged signal.emit(index=self._layerList.GetLayerIndex(layer), layer=layer) elif hidden: self._layerList.RemoveLayer(layer) diff --git a/gui/wxpython/animation/frame.py b/gui/wxpython/animation/frame.py index 6496920a5cd..42953803778 100644 --- a/gui/wxpython/animation/frame.py +++ b/gui/wxpython/animation/frame.py @@ -274,17 +274,11 @@ def OnStop(self, event): self.controller.EndAnimation() def OnOneDirectionReplay(self, event): - if event.IsChecked(): - mode = ReplayMode.REPEAT - else: - mode = ReplayMode.ONESHOT + mode = ReplayMode.REPEAT if event.IsChecked() else ReplayMode.ONESHOT self.controller.SetReplayMode(mode) def OnBothDirectionReplay(self, event): - if event.IsChecked(): - mode = ReplayMode.REVERSE - else: - mode = ReplayMode.ONESHOT + mode = ReplayMode.REVERSE if event.IsChecked() else ReplayMode.ONESHOT self.controller.SetReplayMode(mode) def OnAdjustSpeed(self, event): @@ -642,11 +636,8 @@ def _updateFrameIndex(self, index): } else: label = _("to %(to)s") % {"to": self.timeLabels[index][1]} - else: # noqa: PLR5501 - if self.temporalType == TemporalType.ABSOLUTE: - label = start - else: - label = "" + else: + label = start if self.temporalType == TemporalType.ABSOLUTE else "" self.label2.SetLabel(label) if self.temporalType == TemporalType.RELATIVE: self.indexField.SetValue(start) diff --git a/gui/wxpython/animation/temporal_manager.py b/gui/wxpython/animation/temporal_manager.py index ef782543089..1b5037639cf 100644 --- a/gui/wxpython/animation/temporal_manager.py +++ b/gui/wxpython/animation/temporal_manager.py @@ -259,10 +259,8 @@ def _getLabelsAndMaps(self, timeseries): elif self.temporalType == TemporalType.RELATIVE: unit = self.timeseriesInfo[timeseries]["unit"] - if self.granularityMode == GranularityMode.ONE_UNIT: - gran = 1 - else: - gran = granNum + gran = 1 if self.granularityMode == GranularityMode.ONE_UNIT else granNum + # start sampling - now it can be used for both interval and point data # after instance, there can be a gap or an interval # if it is a gap we remove it and put there the previous instance instead diff --git a/gui/wxpython/core/gcmd.py b/gui/wxpython/core/gcmd.py index a173e28c7f8..134ed756d23 100644 --- a/gui/wxpython/core/gcmd.py +++ b/gui/wxpython/core/gcmd.py @@ -709,10 +709,7 @@ def RunCommand( kwargs["stdin"] = subprocess.PIPE # Do not change the environment, only a local copy. - if env: - env = env.copy() - else: - env = os.environ.copy() + env = env.copy() if env else os.environ.copy() if parent: env["GRASS_MESSAGE_FORMAT"] = "standard" diff --git a/gui/wxpython/core/gconsole.py b/gui/wxpython/core/gconsole.py index a4b58435cf4..5b58c08cc55 100644 --- a/gui/wxpython/core/gconsole.py +++ b/gui/wxpython/core/gconsole.py @@ -310,10 +310,7 @@ def write(self, s): if "GRASS_INFO_PERCENT" in line: value = int(line.rsplit(":", 1)[1].strip()) - if value >= 0 and value < 100: - progressValue = value - else: - progressValue = 0 + progressValue = value if value >= 0 and value < 100 else 0 elif "GRASS_INFO_MESSAGE" in line: self.type = "message" self.message += line.split(":", 1)[1].strip() + "\n" @@ -632,10 +629,7 @@ def load_source(modname, filename): return - if env: - env = env.copy() - else: - env = os.environ.copy() + env = env.copy() if env else os.environ.copy() # activate computational region (set with g.region) # for all non-display commands. if compReg and "GRASS_REGION" in env: diff --git a/gui/wxpython/core/menutree.py b/gui/wxpython/core/menutree.py index fba33daf705..b8f60e9610a 100644 --- a/gui/wxpython/core/menutree.py +++ b/gui/wxpython/core/menutree.py @@ -108,30 +108,14 @@ def _createItem(self, item, node): shortcut = item.find("shortcut") # optional wxId = item.find("id") # optional icon = item.find("icon") # optional - if gcmd is not None: - gcmd = gcmd.text - else: - gcmd = "" - if desc.text: - desc = _(desc.text) - else: - desc = "" - if keywords is None or keywords.text is None: - keywords = "" - else: - keywords = keywords.text - if shortcut is not None: - shortcut = shortcut.text - else: - shortcut = "" - if wxId is not None: - wxId = eval("wx." + wxId.text) - else: - wxId = wx.ID_ANY - if icon is not None: - icon = icon.text - else: - icon = "" + gcmd = gcmd.text if gcmd is not None else "" + desc = _(desc.text) if desc.text else "" + keywords = ( + "" if keywords is None or keywords.text is None else keywords.text + ) + shortcut = shortcut.text if shortcut is not None else "" + wxId = eval("wx." + wxId.text) if wxId is not None else wx.ID_ANY + icon = icon.text if icon is not None else "" label = origLabel if gcmd: if self.menustyle == 1: diff --git a/gui/wxpython/core/render.py b/gui/wxpython/core/render.py index 2db3287bf78..989287cd4a5 100644 --- a/gui/wxpython/core/render.py +++ b/gui/wxpython/core/render.py @@ -100,10 +100,7 @@ def __init__( if mapfile: self.mapfile = mapfile else: - if ltype == "overlay": - tempfile_sfx = ".png" - else: - tempfile_sfx = ".ppm" + tempfile_sfx = ".png" if ltype == "overlay" else ".ppm" self.mapfile = get_tempfile_name(suffix=tempfile_sfx) @@ -790,10 +787,7 @@ def ReportProgress(self, env, layer=None): stText += "..." if self.progressInfo["range"] != len(self.progressInfo["rendered"]): - if stText: - stText = _("Rendering & ") + stText - else: - stText = _("Rendering...") + stText = _("Rendering & ") + stText if stText else _("Rendering...") self.updateProgress.emit( range=self.progressInfo["range"], @@ -1260,16 +1254,8 @@ def GetListOfLayers( :return: list of selected layers """ selected = [] - - if isinstance(ltype, str): - one_type = True - else: - one_type = False - - if one_type and ltype == "overlay": - llist = self.overlays - else: - llist = self.layers + one_type = bool(isinstance(ltype, str)) + llist = self.overlays if one_type and ltype == "overlay" else self.layers # ["raster", "vector", "wms", ... ] for layer in llist: @@ -1332,10 +1318,7 @@ def Render(self, force=False, windres=False): self.renderMgr.Render(force, windres) def _addLayer(self, layer, pos=-1): - if layer.type == "overlay": - llist = self.overlays - else: - llist = self.layers + llist = self.overlays if layer.type == "overlay" else self.layers # add maplayer to the list of layers if pos > -1: @@ -1426,12 +1409,9 @@ def DeleteLayer(self, layer, overlay=False): """ Debug.msg(3, "Map.DeleteLayer(): name=%s" % layer.name) - if overlay: - list = self.overlays - else: - list = self.layers + _list = self.overlays if overlay else self.layers - if layer in list: + if layer in _list: if layer.mapfile: base, mapfile = os.path.split(layer.mapfile) tempbase = mapfile.split(".")[0] @@ -1448,7 +1428,7 @@ def DeleteLayer(self, layer, overlay=False): if os.path.isfile(layer._legrow): os.remove(layer._legrow) - list.remove(layer) + _list.remove(layer) self.layerRemoved.emit(layer=layer) return layer @@ -1583,13 +1563,10 @@ def GetLayerIndex(self, layer, overlay=False): :return: layer index :return: -1 if layer not found """ - if overlay: - list = self.overlays - else: - list = self.layers + _list = self.overlays if overlay else self.layers - if layer in list: - return list.index(layer) + if layer in _list: + return _list.index(layer) return -1 diff --git a/gui/wxpython/core/settings.py b/gui/wxpython/core/settings.py index b155d9607af..05c6579e636 100644 --- a/gui/wxpython/core/settings.py +++ b/gui/wxpython/core/settings.py @@ -960,10 +960,7 @@ def _readLegacyFile(self, settings=None): del kv[0] idx = 0 while idx < len(kv): - if subkeyMaster: - subkey = [subkeyMaster, kv[idx]] - else: - subkey = kv[idx] + subkey = [subkeyMaster, kv[idx]] if subkeyMaster else kv[idx] value = kv[idx + 1] value = self._parseValue(value, read=True) self.Append(settings, group, key, subkey, value) diff --git a/gui/wxpython/core/treemodel.py b/gui/wxpython/core/treemodel.py index fb18384ba36..0ce69133e1b 100644 --- a/gui/wxpython/core/treemodel.py +++ b/gui/wxpython/core/treemodel.py @@ -294,15 +294,12 @@ def __init__(self, label=None, data=None): def label(self): return self._label - def match(self, key, value, case_sensitive=False): + def match(self, key, value, case_sensitive=False) -> bool: """Method used for searching according to command, keywords or description.""" if not self.data: return False - if isinstance(key, str): - keys = [key] - else: - keys = key + keys = [key] if isinstance(key, str) else key for key in keys: if key not in {"command", "keywords", "description"}: diff --git a/gui/wxpython/core/utils.py b/gui/wxpython/core/utils.py index 2b1f3f4997a..6a39a158555 100644 --- a/gui/wxpython/core/utils.py +++ b/gui/wxpython/core/utils.py @@ -864,10 +864,7 @@ def StoreEnvVariable(key, value=None, envFile=None): ) ) return - if windows: - expCmd = "set" - else: - expCmd = "export" + expCmd = "set" if windows else "export" for key, value in environ.items(): fd.write("%s %s=%s\n" % (expCmd, key, value)) diff --git a/gui/wxpython/core/workspace.py b/gui/wxpython/core/workspace.py index 22aa56bfe62..dd460a68195 100644 --- a/gui/wxpython/core/workspace.py +++ b/gui/wxpython/core/workspace.py @@ -169,11 +169,8 @@ def __processFile(self): size = None extentAttr = display.get("extent", "") - if extentAttr: - # w, s, e, n - extent = map(float, extentAttr.split(",")) - else: - extent = None + # w, s, e, n + extent = map(float, extentAttr.split(",")) if extentAttr else None # projection node_projection = display.find("projection") @@ -312,10 +309,7 @@ def __processLayer(self, layer): ) ) - if layer.find("selected") is not None: - selected = True - else: - selected = False + selected = layer.find("selected") is not None # # Vector digitizer settings @@ -330,10 +324,7 @@ def __processLayer(self, layer): # Nviz (3D settings) # node_nviz = layer.find("nviz") - if node_nviz is not None: - nviz = self.__processLayerNviz(node_nviz) - else: - nviz = None + nviz = self.__processLayerNviz(node_nviz) if node_nviz is not None else None return (cmd, selected, vdigit, nviz) @@ -729,10 +720,7 @@ def __processLayerNvizNode(self, node, tag, cast, dc=None): try: value = cast(node_tag.text) except ValueError: - if cast == str: - value = "" - else: - value = None + value = "" if cast == str else None if dc: dc[tag] = {} dc[tag]["value"] = value diff --git a/gui/wxpython/datacatalog/tree.py b/gui/wxpython/datacatalog/tree.py index 176f5231712..bf06fd11ab8 100644 --- a/gui/wxpython/datacatalog/tree.py +++ b/gui/wxpython/datacatalog/tree.py @@ -2016,10 +2016,7 @@ def _getNewMapName(self, message, title, value, element, mapset, env): mapset=mapset, ) dlg.SetValue(value) - if dlg.ShowModal() == wx.ID_OK: - name = dlg.GetValue() - else: - name = None + name = dlg.GetValue() if dlg.ShowModal() == wx.ID_OK else None dlg.Destroy() return name diff --git a/gui/wxpython/dbmgr/base.py b/gui/wxpython/dbmgr/base.py index 1af8d6fccb1..c5eb8877b0a 100644 --- a/gui/wxpython/dbmgr/base.py +++ b/gui/wxpython/dbmgr/base.py @@ -1542,10 +1542,7 @@ def OnDataItemEdit(self, event): column = tlist.columns[columnName[i]] if len(values[i]) > 0: try: - if missingKey is True: - idx = i - 1 - else: - idx = i + idx = i - 1 if missingKey else i if column["ctype"] != str: tlist.itemDataMap[item][idx] = column["ctype"]( @@ -1707,10 +1704,7 @@ def OnDataItemAdd(self, event): del values[0] # add new item to the tlist - if len(tlist.itemIndexMap) > 0: - index = max(tlist.itemIndexMap) + 1 - else: - index = 0 + index = max(tlist.itemIndexMap) + 1 if len(tlist.itemIndexMap) > 0 else 0 tlist.itemIndexMap.append(index) tlist.itemDataMap[index] = values @@ -1828,11 +1822,7 @@ def _drawSelected(self, zoom, selectedOnly=True): return tlist = self.FindWindowById(self.layerPage[self.selLayer]["data"]) - if selectedOnly: - fn = tlist.GetSelectedItems - else: - fn = tlist.GetItems - + fn = tlist.GetSelectedItems if selectedOnly else tlist.GetItems cats = list(map(int, fn())) digitToolbar = None @@ -1929,11 +1919,7 @@ def AddQueryMapLayer(self, selectedOnly=True): :return: True if map has been redrawn, False if no map is given """ tlist = self.FindWindowById(self.layerPage[self.selLayer]["data"]) - if selectedOnly: - fn = tlist.GetSelectedItems - else: - fn = tlist.GetItems - + fn = tlist.GetSelectedItems if selectedOnly else tlist.GetItems cats = {self.selLayer: fn()} if self.mapdisplay.Map.GetLayerIndex(self.qlayer) < 0: @@ -2237,10 +2223,7 @@ def ValidateSelectStatement(self, statement): break cols += c index += 1 - if cols == "*": - cols = None - else: - cols = cols.split(",") + cols = None if cols == "*" else cols.split(",") tablelen = len(self.dbMgrData["mapDBInfo"].layers[self.selLayer]["table"]) @@ -2251,10 +2234,7 @@ def ValidateSelectStatement(self, statement): if len(statement[index + 7 + tablelen :]) > 0: index = statement.lower().find("where ") - if index > -1: - where = statement[index + 6 :] - else: - where = None + where = statement[index + 6 :] if index > -1 else None else: where = None @@ -3324,10 +3304,7 @@ def _createAddPage(self): row = 0 for key in ("layer", "driver", "database", "table", "key", "addCat"): label, value = self.addLayerWidgets[key] - if not value: - span = (1, 2) - else: - span = (1, 1) + span = (1, 2) if not value else (1, 1) dataSizer.Add(label, flag=wx.ALIGN_CENTER_VERTICAL, pos=(row, 0), span=span) if not value: diff --git a/gui/wxpython/dbmgr/dialogs.py b/gui/wxpython/dbmgr/dialogs.py index 0d7c6e9e523..8ec2b12f36b 100644 --- a/gui/wxpython/dbmgr/dialogs.py +++ b/gui/wxpython/dbmgr/dialogs.py @@ -393,10 +393,7 @@ def UpdateDialog(self, map=None, query=None, cats=None, fid=-1, action=None): """ if action: self.action = action - if action == "display": - enabled = False - else: - enabled = True + enabled = action != "display" self.closeDialog.Enable(enabled) self.FindWindowById(wx.ID_OK).Enable(enabled) @@ -420,10 +417,7 @@ def UpdateDialog(self, map=None, query=None, cats=None, fid=-1, action=None): idx = 0 for layer in data["Layer"]: layer = int(layer) - if data["Id"][idx] is not None: - tfid = int(data["Id"][idx]) - else: - tfid = 0 # Area / Volume + tfid = int(data["Id"][idx]) if data["Id"][idx] is not None else 0 if tfid not in self.cats: self.cats[tfid] = {} if layer not in self.cats[tfid]: diff --git a/gui/wxpython/dbmgr/sqlbuilder.py b/gui/wxpython/dbmgr/sqlbuilder.py index 5e6fe0e7706..51010e49677 100644 --- a/gui/wxpython/dbmgr/sqlbuilder.py +++ b/gui/wxpython/dbmgr/sqlbuilder.py @@ -574,10 +574,7 @@ def _add(self, element, value): idx1 = len("select") idx2 = sqlstr.lower().find("from") colstr = sqlstr[idx1:idx2].strip() - if colstr == "*": - cols = [] - else: - cols = colstr.split(",") + cols = [] if colstr == "*" else colstr.split(",") if value in cols: cols.remove(value) else: @@ -922,10 +919,7 @@ def _add(self, element, value): print(__doc__, file=sys.stderr) sys.exit() - if len(sys.argv) == 3: - layer = 1 - else: - layer = int(sys.argv[3]) + layer = 1 if len(sys.argv) == 3 else int(sys.argv[3]) if sys.argv[1] == "select": sqlBuilder = SQLBuilderSelect diff --git a/gui/wxpython/gcp/manager.py b/gui/wxpython/gcp/manager.py index 3b6dd398b51..74ede7189e9 100644 --- a/gui/wxpython/gcp/manager.py +++ b/gui/wxpython/gcp/manager.py @@ -469,11 +469,7 @@ def __init__(self, wizard, parent): def OnMaptype(self, event): """Change map type""" global maptype - - if event.GetInt() == 0: - maptype = "raster" - else: - maptype = "vector" + maptype = "raster" if event.GetInt() == 0 else "vector" def OnLocation(self, event): """Sets source location for map(s) to georectify""" @@ -1433,10 +1429,7 @@ def SetGCPSatus(self, item, itemIndex): else: item.SetPropertyVal("hide", False) if self.highest_only: - if itemIndex == self.highest_key: - wxPen = "highest" - else: - wxPen = "default" + wxPen = "highest" if itemIndex == self.highest_key else "default" elif self.mapcoordlist[key][5] > self.rmsthresh: wxPen = "highest" else: @@ -1676,10 +1669,7 @@ def OnFocus(self, event): pass def _onMouseLeftUpPointer(self, mapWindow, x, y): - if mapWindow == self.SrcMapWindow: - coordtype = "source" - else: - coordtype = "target" + coordtype = "source" if mapWindow == self.SrcMapWindow else "target" coord = (x, y) self.SetGCPData(coordtype, coord, self, confirm=True) @@ -1806,10 +1796,7 @@ def OnGeorect(self, event): self.grwiz.SwitchEnv("source") - if self.clip_to_region: - flags = "ac" - else: - flags = "a" + flags = "ac" if self.clip_to_region else "a" with wx.BusyInfo(_("Rectifying images, please wait..."), parent=self): wx.GetApp().Yield() diff --git a/gui/wxpython/gmodeler/dialogs.py b/gui/wxpython/gmodeler/dialogs.py index 7cd7cbd1147..c8dd7509e74 100644 --- a/gui/wxpython/gmodeler/dialogs.py +++ b/gui/wxpython/gmodeler/dialogs.py @@ -291,11 +291,7 @@ def GetPanel(self): def _getCmd(self): line = self.cmd_prompt.GetCurLine()[0].strip() - if len(line) == 0: - cmd = [] - else: - cmd = utils.split(str(line)) - return cmd + return [] if len(line) == 0 else utils.split(str(line)) def GetCmd(self): """Get command""" @@ -980,10 +976,7 @@ def Populate(self, data): checked.append(None) else: bId = action.GetBlockId() - if not bId: - bId = _("No") - else: - bId = _("Yes") + bId = _("No") if not bId else _("Yes") options = action.GetParameterizedParams() params = [] for f in options["flags"]: @@ -1110,10 +1103,7 @@ def MoveItems(self, items, up): idxList = {} itemsToSelect = [] for i in items: - if up: - idx = i - 1 - else: - idx = i + 1 + idx = i - 1 if up else i + 1 itemsToSelect.append(idx) idxList[model.GetItemIndex(modelActions[i])] = model.GetItemIndex( modelActions[idx] diff --git a/gui/wxpython/gmodeler/model.py b/gui/wxpython/gmodeler/model.py index fdf6ac63b36..15c4eaa8cd4 100644 --- a/gui/wxpython/gmodeler/model.py +++ b/gui/wxpython/gmodeler/model.py @@ -833,10 +833,7 @@ def Parameterize(self): if gtype in {"raster", "vector", "mapset", "file", "region", "dir"}: gisprompt = True prompt = gtype - if gtype == "raster": - element = "cell" - else: - element = gtype + element = "cell" if gtype == "raster" else gtype ptype = "string" else: gisprompt = False @@ -1102,10 +1099,7 @@ def _setPen(self): group="modeler", key="action", subkey=("width", "default") ) ) - if self.isEnabled: - style = wx.SOLID - else: - style = wx.DOT + style = wx.SOLID if self.isEnabled else wx.DOT pen = wx.Pen(wx.BLACK, width, style) self.SetPen(pen) @@ -1453,10 +1447,7 @@ def SetValue(self, value): self.SetLabel() for direction in ("from", "to"): for rel in self.GetRelations(direction): - if direction == "from": - action = rel.GetTo() - else: - action = rel.GetFrom() + action = rel.GetTo() if direction == "from" else rel.GetFrom() task = GUI(show=None).ParseCommand(cmd=action.GetLog(string=False)) task.set_param(rel.GetLabel(), self.value) @@ -1525,10 +1516,7 @@ def _getPen(self): group="modeler", key="action", subkey=("width", "default") ) ) - if self.intermediate: - style = wx.DOT - else: - style = wx.SOLID + style = wx.DOT if self.intermediate else wx.SOLID return wx.Pen(wx.BLACK, width, style) @@ -1718,10 +1706,7 @@ def __init__( def _setPen(self): """Set pen""" - if self.isEnabled: - style = wx.SOLID - else: - style = wx.DOT + style = wx.SOLID if self.isEnabled else wx.DOT pen = wx.Pen(wx.BLACK, 1, style) self.SetPen(pen) @@ -1986,10 +1971,7 @@ def __init__(self, tree): self.root = self.tree.getroot() # check if input is a valid GXM file if self.root is None or self.root.tag != "gxm": - if self.root is not None: - tagName = self.root.tag - else: - tagName = _("empty") + tagName = self.root.tag if self.root is not None else _("empty") raise GException(_("Details: unsupported tag name '{0}'.").format(tagName)) # list of actions, data @@ -2099,10 +2081,7 @@ def _processActions(self): aId = int(action.get("id", -1)) label = action.get("name") comment = action.find("comment") - if comment is not None: - commentString = comment.text - else: - commentString = "" + commentString = comment.text if comment is not None else "" self.actions.append( { @@ -2515,10 +2494,7 @@ def _data(self, dataList): # relations for ft in ("from", "to"): for rel in data.GetRelations(ft): - if ft == "from": - aid = rel.GetTo().GetId() - else: - aid = rel.GetFrom().GetId() + aid = rel.GetTo().GetId() if ft == "from" else rel.GetFrom().GetId() self.fd.write( '%s\n' % (" " * self.indent, ft, aid, rel.GetLabel()) @@ -2987,10 +2963,7 @@ def _write_input_outputs(self, item, intermediates): parameterized_params = item.GetParameterizedParams() for flag in parameterized_params["flags"]: - if flag["label"]: - desc = flag["label"] - else: - desc = flag["description"] + desc = flag["label"] or flag["description"] if flag["value"]: value = '\n{}default="{}"'.format( @@ -3256,12 +3229,7 @@ def _getPythonActionCmd(self, item, task, cmdIndent, variables={}): return ret def _getParamDesc(self, param): - if param["label"]: - desc = param["label"] - else: - desc = param["description"] - - return desc + return param["label"] or param["description"] def _getParamValue(self, param): if param["value"] and "output" not in param["name"]: @@ -3374,10 +3342,7 @@ def _writePython(self): for item in modelItems: parametrizedParams = item.GetParameterizedParams() for flag in parametrizedParams["flags"]: - if flag["label"]: - desc = flag["label"] - else: - desc = flag["description"] + desc = flag["label"] or flag["description"] self.fd.write( r"""# %option # % key: {flag_name} @@ -3398,10 +3363,7 @@ def _writePython(self): self.fd.write("# %end\n") for param in parametrizedParams["params"]: - if param["label"]: - desc = param["label"] - else: - desc = param["description"] + desc = param["label"] or param["description"] self.fd.write( r"""# %option # % key: {param_name} diff --git a/gui/wxpython/gmodeler/panels.py b/gui/wxpython/gmodeler/panels.py index 416a9b85592..fbdc2048620 100644 --- a/gui/wxpython/gmodeler/panels.py +++ b/gui/wxpython/gmodeler/panels.py @@ -622,10 +622,7 @@ def LoadModelFile(self, filename): item.Show(True) # relations/data for rel in item.GetRelations(): - if rel.GetFrom() == item: - dataItem = rel.GetTo() - else: - dataItem = rel.GetFrom() + dataItem = rel.GetTo() if rel.GetFrom() == item else rel.GetFrom() self._addEvent(dataItem) self.canvas.diagram.AddShape(dataItem) self.AddLine(rel) @@ -1663,13 +1660,8 @@ def GetScriptExt(self): """Get extension for script exporting. :return: script extension """ - if self.write_object == WriteActiniaFile: - ext = "json" - else: - # Python, PyWPS - ext = "py" - - return ext + # return "py" for Python, PyWPS + return "json" if self.write_object == WriteActiniaFile else "py" def SetWriteObject(self, script_type): """Set correct self.write_object depending on the script type. diff --git a/gui/wxpython/gui_core/dialogs.py b/gui/wxpython/gui_core/dialogs.py index a38836ac23e..27ce4523a76 100644 --- a/gui/wxpython/gui_core/dialogs.py +++ b/gui/wxpython/gui_core/dialogs.py @@ -466,10 +466,7 @@ def CreateNewVector( """ vExternalOut = grass.parse_command("v.external.out", flags="g") isNative = vExternalOut["format"] == "native" - if cmd[0] == "v.edit" and not isNative: - showType = True - else: - showType = False + showType = bool(cmd[0] == "v.edit" and not isNative) dlg = NewVectorDialog( parent, title=title, @@ -1340,10 +1337,7 @@ def ShowResult(self, group, returnCode, create): def GetSelectedGroup(self): """Return currently selected group (without mapset)""" g = self.groupSelect.GetValue().split("@")[0] - if self.edit_subg: - s = self.subGroupSelect.GetValue() - else: - s = None + s = self.subGroupSelect.GetValue() if self.edit_subg else None return g, s def GetGroupLayers(self, group, subgroup=None): @@ -1374,10 +1368,7 @@ def ApplyChanges(self): GMessage(parent=self, message=_("No subgroup selected.")) return 0 - if self.edit_subg: - subgroup = self.currentSubgroup - else: - subgroup = None + subgroup = self.currentSubgroup if self.edit_subg else None groups = self.GetExistGroups() if group in groups: diff --git a/gui/wxpython/gui_core/forms.py b/gui/wxpython/gui_core/forms.py index 2636b213df3..7172835f001 100644 --- a/gui/wxpython/gui_core/forms.py +++ b/gui/wxpython/gui_core/forms.py @@ -193,10 +193,7 @@ def run(self): if not pMap: pMap = self.task.get_param("input", raiseError=False) - if pMap: - map = pMap.get("value", "") - else: - map = None + map = pMap.get("value", "") if pMap else None # avoid running db.describe several times cparams = {} @@ -278,10 +275,7 @@ def run(self): elif p.get("element", "") in {"layer", "layer_all"}: # -> layer # get layer layer = p.get("value", "") - if layer != "": - layer = p.get("value", "") - else: - layer = p.get("default", "") + layer = p.get("value", "") if layer != "" else p.get("default", "") # get map name pMapL = self.task.get_param( @@ -722,10 +716,7 @@ def __init__( sizeFrame = self.GetBestSize() self.SetMinSize(sizeFrame) - if hasattr(self, "closebox"): - scale = 0.33 - else: - scale = 0.50 + scale = 0.33 if hasattr(self, "closebox") else 0.5 self.SetSize( wx.Size( round(sizeFrame[0]), @@ -813,10 +804,7 @@ def OnMapCreated(self, name, ltype, add: bool | None = None): :param ltype: layer type (prompt value) :param add: whether to display layer or not """ - if hasattr(self, "addbox") and self.addbox.IsChecked(): - add = True - else: - add = False + add = bool(hasattr(self, "addbox") and self.addbox.IsChecked()) if self._giface: self._giface.mapCreated.emit(name=name, ltype=ltype, add=add) @@ -1156,10 +1144,7 @@ def __init__(self, parent, giface, task, id=wx.ID_ANY, frame=None, *args, **kwar else: title_sizer = wx.BoxSizer(wx.HORIZONTAL) title_txt = StaticText(parent=which_panel) - if p["key_desc"]: - ltype = ",".join(p["key_desc"]) - else: - ltype = p["type"] + ltype = ",".join(p["key_desc"]) if p["key_desc"] else p["type"] # red star for required options if p.get("required", False): required_txt = StaticText(parent=which_panel, label="*") @@ -1900,10 +1885,7 @@ def __init__(self, parent, giface, task, id=wx.ID_ANY, frame=None, *args, **kwar win.Bind(wx.EVT_COMBOBOX, self.OnSetValue) elif prompt == "mapset": - if p.get("age", "old") == "old": - new = False - else: - new = True + new = p.get("age", "old") != "old" win = gselect.MapsetSelect( parent=which_panel, @@ -2008,10 +1990,7 @@ def __init__(self, parent, giface, task, id=wx.ID_ANY, frame=None, *args, **kwar # file selector elif p.get("prompt", "") != "color" and p.get("prompt", "") == "file": - if p.get("age", "new") == "new": - fmode = wx.FD_SAVE - else: - fmode = wx.FD_OPEN + fmode = wx.FD_SAVE if p.get("age", "new") == "new" else wx.FD_OPEN # check wildcard try: fExt = os.path.splitext(p.get("key_desc", ["*.*"])[0])[1] @@ -2770,11 +2749,7 @@ def OnVerbosity(self, event): event.Skip() def OnPageChange(self, event): - if not event: - sel = self.notebook.GetSelection() - else: - sel = event.GetSelection() - + sel = self.notebook.GetSelection() if not event else event.GetSelection() idx = self.notebook.GetPageIndexByName("manual") if idx > -1 and sel == idx: # calling LoadPage() is strangely time-consuming (only first call) diff --git a/gui/wxpython/gui_core/gselect.py b/gui/wxpython/gui_core/gselect.py index ff256803a97..67b8a1280e2 100644 --- a/gui/wxpython/gui_core/gselect.py +++ b/gui/wxpython/gui_core/gselect.py @@ -1394,10 +1394,7 @@ def __init__( super().__init__(parent, id=wx.ID_ANY, size=size, **kwargs) self.SetName("FormatSelect") - if ogr: - ftype = "ogr" - else: - ftype = "gdal" + ftype = "ogr" if ogr else "gdal" formats = [] for f in GetFormats()[ftype][srcType].items(): @@ -1504,10 +1501,7 @@ def __init__( self.protocolWidgets = {} self.pgWidgets = {} - if ogr: - fType = "ogr" - else: - fType = "gdal" + fType = "ogr" if ogr else "gdal" # file fileMask = "%(all)s (*)|*|" % {"all": _("All files")} @@ -2290,12 +2284,7 @@ def hasRastSameProjAsLocation(dsn, table=None): return projectionMatch def getProjMatchCaption(projectionMatch): - if projectionMatch == "0": - projectionMatchCaption = _("No") - else: - projectionMatchCaption = _("Yes") - - return projectionMatchCaption + return _("No") if projectionMatch == "0" else _("Yes") dsn = self.GetDsn() if not dsn: @@ -2440,15 +2429,9 @@ def OnHelp(self, event): """Show related manual page""" cmd = "" if self.dest: - if self.ogr: - cmd = "v.external.out" - else: - cmd = "r.external.out" + cmd = "v.external.out" if self.ogr else "r.external.out" elif self.link: - if self.ogr: - cmd = "v.external" - else: - cmd = "r.external" + cmd = "v.external" if self.ogr else "r.external" elif self.ogr: cmd = "v.in.ogr" else: diff --git a/gui/wxpython/gui_core/mapdisp.py b/gui/wxpython/gui_core/mapdisp.py index a2810c9892b..ea770defe8e 100644 --- a/gui/wxpython/gui_core/mapdisp.py +++ b/gui/wxpython/gui_core/mapdisp.py @@ -380,10 +380,7 @@ def StatusbarEnableLongHelp(self, enable=True): toolbar.EnableLongHelp(enable) def ShowAllToolbars(self, show=True): - if not show: # hide - action = self.RemoveToolbar - else: - action = self.AddToolbar + action = self.RemoveToolbar if not show else self.AddToolbar for toolbar in self.GetToolbarNames(): action(toolbar) diff --git a/gui/wxpython/gui_core/menu.py b/gui/wxpython/gui_core/menu.py index b284461af0a..34d6eeffd31 100644 --- a/gui/wxpython/gui_core/menu.py +++ b/gui/wxpython/gui_core/menu.py @@ -91,10 +91,7 @@ def _createMenuItem( menu.AppendSeparator() return - if command: - helpString = command + " -- " + description - else: - helpString = description + helpString = command + " -- " + description if command else description if shortcut: label += "\t" + shortcut diff --git a/gui/wxpython/gui_core/preferences.py b/gui/wxpython/gui_core/preferences.py index 724e4a5aec0..85e5313da0e 100644 --- a/gui/wxpython/gui_core/preferences.py +++ b/gui/wxpython/gui_core/preferences.py @@ -2268,10 +2268,7 @@ def OnEnableWheelZoom(self, event): """Enable/disable wheel zoom mode control""" choiceId = self.winId["display:mouseWheelZoom:selection"] choice = self.FindWindowById(choiceId) - if choice.GetSelection() == 2: - enable = False - else: - enable = True + enable = choice.GetSelection() != 2 scrollId = self.winId["display:scrollDirection:selection"] self.FindWindowById(scrollId).Enable(enable) diff --git a/gui/wxpython/gui_core/prompt.py b/gui/wxpython/gui_core/prompt.py index 6734de169a9..3857f04fb32 100644 --- a/gui/wxpython/gui_core/prompt.py +++ b/gui/wxpython/gui_core/prompt.py @@ -428,10 +428,7 @@ def GetWordLeft(self, withDelimiter=False, ignoredDelimiter=None): ignoredDelimiter = "" for char in set(" .,-=") - set(ignoredDelimiter): - if not withDelimiter: - delimiter = "" - else: - delimiter = char + delimiter = "" if not withDelimiter else char parts.append(delimiter + textLeft.rpartition(char)[2]) return min(parts, key=lambda x: len(x)) diff --git a/gui/wxpython/gui_core/treeview.py b/gui/wxpython/gui_core/treeview.py index a7660308843..2fde45feec8 100644 --- a/gui/wxpython/gui_core/treeview.py +++ b/gui/wxpython/gui_core/treeview.py @@ -209,10 +209,7 @@ class CTreeView(AbstractTreeViewMixin, CustomTreeCtrl): """Tree view class inheriting from wx.TreeCtrl""" def __init__(self, model, parent, **kw): - if hasAgw: - style = "agwStyle" - else: - style = "style" + style = "agwStyle" if hasAgw else "style" if style not in kw: kw[style] = ( diff --git a/gui/wxpython/iclass/dialogs.py b/gui/wxpython/iclass/dialogs.py index 9aaa7e31604..615e614689f 100644 --- a/gui/wxpython/iclass/dialogs.py +++ b/gui/wxpython/iclass/dialogs.py @@ -588,11 +588,7 @@ def ContrastColor(color): # gacek, # https://stackoverflow.com/questions/1855884/determine-font-color-based-on-background-color a = 1 - (0.299 * color[0] + 0.587 * color[1] + 0.114 * color[2]) / 255 - - if a < 0.5: - d = 0 - else: - d = 255 + d = 0 if a < 0.5 else 255 # maybe return just bool if text should be dark or bright return (d, d, d) diff --git a/gui/wxpython/iclass/digit.py b/gui/wxpython/iclass/digit.py index 85334993db1..7442c24ab5d 100644 --- a/gui/wxpython/iclass/digit.py +++ b/gui/wxpython/iclass/digit.py @@ -156,15 +156,9 @@ def CopyMap(self, name, tmp=False, update=False): poMapInfoNew = pointer(Map_info()) if not tmp: - if update: - open_fn = Vect_open_update - else: - open_fn = Vect_open_new - else: # noqa: PLR5501 - if update: - open_fn = Vect_open_tmp_update - else: - open_fn = Vect_open_tmp_new + open_fn = Vect_open_update if update else Vect_open_new + else: + open_fn = Vect_open_tmp_update if update else Vect_open_tmp_new if update: if open_fn(poMapInfoNew, name, "") == -1: diff --git a/gui/wxpython/image2target/ii2t_gis_set.py b/gui/wxpython/image2target/ii2t_gis_set.py index 6ed97bc46c1..0329516e04a 100644 --- a/gui/wxpython/image2target/ii2t_gis_set.py +++ b/gui/wxpython/image2target/ii2t_gis_set.py @@ -1014,10 +1014,7 @@ def OnSetDatabase(self, event): def OnBrowse(self, event): """'Browse' button clicked""" - if not event: - defaultPath = os.getenv("HOME") - else: - defaultPath = "" + defaultPath = os.getenv("HOME") if not event else "" dlg = wx.DirDialog( parent=self, diff --git a/gui/wxpython/image2target/ii2t_manager.py b/gui/wxpython/image2target/ii2t_manager.py index 3adcf5ef9bd..939c2fb0fe8 100644 --- a/gui/wxpython/image2target/ii2t_manager.py +++ b/gui/wxpython/image2target/ii2t_manager.py @@ -488,11 +488,7 @@ def __init__(self, wizard, parent): def OnMaptype(self, event): """Change map type""" global maptype - - if event.GetInt() == 0: - maptype = "raster" - else: - maptype = "vector" + maptype = "raster" if event.GetInt() == 0 else "vector" def OnLocation(self, event): """Sets source location for map(s) to georectify""" @@ -1416,10 +1412,7 @@ def SetGCPSatus(self, item, itemIndex): else: item.SetPropertyVal("hide", False) if self.highest_only: - if itemIndex == self.highest_key: - wxPen = "highest" - else: - wxPen = "default" + wxPen = "highest" if itemIndex == self.highest_key else "default" elif self.mapcoordlist[key][7] > self.rmsthresh: wxPen = "highest" else: @@ -1702,10 +1695,7 @@ def OnFocus(self, event): pass def _onMouseLeftUpPointer(self, mapWindow, x, y): - if mapWindow == self.SrcMapWindow: - coordtype = "source" - else: - coordtype = "target" + coordtype = "source" if mapWindow == self.SrcMapWindow else "target" coord = (x, y) self.SetGCPData(coordtype, coord, self, confirm=True) @@ -1761,11 +1751,7 @@ def OnGeorect(self, event): if maptype == "raster": self.grwiz.SwitchEnv("source") - - if self.clip_to_region: - flags = "ac" - else: - flags = "a" + flags = "ac" if self.clip_to_region else "a" with wx.BusyInfo(_("Rectifying images, please wait..."), parent=self): wx.GetApp().Yield() diff --git a/gui/wxpython/iscatt/controllers.py b/gui/wxpython/iscatt/controllers.py index fef4e95505e..06ca5d0b243 100644 --- a/gui/wxpython/iscatt/controllers.py +++ b/gui/wxpython/iscatt/controllers.py @@ -149,10 +149,7 @@ def SetBands(self, bands): callable=self.core.CleanUp, ondone=lambda event: self.CleanUpDone() ) - if self.show_add_scatt_plot: - show_add = True - else: - show_add = False + show_add = bool(self.show_add_scatt_plot) self.all_bands_to_bands = dict(zip(bands, [-1] * len(bands))) self.all_bands = bands @@ -697,10 +694,7 @@ def SetData(self): def AddCategory(self, cat_id=None, name=None, color=None, nstd=None): if cat_id is None: - if self.cats_ids: - cat_id = max(self.cats_ids) + 1 - else: - cat_id = 1 + cat_id = max(self.cats_ids) + 1 if self.cats_ids else 1 if self.scatt_mgr.data_set: self.scatt_mgr.thread.Run(callable=self.core.AddCategory, cat_id=cat_id) diff --git a/gui/wxpython/iscatt/core_c.py b/gui/wxpython/iscatt/core_c.py index 8be04964b90..a6e6ac5c8a0 100644 --- a/gui/wxpython/iscatt/core_c.py +++ b/gui/wxpython/iscatt/core_c.py @@ -214,11 +214,7 @@ def _regionToCellHead(region): } for k, v in region.items(): - if k in {"rows", "cols", "cells", "zone"}: # zone added in r65224 - v = int(v) - else: - v = float(v) - + v = int(v) if k in {"rows", "cols", "cells", "zone"} else float(v) if k in convert_dict: k = convert_dict[k] diff --git a/gui/wxpython/iscatt/frame.py b/gui/wxpython/iscatt/frame.py index 122aa053b9b..5350ecbd8a0 100644 --- a/gui/wxpython/iscatt/frame.py +++ b/gui/wxpython/iscatt/frame.py @@ -568,11 +568,7 @@ def OnCategoryRightUp(self, event): item = menu.Append(wx.ID_ANY, _("Change opacity level")) self.Bind(wx.EVT_MENU, self.OnPopupOpacityLevel, item) - if showed: - text = _("Hide") - else: - text = _("Show") - + text = _("Hide") if showed else _("Show") item = menu.Append(wx.ID_ANY, text) self.Bind( wx.EVT_MENU, diff --git a/gui/wxpython/iscatt/iscatt_core.py b/gui/wxpython/iscatt/iscatt_core.py index 09214d08e42..52cecbfb381 100644 --- a/gui/wxpython/iscatt/iscatt_core.py +++ b/gui/wxpython/iscatt/iscatt_core.py @@ -805,11 +805,7 @@ def _parseRegion(region_str): for param in region_str: k, v = param.split("=") - if k in {"rows", "cols", "cells"}: - v = int(v) - else: - v = float(v) - region[k] = v + region[k] = int(v) if k in {"rows", "cols", "cells"} else float(v) return region diff --git a/gui/wxpython/lmgr/frame.py b/gui/wxpython/lmgr/frame.py index 963a36e3a58..9879ce1d937 100644 --- a/gui/wxpython/lmgr/frame.py +++ b/gui/wxpython/lmgr/frame.py @@ -747,10 +747,7 @@ def OnLocationWizard(self, event): self._giface.grassdbChanged.emit( grassdb=grassdb, location=location, action="new", element="location" ) - if grassdb == gisenv["GISDBASE"]: - switch_grassdb = None - else: - switch_grassdb = grassdb + switch_grassdb = grassdb if grassdb != gisenv["GISDBASE"] else None if can_switch_mapset_interactive(self, grassdb, location, mapset): switch_mapset_interactively( self, @@ -1116,10 +1113,7 @@ def GetMenuCmd(self, event): :return: command as a list""" layer = None - if event: - cmd = self.menucmd[event.GetId()] - else: - cmd = "" + cmd = self.menucmd[event.GetId()] if event else "" try: cmdlist = cmd.split(" ") diff --git a/gui/wxpython/lmgr/layertree.py b/gui/wxpython/lmgr/layertree.py index 855896e35ab..350320d97a7 100644 --- a/gui/wxpython/lmgr/layertree.py +++ b/gui/wxpython/lmgr/layertree.py @@ -688,10 +688,7 @@ def OnLayerContextMenu(self, event): ) digitToolbar = self.mapdisplay.GetToolbar("vdigit") - if digitToolbar: - vdigitLayer = digitToolbar.GetLayer() - else: - vdigitLayer = None + vdigitLayer = digitToolbar.GetLayer() if digitToolbar else None layer = self.GetLayerInfo(self.layer_selected, key="maplayer") if vdigitLayer is not layer: item = wx.MenuItem( @@ -1569,10 +1566,7 @@ def AddLayer( name = None - if ctrl: - ctrlId = ctrl.GetId() - else: - ctrlId = None + ctrlId = ctrl.GetId() if ctrl else None # add a data object to hold the layer's command (does not # apply to generic command layers) @@ -1606,11 +1600,7 @@ def AddLayer( prevMapLayer = self.GetLayerInfo(prevItem, key="maplayer") prevItem = self.GetNextItem(prevItem) - - if prevMapLayer: - pos = self.Map.GetLayerIndex(prevMapLayer) - else: - pos = -1 + pos = self.Map.GetLayerIndex(prevMapLayer) if prevMapLayer else -1 maplayer = self.Map.AddLayer( pos=pos, @@ -2063,12 +2053,8 @@ def RecreateItem(self, dragItem, dropTarget, parent=None): # decide where to put recreated item if dropTarget is not None and dropTarget != self.GetRootItem(): - if parent: - # new item is a group - afteritem = parent - else: - # new item is a single layer - afteritem = dropTarget + # new item is a group (parent is truthy) or else new item is a single layer + afteritem = parent or dropTarget # dragItem dropped on group if self.GetLayerInfo(afteritem, key="type") == "group": diff --git a/gui/wxpython/lmgr/menudata.py b/gui/wxpython/lmgr/menudata.py index 59eb72ecb67..88f769af403 100644 --- a/gui/wxpython/lmgr/menudata.py +++ b/gui/wxpython/lmgr/menudata.py @@ -25,10 +25,7 @@ class LayerManagerMenuData(MenuTreeModelBuilder): def __init__(self, filename=None, message_handler=GError): - if filename: - expandAddons = False - else: - expandAddons = True + expandAddons = not filename fallback = os.path.join(WXGUIDIR, "xml", "menudata.xml") if not filename: @@ -57,10 +54,7 @@ def __init__(self, filename=None, message_handler=GError): class LayerManagerModuleTree(MenuTreeModelBuilder): def __init__(self, filename=None, message_handler=GError): - if filename: - expandAddons = False - else: - expandAddons = True + expandAddons = not filename fallback = os.path.join(WXGUIDIR, "xml", "module_tree_menudata.xml") if not filename: diff --git a/gui/wxpython/location_wizard/wizard.py b/gui/wxpython/location_wizard/wizard.py index 1f8de66dda6..d553b4e11d9 100644 --- a/gui/wxpython/location_wizard/wizard.py +++ b/gui/wxpython/location_wizard/wizard.py @@ -2760,10 +2760,7 @@ def CreateProj4String(self): # set ellipsoid parameters for item in ellipseparams: - if item[:4] == "f=1/": - item = " +rf=" + item[4:] - else: - item = " +" + item + item = " +rf=" + item[4:] if item[:4] == "f=1/" else " +" + item proj4string = "%s %s" % (proj4string, item) # set datum transform parameters if relevant diff --git a/gui/wxpython/main_window/frame.py b/gui/wxpython/main_window/frame.py index cef4aee7121..3574e7c8951 100644 --- a/gui/wxpython/main_window/frame.py +++ b/gui/wxpython/main_window/frame.py @@ -861,10 +861,7 @@ def OnLocationWizard(self, event): self._giface.grassdbChanged.emit( grassdb=grassdb, location=location, action="new", element="location" ) - if grassdb == gisenv["GISDBASE"]: - switch_grassdb = None - else: - switch_grassdb = grassdb + switch_grassdb = grassdb if grassdb != gisenv["GISDBASE"] else None if can_switch_mapset_interactive(self, grassdb, location, mapset): switch_mapset_interactively( self, @@ -1268,10 +1265,7 @@ def GetMenuCmd(self, event): :return: command as a list""" layer = None - if event: - cmd = self.menucmd[event.GetId()] - else: - cmd = "" + cmd = self.menucmd[event.GetId()] if event else "" try: cmdlist = cmd.split(" ") diff --git a/gui/wxpython/mapdisp/frame.py b/gui/wxpython/mapdisp/frame.py index 0a1660ff06a..3133341a334 100644 --- a/gui/wxpython/mapdisp/frame.py +++ b/gui/wxpython/mapdisp/frame.py @@ -783,10 +783,7 @@ def DOutFile(self, command, callback=None): # --overwrite continue if p == "format": # must be there - if self.IsPaneShown("3d"): - extType = "ppm" - else: - extType = val + extType = "ppm" if self.IsPaneShown("3d") else val if p == "output": # must be there name = val elif p == "size": @@ -798,10 +795,8 @@ def DOutFile(self, command, callback=None): elif ext[1:] != extType: extType = ext[1:] - if self.IsPaneShown("3d"): - bitmapType = "ppm" - else: - bitmapType = wx.BITMAP_TYPE_PNG # default type + # default type is PNG + bitmapType = "ppm" if self.IsPaneShown("3d") else wx.BITMAP_TYPE_PNG for each in ltype: if each["ext"] == extType: bitmapType = each["type"] diff --git a/gui/wxpython/mapdisp/toolbars.py b/gui/wxpython/mapdisp/toolbars.py index 4eb49846d4f..18459b26e17 100644 --- a/gui/wxpython/mapdisp/toolbars.py +++ b/gui/wxpython/mapdisp/toolbars.py @@ -285,10 +285,7 @@ def RemoveTool(self, tool): def ChangeToolsDesc(self, mode2d): """Change description of zoom tools for 2D/3D view""" - if mode2d: - icons = BaseIcons - else: - icons = NvizIcons + icons = BaseIcons if mode2d else NvizIcons for i, data in enumerate(self.controller.data): for tool in ("zoomIn", "zoomOut"): if data[0] == tool: diff --git a/gui/wxpython/mapwin/buffered.py b/gui/wxpython/mapwin/buffered.py index c4b07a94fd2..16b6b329ef6 100644 --- a/gui/wxpython/mapwin/buffered.py +++ b/gui/wxpython/mapwin/buffered.py @@ -344,10 +344,7 @@ def Draw( # TODO: find better solution if not pen: - if pdctype == "polyline": - pen = self.polypen - else: - pen = self.pen + pen = self.polypen if pdctype == "polyline" else self.pen if img and pdctype == "image": # self.imagedict[img]['coords'] = coords @@ -501,10 +498,7 @@ def Draw( elif pdctype == "text": # draw text on top of map if not img["active"]: return # only draw active text - if "rotation" in img: - rotation = float(img["rotation"]) - else: - rotation = 0.0 + rotation = float(img["rotation"]) if "rotation" in img else 0.0 w, h = self.GetFullTextExtent(img["text"])[0:2] pdc.SetFont(img["font"]) pdc.SetTextForeground(img["color"]) @@ -536,10 +530,7 @@ def TextBounds(self, textinfo, relcoords=False): :return: bbox of rotated text bbox (wx.Rect) :return: relCoords are text coord inside bbox """ - if "rotation" in textinfo: - rotation = float(textinfo["rotation"]) - else: - rotation = 0.0 + rotation = float(textinfo["rotation"]) if "rotation" in textinfo else 0.0 coords = textinfo["coords"] bbox = Rect(coords[0], coords[1], 0, 0) @@ -1469,10 +1460,7 @@ def OnMouseWheel(self, event): wheel = event.GetWheelRotation() Debug.msg(5, "BufferedWindow.MouseAction(): wheel=%d" % wheel) - if wheel > 0: - zoomtype = 1 - else: - zoomtype = -1 + zoomtype = 1 if wheel > 0 else -1 if UserSettings.Get(group="display", key="scrollDirection", subkey="selection"): zoomtype *= -1 # zoom 1/2 of the screen (TODO: settings) @@ -1504,10 +1492,7 @@ def OnDragging(self, event): previous = self.mouse["begin"] move = (current[0] - previous[0], current[1] - previous[1]) - if self.digit: - digitToolbar = self.toolbar - else: - digitToolbar = None + digitToolbar = self.toolbar if self.digit else None # dragging or drawing box with left button if self.mouse["use"] == "pan" or event.MiddleIsDown(): diff --git a/gui/wxpython/mapwin/decorations.py b/gui/wxpython/mapwin/decorations.py index 24db63d8492..9c643d17752 100644 --- a/gui/wxpython/mapwin/decorations.py +++ b/gui/wxpython/mapwin/decorations.py @@ -323,14 +323,8 @@ def ResizeLegend(self, begin, end, screenSize): """Resize legend according to given bbox coordinates.""" w = abs(begin[0] - end[0]) h = abs(begin[1] - end[1]) - if begin[0] < end[0]: - x = begin[0] - else: - x = end[0] - if begin[1] < end[1]: - y = begin[1] - else: - y = end[1] + x = min(end[0], begin[0]) + y = min(end[1], begin[1]) at = [ (screenSize[1] - (y + h)) / float(screenSize[1]) * 100, diff --git a/gui/wxpython/modules/colorrules.py b/gui/wxpython/modules/colorrules.py index 6f48006db44..dcb34619b57 100644 --- a/gui/wxpython/modules/colorrules.py +++ b/gui/wxpython/modules/colorrules.py @@ -977,10 +977,7 @@ def OnSelectionInput(self, event): self.cr_label.SetLabel(_("Enter raster category values or percents")) return - if info["datatype"] == "CELL": - mapRange = _("range") - else: - mapRange = _("fp range") + mapRange = _("range") if info["datatype"] == "CELL" else _("fp range") self.cr_label.SetLabel( _("Enter raster category values or percents (%(range)s = %(min)d-%(max)d)") % { @@ -1409,10 +1406,7 @@ def AddTemporaryColumn(self, type): idx += 1 self.properties["tmpColumn"] = name + "_" + str(idx) - if self.version7: - modul = "v.db.addcolumn" - else: - modul = "v.db.addcol" + modul = "v.db.addcolumn" if self.version7 else "v.db.addcol" RunCommand( modul, parent=self, @@ -1427,10 +1421,7 @@ def DeleteTemporaryColumn(self): return if self.inmap: - if self.version7: - modul = "v.db.dropcolumn" - else: - modul = "v.db.dropcol" + modul = "v.db.dropcolumn" if self.version7 else "v.db.dropcol" RunCommand( modul, map=self.inmap, @@ -1452,10 +1443,7 @@ def OnLayerSelection(self, event): self.sourceColumn.SetValue("cat") self.properties["sourceColumn"] = self.sourceColumn.GetValue() - if self.attributeType == "color": - type = ["character"] - else: - type = ["integer"] + type = ["character"] if self.attributeType == "color" else ["integer"] self.fromColumn.InsertColumns( vector=self.inmap, layer=vlayer, @@ -1502,10 +1490,7 @@ def OnAddColumn(self, event): self.columnsProp[self.attributeType]["name"] not in self.fromColumn.GetColumns() ): - if self.version7: - modul = "v.db.addcolumn" - else: - modul = "v.db.addcol" + modul = "v.db.addcolumn" if self.version7 else "v.db.addcol" RunCommand( modul, map=self.inmap, diff --git a/gui/wxpython/modules/extensions.py b/gui/wxpython/modules/extensions.py index f7822e0cb0e..7837a92589d 100644 --- a/gui/wxpython/modules/extensions.py +++ b/gui/wxpython/modules/extensions.py @@ -356,11 +356,7 @@ def _expandPrefix(self, c): def Load(self, url, full=True): """Load list of extensions""" self._emptyTree() - - if full: - flags = "g" - else: - flags = "l" + flags = "g" if full else "l" retcode, ret, msg = RunCommand( "g.extension", read=True, getErrorMsg=True, url=url, flags=flags, quiet=True ) diff --git a/gui/wxpython/modules/import_export.py b/gui/wxpython/modules/import_export.py index 6810484bfdd..db4e3b517a2 100644 --- a/gui/wxpython/modules/import_export.py +++ b/gui/wxpython/modules/import_export.py @@ -328,20 +328,14 @@ def AddLayers(self, returncode, cmd=None, userData=None): self.commandId += 1 layer, output = self.list.GetLayers()[self.commandId][:2] - if "@" not in output: - name = output + "@" + grass.gisenv()["MAPSET"] - else: - name = output + name = output + "@" + grass.gisenv()["MAPSET"] if "@" not in output else output # add imported layers into layer tree # an alternative would be emit signal (mapCreated) and (optionally) # connect to this signal llist = self._giface.GetLayerList() if self.importType == "gdal": - if userData: - nBands = int(userData.get("nbands", 1)) - else: - nBands = 1 + nBands = int(userData.get("nbands", 1)) if userData else 1 if UserSettings.Get(group="rasterLayer", key="opaque", subkey="enabled"): nFlag = True diff --git a/gui/wxpython/modules/mcalc_builder.py b/gui/wxpython/modules/mcalc_builder.py index 52630e55820..4294a9730de 100644 --- a/gui/wxpython/modules/mcalc_builder.py +++ b/gui/wxpython/modules/mcalc_builder.py @@ -681,10 +681,7 @@ def OnMCalcRun(self, event): self.log.RunCmd(cmd, onDone=self.OnDone) self.parent.Raise() else: - if self.overwrite.IsChecked(): - overwrite = True - else: - overwrite = False + overwrite = bool(self.overwrite.IsChecked()) params = {"expression": "%s=%s" % (name, expr), "overwrite": overwrite} if seed_flag: params["flags"] = "s" diff --git a/gui/wxpython/nviz/mapwindow.py b/gui/wxpython/nviz/mapwindow.py index 1eea5b278a9..d3f93f94938 100644 --- a/gui/wxpython/nviz/mapwindow.py +++ b/gui/wxpython/nviz/mapwindow.py @@ -382,10 +382,7 @@ def OnEraseBackground(self, event): def OnSize(self, event): size = self.GetClientSize() - if CheckWxVersion(version=[2, 9]): - context = self.context - else: - context = self.GetContext() + context = self.context if CheckWxVersion(version=[2, 9]) else self.GetContext() if self.size != size and context: Debug.msg( 3, "GLCanvas.OnSize(): w = %d, h = %d" % (size.width, size.height) diff --git a/gui/wxpython/nviz/tools.py b/gui/wxpython/nviz/tools.py index 7ced7d157e1..150fe519635 100644 --- a/gui/wxpython/nviz/tools.py +++ b/gui/wxpython/nviz/tools.py @@ -3210,10 +3210,7 @@ def _createControl( "style": style, "size": sizeW, } - if floatSlider: - slider = FloatSlider(**kwargs) - else: - slider = Slider(**kwargs) + slider = FloatSlider(**kwargs) if floatSlider else Slider(**kwargs) slider.SetName("slider") if bind[0]: @@ -3422,22 +3419,17 @@ def OnViewChange(self, event): self.AdjustSliderRange(slider=slider, value=value) - if winName == "height": - view = self.mapWindow.iview # internal - else: - view = self.mapWindow.view + # iview is internal + view = self.mapWindow.iview if winName == "height" else self.mapWindow.view if winName == "z-exag" and value >= 0: self.PostViewEvent(zExag=True) else: self.PostViewEvent(zExag=False) - if winName in {"persp", "twist"}: - convert = int - else: - convert = float - - view[winName]["value"] = convert(value) + view[winName]["value"] = ( + int(value) if winName in {"persp", "twist"} else float(value) + ) for win in self.win["view"][winName].values(): self.FindWindowById(win).SetValue(value) @@ -3650,10 +3642,8 @@ def EnablePage(self, name, enabled=True): def SetMapObjUseMap(self, nvizType, attrb, map=None): """Update dialog widgets when attribute type changed""" - if attrb in {"topo", "color", "shine"}: - incSel = -1 # decrement selection (no 'unset') - else: - incSel = 0 + # decrement selection (no 'unset') + incSel = -1 if attrb in {"topo", "color", "shine"} else 0 if nvizType == "volume" and attrb == "topo": return if map is True: # map @@ -3881,11 +3871,7 @@ def _get3dRange(self, name): def _getPercent(self, value, toPercent=True): """Convert values 0 - 255 to percents and vice versa""" value = int(value) - if toPercent: - value = int(value / 255.0 * 100) - else: - value = int(value / 100.0 * 255) - return value + return int(value / 255.0 * 100) if toPercent else int(value / 100.0 * 255) def OnSurfaceWireColor(self, event): """Set wire color""" @@ -4199,10 +4185,7 @@ def OnVectorHeightText(self, event): def OnVectorSurface(self, event): """Reference surface for vector map (lines/points)""" id = event.GetId() - if id == self.win["vector"]["lines"]["surface"]: - vtype = "lines" - else: - vtype = "points" + vtype = "lines" if id == self.win["vector"]["lines"]["surface"] else "points" checkList = self.FindWindowById(self.win["vector"][vtype]["surface"]) checked = [] surfaces = [] @@ -4278,10 +4261,7 @@ def OnCheckThematic(self, event): check = self.win["vector"][vtype]["thematic"]["check" + attrType] button = self.win["vector"][vtype]["thematic"]["button" + attrType] - if self.FindWindowById(check).GetValue(): - checked = True - else: - checked = False + checked = bool(self.FindWindowById(check).GetValue()) self.FindWindowById(button).Enable(checked) data = self.GetLayerData("vector") diff --git a/gui/wxpython/nviz/workspace.py b/gui/wxpython/nviz/workspace.py index 1e38aee239a..ac9e0582b2d 100644 --- a/gui/wxpython/nviz/workspace.py +++ b/gui/wxpython/nviz/workspace.py @@ -136,10 +136,7 @@ def SetVolumeDefaultProp(self): sel = UserSettings.Get( group="nviz", key="volume", subkey=["draw", "mode"] ) - if sel == 0: - desc = "isosurface" - else: - desc = "slice" + desc = "isosurface" if sel == 0 else "slice" data["draw"]["mode"] = { "value": sel, "desc": desc, diff --git a/gui/wxpython/nviz/wxnviz.py b/gui/wxpython/nviz/wxnviz.py index 5a223747277..35995d30e6b 100644 --- a/gui/wxpython/nviz/wxnviz.py +++ b/gui/wxpython/nviz/wxnviz.py @@ -885,11 +885,7 @@ def SetSurfaceAttr(self, id, attr, map, value): if map: ret = Nviz_set_attr(id, MAP_OBJ_SURF, attr, MAP_ATT, value, -1.0, self.data) else: - if attr == ATT_COLOR: - val = Nviz_color_from_str(value) - else: - val = float(value) - + val = Nviz_color_from_str(value) if attr == ATT_COLOR else float(value) ret = Nviz_set_attr(id, MAP_OBJ_SURF, attr, CONST_ATT, None, val, self.data) Debug.msg( @@ -1682,11 +1678,7 @@ def SetIsosurfaceAttr(self, id, isosurf_id, attr, map, value): if map: ret = GVL_isosurf_set_att_map(id, isosurf_id, attr, value) else: - if attr == ATT_COLOR: - val = Nviz_color_from_str(value) - else: - val = float(value) - + val = Nviz_color_from_str(value) if attr == ATT_COLOR else float(value) ret = GVL_isosurf_set_att_const(id, isosurf_id, attr, val) Debug.msg( @@ -2352,10 +2344,7 @@ def Resize(self): def Load(self): """Load image to texture""" - if self.image.HasAlpha(): - bytesPerPixel = 4 - else: - bytesPerPixel = 3 + bytesPerPixel = 4 if self.image.HasAlpha() else 3 bytes = bytesPerPixel * self.width * self.height rev_val = self.height - 1 im = (c_ubyte * bytes)() diff --git a/gui/wxpython/photo2image/ip2i_manager.py b/gui/wxpython/photo2image/ip2i_manager.py index d0726a3bae2..0e6168a8edd 100644 --- a/gui/wxpython/photo2image/ip2i_manager.py +++ b/gui/wxpython/photo2image/ip2i_manager.py @@ -797,10 +797,7 @@ def SetGCPSatus(self, item, itemIndex): else: item.SetPropertyVal("hide", False) if self.highest_only: - if itemIndex == self.highest_key: - wxPen = "highest" - else: - wxPen = "default" + wxPen = "highest" if itemIndex == self.highest_key else "default" else: # noqa: PLR5501 if self.mapcoordlist[key][5] > self.rmsthresh: wxPen = "highest" @@ -1042,10 +1039,7 @@ def OnFocus(self, event): pass def _onMouseLeftUpPointer(self, mapWindow, x, y): - if mapWindow == self.SrcMapWindow: - coordtype = "source" - else: - coordtype = "target" + coordtype = "source" if mapWindow == self.SrcMapWindow else "target" coord = (x, y) self.SetGCPData(coordtype, coord, self, confirm=True) @@ -1102,10 +1096,7 @@ def OnGeorect(self, event): if maptype == "raster": self.grwiz.SwitchEnv("source") - if self.clip_to_region: - flags = "ac" - else: - flags = "a" + flags = "ac" if self.clip_to_region else "a" with wx.BusyInfo(_("Rectifying images, please wait..."), parent=self): wx.GetApp().Yield() diff --git a/gui/wxpython/psmap/dialogs.py b/gui/wxpython/psmap/dialogs.py index f086d65dd36..428ae248c87 100644 --- a/gui/wxpython/psmap/dialogs.py +++ b/gui/wxpython/psmap/dialogs.py @@ -1256,10 +1256,7 @@ def OnMap(self, event): if self.scaleChoice.GetSelection() == 0: self.selectedMap = self.selected - if self.rasterTypeRadio.GetValue(): - mapType = "raster" - else: - mapType = "vector" + mapType = "raster" if self.rasterTypeRadio.GetValue() else "vector" self.scale[0], self.center[0], foo = AutoAdjust( self, @@ -1308,10 +1305,7 @@ def OnScaleChoice(self, event): self.vectorTypeRadio.Show() self.drawMap.Show() self.staticBox.SetLabel(" %s " % _("Map selection")) - if self.rasterTypeRadio.GetValue(): - stype = "raster" - else: - stype = "vector" + stype = "raster" if self.rasterTypeRadio.GetValue() else "vector" self.select.SetElementList(type=stype) self.mapText.SetLabel(self.mapOrRegionText[0]) @@ -1368,10 +1362,7 @@ def OnScaleChoice(self, event): def OnElementType(self, event): """Changes data in map selection tree ctrl popup""" - if self.rasterTypeRadio.GetValue(): - mapType = "raster" - else: - mapType = "vector" + mapType = "raster" if self.rasterTypeRadio.GetValue() else "vector" self.select.SetElementList(type=mapType) if self.mapType != mapType and event is not None: self.mapType = mapType @@ -1488,10 +1479,7 @@ def update(self): ) if self.mapType == "vector": raster = self.instruction.FindInstructionByType("raster") - if raster: - rasterId = raster.id - else: - rasterId = None + rasterId = raster.id if raster else None if rasterId: self.env["GRASS_REGION"] = gs.region_env( @@ -1562,10 +1550,7 @@ def update(self): region = gs.region(env=None) raster = self.instruction.FindInstructionByType("raster") - if raster: - rasterId = raster.id - else: - rasterId = None + rasterId = raster.id if raster else None if rasterId: # because of resolution self.env["GRASS_REGION"] = gs.region_env( @@ -3748,10 +3733,7 @@ def _vectorLegend(self, notebook): def sizePositionFont(self, legendType, parent, mainSizer): """Insert widgets for size, position and font control""" - if legendType == "raster": - legendDict = self.rLegendDict - else: - legendDict = self.vLegendDict + legendDict = self.rLegendDict if legendType == "raster" else self.vLegendDict panel = parent border = mainSizer @@ -4125,10 +4107,7 @@ def OnUp(self, event): self.vectorListCtrl.SetItemData(pos, idx1) self.vectorListCtrl.SetItemData(pos - 1, idx2) self.vectorListCtrl.SortItems(cmp) - if pos > 0: - selected = pos - 1 - else: - selected = 0 + selected = pos - 1 if pos > 0 else 0 self.vectorListCtrl.Select(selected) @@ -4463,11 +4442,7 @@ def updateDialog(self): else: self.rasterId = None - if raster: - currRaster = raster["raster"] - else: - currRaster = None - + currRaster = raster["raster"] if raster else None rasterType = getRasterType(map=currRaster) self.rasterCurrent.SetLabel( _("%(rast)s: type %(type)s") % {"rast": currRaster, "type": str(rasterType)} @@ -4995,10 +4970,7 @@ def _scalebarPanel(self): globalvar.IMGDIR, "scalebar-simple.png" ) for item, path in zip(["fancy", "simple"], imagePath): - if not os.path.exists(path): - bitmap = EmptyBitmap(0, 0) - else: - bitmap = wx.Bitmap(path) + bitmap = EmptyBitmap(0, 0) if not os.path.exists(path) else wx.Bitmap(path) self.sbCombo.Append(item="", bitmap=bitmap, clientData=item[0]) # self.sbCombo.Append( # item="simple", @@ -5882,11 +5854,7 @@ def _imagePanel(self, notebook): panel.image["scale"].SetFormat("%f") panel.image["scale"].SetDigits(1) - if self.imageDict["scale"]: - value = float(self.imageDict["scale"]) - else: - value = 0 - + value = float(self.imageDict["scale"]) if self.imageDict["scale"] else 0 panel.image["scale"].SetValue(value) gridSizer.Add(scaleLabel, pos=(0, 0), flag=wx.ALIGN_CENTER_VERTICAL) @@ -6579,10 +6547,7 @@ def __init__(self, parent, id, settings, env, type="rectangle", coordinates=None :param coordinates: begin and end point coordinate (wx.Point, wx.Point) """ - if type == "rectangle": - title = _("Rectangle settings") - else: - title = _("Line settings") + title = _("Rectangle settings") if type == "rectangle" else _("Line settings") PsmapDialog.__init__( self, parent=parent, id=id, title=title, settings=settings, env=env ) diff --git a/gui/wxpython/psmap/frame.py b/gui/wxpython/psmap/frame.py index e86b277252c..8926b8d1e75 100644 --- a/gui/wxpython/psmap/frame.py +++ b/gui/wxpython/psmap/frame.py @@ -369,10 +369,7 @@ def PSFile(self, filename=None, pdf=False): temp = False regOld = gs.region(env=self.env) - if pdf: - pdfname = filename - else: - pdfname = None + pdfname = filename if pdf else None # preview or pdf if not filename or (filename and pdf): temp = True @@ -569,10 +566,7 @@ def getFile(self, wildcard): s = "." + s suffix.append(s) raster = self.instruction.FindInstructionByType("raster") - if raster: - rasterId = raster.id - else: - rasterId = None + rasterId = raster.id if raster else None if rasterId and self.instruction[rasterId]["raster"]: mapName = self.instruction[rasterId]["raster"].split("@")[0] + suffix[0] @@ -1106,10 +1100,7 @@ def getInitMap(self): scale = mapInitRect.Get()[2] / realWidth initMap = self.instruction.FindInstructionByType("initMap") - if initMap: - id = initMap.id - else: - id = None + id = initMap.id if initMap else None if not id: id = NewId() @@ -2100,10 +2091,7 @@ def OnDragging(self, event): instr = self.instruction[self.dragId] points = instr["where"] # moving point - if self.currentLinePoint == 0: - pPaper = points[1] - else: - pPaper = points[0] + pPaper = points[1] if self.currentLinePoint == 0 else points[0] pCanvas = self.CanvasPaperCoordinates( rect=Rect2DPS(pPaper, (0, 0)), canvasToPaper=False )[:2] @@ -2532,10 +2520,7 @@ def DrawBitmap(self, pdc, filePath, rotation, bbox): pdc.DrawBitmap(bitmap, bbox[0], bbox[1], useMask=True) def DrawRotText(self, pdc, drawId, textDict, coords, bounds): - if textDict["rotate"]: - rot = float(textDict["rotate"]) - else: - rot = 0 + rot = float(textDict["rotate"]) if textDict["rotate"] else 0 if textDict["background"] != "none": background = textDict["background"] @@ -2691,16 +2676,10 @@ def UpdateMapLabel(self): """Updates map frame label""" vector = self.instruction.FindInstructionByType("vector") - if vector: - vectorId = vector.id - else: - vectorId = None + vectorId = vector.id if vector else None raster = self.instruction.FindInstructionByType("raster") - if raster: - rasterId = raster.id - else: - rasterId = None + rasterId = raster.id if raster else None rasterName = "None" if rasterId: diff --git a/gui/wxpython/psmap/utils.py b/gui/wxpython/psmap/utils.py index 6bb53acd9f0..4e754fafd39 100644 --- a/gui/wxpython/psmap/utils.py +++ b/gui/wxpython/psmap/utils.py @@ -93,10 +93,7 @@ class UnitConversion: def __init__(self, parent=None): self.parent = parent - if self.parent: - ppi = wx.ClientDC(self.parent).GetPPI() - else: - ppi = (72, 72) + ppi = wx.ClientDC(self.parent).GetPPI() if self.parent else (72, 72) self._unitsPage = { "inch": {"val": 1.0, "tr": _("inch")}, "point": {"val": 72.0, "tr": _("point")}, @@ -323,10 +320,7 @@ def ComputeSetRegion(self, mapDict, env): centerN = mapDict["center"][1] raster = self.instruction.FindInstructionByType("raster") - if raster: - rasterId = raster.id - else: - rasterId = None + rasterId = raster.id if raster else None if rasterId: env["GRASS_REGION"] = gs.region_env( diff --git a/gui/wxpython/rdigit/controller.py b/gui/wxpython/rdigit/controller.py index 8018ee04e5c..9b70a2cc468 100644 --- a/gui/wxpython/rdigit/controller.py +++ b/gui/wxpython/rdigit/controller.py @@ -447,10 +447,7 @@ def _createNewMap(self, mapName, backgroundMap, mapType): name = mapName.split("@")[0] background = backgroundMap.split("@")[0] types = {"CELL": "int", "FCELL": "float", "DCELL": "double"} - if background: - back = background - else: - back = "null()" + back = background or "null()" try: grast.mapcalc( exp="{name} = {mtype}({back})".format( diff --git a/gui/wxpython/timeline/frame.py b/gui/wxpython/timeline/frame.py index fa2b16ad49f..0829d8bc3a0 100644 --- a/gui/wxpython/timeline/frame.py +++ b/gui/wxpython/timeline/frame.py @@ -272,10 +272,9 @@ def _draw3dFigure(self): self.axes3d.clear() self.axes3d.grid(False) # self.axes3d.grid(True) - if self.temporalType == "absolute": - convert = mdates.date2num - else: - convert = lambda x: x # noqa: E731 + convert = ( + mdates.date2num if self.temporalType == "absolute" else lambda x: x + ) # noqa: E731 colors = cycle(COLORS) plots = [] @@ -321,10 +320,9 @@ def _draw2dFigure(self): """Draws 2D plot (temporal extents)""" self.axes2d.clear() self.axes2d.grid(True) - if self.temporalType == "absolute": - convert = mdates.date2num - else: - convert = lambda x: x # noqa: E731 + convert = ( + mdates.date2num if self.temporalType == "absolute" else lambda x: x + ) # noqa: E731 colors = cycle(COLORS) diff --git a/gui/wxpython/tools/update_menudata.py b/gui/wxpython/tools/update_menudata.py index 2f548da3087..08897e6147d 100644 --- a/gui/wxpython/tools/update_menudata.py +++ b/gui/wxpython/tools/update_menudata.py @@ -136,10 +136,7 @@ def main(argv=None): if argv is None: argv = sys.argv - if len(argv) > 1 and argv[1] == "-d": - printDiff = True - else: - printDiff = False + printDiff = bool(len(argv) > 1 and argv[1] == "-d") if len(argv) > 1 and argv[1] == "-h": print(sys.stderr, __doc__, file=sys.stderr) diff --git a/gui/wxpython/tplot/frame.py b/gui/wxpython/tplot/frame.py index 07825058e2d..584d97fbf24 100755 --- a/gui/wxpython/tplot/frame.py +++ b/gui/wxpython/tplot/frame.py @@ -756,10 +756,7 @@ def _writeCSV(self, x, y): """Used to write CSV file of plotted data""" import csv - if isinstance(y[0], list): - zipped = list(zip(x, *y)) - else: - zipped = list(zip(x, y)) + zipped = list(zip(x, *y)) if isinstance(y[0], list) else list(zip(x, y)) with open(self.csvpath, "w", newline="") as fi: writer = csv.writer(fi) if self.header: diff --git a/gui/wxpython/vdigit/dialogs.py b/gui/wxpython/vdigit/dialogs.py index 43b277b2ca7..2e7333cf122 100644 --- a/gui/wxpython/vdigit/dialogs.py +++ b/gui/wxpython/vdigit/dialogs.py @@ -431,10 +431,7 @@ def ApplyChanges(self, fid): if layer not in catsCurr[1].keys() or cat not in catsCurr[1][layer]: catList.append(cat) if catList != []: - if action == "catadd": - add = True - else: - add = False + add = action == "catadd" newfid = self.digit.SetLineCats(fid, layer, catList, add) if len(self.cats.keys()) == 1: diff --git a/gui/wxpython/vdigit/mapwindow.py b/gui/wxpython/vdigit/mapwindow.py index ff7e62ebaa9..db9ebf57caf 100644 --- a/gui/wxpython/vdigit/mapwindow.py +++ b/gui/wxpython/vdigit/mapwindow.py @@ -834,10 +834,7 @@ def OnLeftUpVarious(self, event): self.digit.GetDisplay().SelectAreaByPoint(pos1)["area"] != -1 ) else: - if action == "moveLine": - drawSeg = True - else: - drawSeg = False + drawSeg = action == "moveLine" nselected = self.digit.GetDisplay().SelectLinesByBox( bbox=(pos1, pos2), drawSeg=drawSeg @@ -1103,10 +1100,7 @@ def _onRightUp(self, event): GError(parent=self, message=_("No vector map selected for editing.")) if mapName: - if self.toolbar.GetAction("type") == "line": - line = True - else: - line = False + line = self.toolbar.GetAction("type") == "line" if len(self.polycoords) < 2: # ignore 'one-point' lines return diff --git a/gui/wxpython/vdigit/preferences.py b/gui/wxpython/vdigit/preferences.py index e565c60dfe9..b8fd9096510 100644 --- a/gui/wxpython/vdigit/preferences.py +++ b/gui/wxpython/vdigit/preferences.py @@ -622,10 +622,7 @@ def _createAttributesPage(self, notebook): layer = UserSettings.Get(group="vdigit", key="layer", subkey="value") mapLayer = self.parent.toolbars["vdigit"].GetLayer() tree = self.parent.tree - if tree: - item = tree.FindItemByData("maplayer", mapLayer) - else: - item = None + item = tree.FindItemByData("maplayer", mapLayer) if tree else None row = 0 for attrb in ["length", "area", "perimeter"]: # checkbox @@ -664,10 +661,7 @@ def _createAttributesPage(self, notebook): column.SetStringSelection( tree.GetLayerInfo(item, key="vdigit")["geomAttr"][attrb]["column"] ) - if attrb == "area": - type = "area" - else: - type = "length" + type = "area" if attrb == "area" else "length" unitsIdx = Units.GetUnitsIndex( type, tree.GetLayerInfo(item, key="vdigit")["geomAttr"][attrb]["units"], @@ -987,10 +981,7 @@ def UpdateSettings(self): # geometry attributes (workspace) mapLayer = self.parent.toolbars["vdigit"].GetLayer() tree = self._giface.GetLayerTree() - if tree: - item = tree.FindItemByData("maplayer", mapLayer) - else: - item = None + item = tree.FindItemByData("maplayer", mapLayer) if tree else None for key, val in self.geomAttrb.items(): checked = self.FindWindowById(val["check"]).IsChecked() column = self.FindWindowById(val["column"]).GetValue() @@ -999,11 +990,8 @@ def UpdateSettings(self): tree.SetLayerInfo(item, key="vdigit", value={"geomAttr": {}}) if checked: # enable - if key == "area": - type = key - else: - type = "length" - unitsKey = Units.GetUnitsKey(type, unitsIdx) + _type = key if key == "area" else "length" + unitsKey = Units.GetUnitsKey(_type, unitsIdx) tree.GetLayerInfo(item, key="vdigit")["geomAttr"][key] = { "column": column, "units": unitsKey, diff --git a/gui/wxpython/vdigit/toolbars.py b/gui/wxpython/vdigit/toolbars.py index 6c5c8b21212..a9cafe3dfb4 100644 --- a/gui/wxpython/vdigit/toolbars.py +++ b/gui/wxpython/vdigit/toolbars.py @@ -1291,10 +1291,7 @@ def UpdateListOfLayers(self, updateTool=False): layerNameList.append(layer.GetName()) if updateTool: # update toolbar - if not self.mapLayer: - value = _("Select vector map") - else: - value = layerNameSelected + value = _("Select vector map") if not self.mapLayer else layerNameSelected if not self.comboid: if not self.tools or "selector" in self.tools: diff --git a/gui/wxpython/vdigit/wxdigit.py b/gui/wxpython/vdigit/wxdigit.py index eda912284a0..10cac8710b5 100644 --- a/gui/wxpython/vdigit/wxdigit.py +++ b/gui/wxpython/vdigit/wxdigit.py @@ -1896,10 +1896,7 @@ def _addFeature(self, ftype, coords, layer, cat, snap, threshold): modeSnap, ) - if ftype == GV_AREA: - ltype = GV_BOUNDARY - else: - ltype = ftype + ltype = GV_BOUNDARY if ftype == GV_AREA else ftype newline = Vect_write_line(self.poMapInfo, ltype, self.poPoints, self.poCats) if newline < 0: self._error.WriteLine() diff --git a/gui/wxpython/vdigit/wxdisplay.py b/gui/wxpython/vdigit/wxdisplay.py index d8e4d0a14bf..39662afb19f 100644 --- a/gui/wxpython/vdigit/wxdisplay.py +++ b/gui/wxpython/vdigit/wxdisplay.py @@ -982,15 +982,9 @@ def OpenMap(self, name, mapset, update=True, tmp=False): # open existing map if update: - if tmp: - open_fn = Vect_open_tmp_update - else: - open_fn = Vect_open_update - else: # noqa: PLR5501 - if tmp: - open_fn = Vect_open_tmp_old - else: - open_fn = Vect_open_old + open_fn = Vect_open_tmp_update if tmp else Vect_open_update + else: + open_fn = Vect_open_tmp_old if tmp else Vect_open_old ret = open_fn(self.poMapInfo, name, mapset) diff --git a/gui/wxpython/vnet/dialogs.py b/gui/wxpython/vnet/dialogs.py index ee553a0b741..396f0821c10 100644 --- a/gui/wxpython/vnet/dialogs.py +++ b/gui/wxpython/vnet/dialogs.py @@ -458,7 +458,7 @@ def _createParametersPage(self): # , 'turn_layer', 'turn_cat_layer']: for sel in ["input", "arc_layer", "node_layer"]: - if sel == "input": + if sel == "input": # noqa: SIM108 btn = self.addToTreeBtn # elif sel == "turn_layer": # btn = self.createTtbBtn @@ -843,10 +843,7 @@ def _setInputData(self): def _parseMapStr(self, vectMapStr): """Create full map name (add current mapset if it is not present in name)""" mapValSpl = vectMapStr.strip().split("@") - if len(mapValSpl) > 1: - mapSet = mapValSpl[1] - else: - mapSet = grass.gisenv()["MAPSET"] + mapSet = mapValSpl[1] if len(mapValSpl) > 1 else grass.gisenv()["MAPSET"] mapName = mapValSpl[0] return mapName, mapSet diff --git a/gui/wxpython/vnet/vnet_data.py b/gui/wxpython/vnet/vnet_data.py index f2f17b0bfb5..9971c9a9699 100644 --- a/gui/wxpython/vnet/vnet_data.py +++ b/gui/wxpython/vnet/vnet_data.py @@ -355,10 +355,8 @@ def SetPointStatus(self, item, itemIndex): item.hide = False elif len(cats) > 1: idx = self.data[itemIndex][1] - if idx == 2: # End/To/Sink point - wxPen = "used2cat" - else: - wxPen = "used1cat" + # End/To/Sink point + wxPen = "used2cat" if idx == 2 else "used1cat" else: wxPen = "used1cat" @@ -841,10 +839,7 @@ def GetRelevantParams(self, analysis): cols = self.vnetProperties[analysis]["cmdParams"]["cols"] for col, v in cols.items(): - if "inputField" in col: - colInptF = v["inputField"] - else: - colInptF = col + colInptF = v["inputField"] if "inputField" in col else col relevant_params.append(colInptF) return relevant_params @@ -900,10 +895,7 @@ def HasTmpVectMap(self, vectMapName): """ mapValSpl = vectMapName.strip().split("@") - if len(mapValSpl) > 1: - mapSet = mapValSpl[1] - else: - mapSet = grass.gisenv()["MAPSET"] + mapSet = mapValSpl[1] if len(mapValSpl) > 1 else grass.gisenv()["MAPSET"] mapName = mapValSpl[0] fullName = mapName + "@" + mapSet @@ -1324,10 +1316,7 @@ def _parseLine(self, line, histStepData): del kv[0] idx = 0 while idx < len(kv): - if subkeyMaster: - subkey = [subkeyMaster, kv[idx]] - else: - subkey = kv[idx] + subkey = [subkeyMaster, kv[idx]] if subkeyMaster else kv[idx] value = kv[idx + 1] value = self._parseValue(value, read=True) if key not in histStepData: @@ -1444,21 +1433,14 @@ def DataValidator(self, row, col, value): self.turn_data[i_row][1] = new_to_angle for i_row in inside_new: - if col == 1: - angle = new_from_angle - else: - angle = new_to_angle + angle = new_from_angle if col == 1 else new_to_angle self.turn_data[i_row][1] = angle self.turn_data[i_row][2] = angle def RemoveDataValidator(self, row): """Angle recalculation due to direction remove""" - if row == 0: - prev_row = self.GetLinesCount() - 1 - else: - prev_row = row - 1 - + prev_row = self.GetLinesCount() - 1 if row == 0 else row - 1 remove_to_angle = self.turn_data[row][2] self.turn_data[prev_row][2] = remove_to_angle diff --git a/gui/wxpython/vnet/vnet_utils.py b/gui/wxpython/vnet/vnet_utils.py index e3cc11aee17..7157ac8a20e 100644 --- a/gui/wxpython/vnet/vnet_utils.py +++ b/gui/wxpython/vnet/vnet_utils.py @@ -34,10 +34,7 @@ def ParseMapStr(mapStr): """Create full map name (add current mapset if it is not present in name)""" mapValSpl = mapStr.strip().split("@") - if len(mapValSpl) > 1: - mapSet = mapValSpl[1] - else: - mapSet = grass.gisenv()["MAPSET"] + mapSet = mapValSpl[1] if len(mapValSpl) > 1 else grass.gisenv()["MAPSET"] mapName = mapValSpl[0] return mapName, mapSet diff --git a/gui/wxpython/web_services/widgets.py b/gui/wxpython/web_services/widgets.py index 473a8fb58a2..e54bee5603f 100644 --- a/gui/wxpython/web_services/widgets.py +++ b/gui/wxpython/web_services/widgets.py @@ -384,10 +384,7 @@ def _advancedSettsPage(self): continue if k in labels or k == "o": - if k != "o": - label = labels[k] - else: - label = param + label = labels[k] if k != "o" else param gridSizer.Add( label, flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, pos=(row, 0) @@ -454,10 +451,7 @@ def _updateLayerOrderList(self, selected=None): """Update order in list.""" def getlayercaption(layer): - if layer["title"]: - cap = layer["title"] - else: - cap = layer["name"] + cap = layer["title"] or layer["name"] if layer["style"]: if layer["style"]["title"]: diff --git a/gui/wxpython/wxgui.py b/gui/wxpython/wxgui.py index 8fac39c4d5a..fe1d6f21054 100644 --- a/gui/wxpython/wxgui.py +++ b/gui/wxpython/wxgui.py @@ -139,10 +139,7 @@ def process_opt(opts, args): printHelp() elif o in {"-w", "--workspace"}: - if a != "": - workspaceFile = str(a) - else: - workspaceFile = args.pop(0) + workspaceFile = str(a) if a != "" else args.pop(0) return workspaceFile diff --git a/gui/wxpython/wxplot/scatter.py b/gui/wxpython/wxplot/scatter.py index c57a3e1fac9..d87a03208e4 100644 --- a/gui/wxpython/wxplot/scatter.py +++ b/gui/wxpython/wxplot/scatter.py @@ -176,11 +176,7 @@ def CreateDatalist(self, rpair): frequency can be in cell counts, percents, or area """ datalist = [] - - if self.scattertype == "bubble": - freqflag = "cn" - else: - freqflag = "n" + freqflag = "cn" if self.scattertype == "bubble" else "n" try: ret = RunCommand( diff --git a/pyproject.toml b/pyproject.toml index a428c79106f..3c5950f922b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -241,7 +241,6 @@ ignore = [ "S608", # hardcoded-sql-expression "SIM102", # collapsible-if "SIM105", # suppressible-exception - "SIM108", # if-else-block-instead-of-if-exp "SIM113", # enumerate-for-loop "SIM116", # if-else-block-instead-of-dict-lookup "SIM118", # in-dict-keys @@ -365,7 +364,7 @@ ignore = [ "temporal/t.rast.algebra/testsu*/*_algebra_arithmetic.py" = ["FLY002"] "temporal/t.rast.colors/t.rast.colors.py" = ["SIM115"] "temporal/t.rast.series/t.rast.series.py" = ["SIM115"] -"temporal/t.rast.what/t.rast.what.py" = ["E265", "E266", "SIM115"] +"temporal/t.rast.what/t.rast.what.py" = ["SIM115"] "temporal/t.register/testsu*/*_raster_different_local.py" = ["FLY002"] "temporal/t.register/testsu*/*_raster_mapmetadata.py" = ["FLY002"] "temporal/t.register/testsuite/test_t_register_raster.py" = ["FLY002"] diff --git a/python/grass/script/core.py b/python/grass/script/core.py index 0b51e7fdbe9..f51814a5900 100644 --- a/python/grass/script/core.py +++ b/python/grass/script/core.py @@ -18,6 +18,8 @@ .. sectionauthor:: Michael Barton """ +from __future__ import annotations + import os import sys import atexit @@ -855,9 +857,9 @@ def get_capture_stderr(): # interface to g.parser -def _parse_opts(lines): - options = {} - flags = {} +def _parse_opts(lines: list) -> tuple[dict[str, str], dict[str, bool]]: + options: dict[str, str] = {} + flags: dict[str, bool] = {} for line in lines: if not line: break @@ -887,7 +889,7 @@ def _parse_opts(lines): return (options, flags) -def parser(): +def parser() -> tuple[dict[str, str], dict[str, bool]]: """Interface to g.parser, intended to be run from the top-level, e.g.: :: diff --git a/python/grass/temporal/abstract_dataset.py b/python/grass/temporal/abstract_dataset.py index bf30afa21dd..6df2fa1f81e 100644 --- a/python/grass/temporal/abstract_dataset.py +++ b/python/grass/temporal/abstract_dataset.py @@ -10,6 +10,8 @@ :authors: Soeren Gebbert """ +from __future__ import annotations + from abc import ABCMeta, abstractmethod from .core import get_current_mapset, get_tgis_message_interface, init_dbif @@ -504,7 +506,7 @@ def update_all(self, dbif=None, execute=True, ident=None): dbif.close() return statement - def is_time_absolute(self): + def is_time_absolute(self) -> bool | None: """Return True in case the temporal type is absolute :return: True if temporal type is absolute, False otherwise @@ -513,7 +515,7 @@ def is_time_absolute(self): return self.base.get_ttype() == "absolute" return None - def is_time_relative(self): + def is_time_relative(self) -> bool | None: """Return True in case the temporal type is relative :return: True if temporal type is relative, False otherwise From ac491770cb2aa2b349333c9ecb6c1ab9d650278d Mon Sep 17 00:00:00 2001 From: Arohan Ajit Date: Fri, 25 Oct 2024 23:09:43 -0400 Subject: [PATCH 17/50] wxGUI: Reverted unused variable fix in wxgui/ (#4595) Seems to break 3D view --- gui/wxpython/wxgui.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gui/wxpython/wxgui.py b/gui/wxpython/wxgui.py index fe1d6f21054..83fed965ecd 100644 --- a/gui/wxpython/wxgui.py +++ b/gui/wxpython/wxgui.py @@ -161,7 +161,7 @@ def main(argv=None): app = GMApp(workspaceFile) # suppress wxPython logs - wx.LogNull() + q = wx.LogNull() # noqa: F841 set_raise_on_error(True) # register GUI PID From 652a2f8c895321d5ae3470603025e822f58315ec Mon Sep 17 00:00:00 2001 From: Anna Petrasova Date: Fri, 25 Oct 2024 23:10:19 -0400 Subject: [PATCH 18/50] wxGUI/nviz: fix imports (#4592) --- gui/wxpython/nviz/wxnviz.py | 88 ++++++++++++++++++++++--------------- 1 file changed, 53 insertions(+), 35 deletions(-) diff --git a/gui/wxpython/nviz/wxnviz.py b/gui/wxpython/nviz/wxnviz.py index 35995d30e6b..32c2541f14e 100644 --- a/gui/wxpython/nviz/wxnviz.py +++ b/gui/wxpython/nviz/wxnviz.py @@ -44,7 +44,6 @@ try: from ctypes import ( CFUNCTYPE, - UNCHECKED, byref, c_char_p, c_double, @@ -58,7 +57,9 @@ print("wxnviz.py: {}".format(e), file=sys.stderr) try: + from grass.lib.ctypes_preamble import UNCHECKED, String from grass.lib.gis import ( + Colors, G_find_raster2, G_find_raster3d, G_find_vector2, @@ -73,20 +74,15 @@ G_warning, ) from grass.lib.nviz import ( - ATT_COLOR, - ATT_EMIT, - ATT_MASK, - ATT_SHINE, - ATT_TOPO, - ATT_TRANSP, - CONST_ATT, - MAP_ATT, + DRAW_QUICK_SURFACE, + DRAW_QUICK_VLINES, + DRAW_QUICK_VOLUME, + DRAW_QUICK_VPOINTS, MAP_OBJ_SITE, MAP_OBJ_SURF, MAP_OBJ_UNDEFINED, MAP_OBJ_VECT, MAP_OBJ_VOL, - Colors, Nviz_change_exag, Nviz_color_from_str, Nviz_del_texture, @@ -153,6 +149,27 @@ nv_data, ) from grass.lib.ogsf import ( + ATT_COLOR, + ATT_EMIT, + ATT_MASK, + ATT_SHINE, + ATT_TOPO, + ATT_TRANSP, + CONST_ATT, + DM_FLAT, + DM_GOURAUD, + MAP_ATT, + MAX_ISOSURFS, + GP_delete_site, + GP_get_sitename, + GP_select_surf, + GP_set_style, + GP_set_style_thematic, + GP_set_trans, + GP_set_zmode, + GP_site_exists, + GP_unselect_surf, + GP_unset_style_thematic, GS_clear, GS_delete_surface, GS_get_cat_at_xy, @@ -177,6 +194,16 @@ GS_surf_exists, GS_write_ppm, GS_write_tif, + GV_delete_vector, + GV_get_vectname, + GV_select_surf, + GV_set_style, + GV_set_style_thematic, + GV_set_trans, + GV_surf_is_selected, + GV_unselect_surf, + GV_unset_style_thematic, + GV_vect_exists, GVL_delete_vol, GVL_get_trans, GVL_init_region, @@ -205,35 +232,13 @@ GVL_slice_set_transp, GVL_vol_exists, ) - from grass.lib.raster import Rast__init_window, Rast_unset_window, Vect_read_colors - from grass.lib.raster3d import ( - GP_delete_site, - GP_get_sitename, - GP_select_surf, - GP_set_style, - GP_set_style_thematic, - GP_set_trans, - GP_set_zmode, - GP_site_exists, - GP_unselect_surf, - GP_unset_style_thematic, - ) - from grass.lib.vector import ( - GV_delete_vector, - GV_get_vectname, - GV_select_surf, - GV_set_style, - GV_set_style_thematic, - GV_set_trans, - GV_surf_is_selected, - GV_unselect_surf, - GV_unset_style_thematic, - GV_vect_exists, - ) + from grass.lib.raster import Rast__init_window, Rast_unset_window + from grass.lib.vector import Vect_read_colors except (ImportError, OSError, TypeError) as e: print("wxnviz.py: {}".format(e), file=sys.stderr) import grass.script as gs + from core.debug import Debug from core.gcmd import DecodeString from core.globalvar import wxPythonPhoenix @@ -2432,3 +2437,16 @@ def GetCmd(self): def Corresponds(self, item): return sorted(self.GetCmd()) == sorted(item.GetCmd()) + + +__all__ = [ + "DM_FLAT", + "DM_GOURAUD", + "DRAW_QUICK_SURFACE", + "DRAW_QUICK_VLINES", + "DRAW_QUICK_VOLUME", + "DRAW_QUICK_VPOINTS", + "MAX_ISOSURFS", + "ImageTexture", + "Nviz", +] From 5af22b2d4eae997953bc62cd865ab0d09883459b Mon Sep 17 00:00:00 2001 From: Vaclav Petras Date: Fri, 25 Oct 2024 23:41:06 -0400 Subject: [PATCH 19/50] lib/iostream: Remove redundant template parameters (#4586) In C++20, repeating template parameter names with the name of the class is no longer allowed as it is redundant (https://cplusplus.github.io/CWG/issues/2237.html). The new code is valid also in C++17, but the old code is not accepted in C++20. --- include/grass/iostream/replacementHeap.h | 6 +++--- include/grass/iostream/replacementHeapBlock.h | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/include/grass/iostream/replacementHeap.h b/include/grass/iostream/replacementHeap.h index 485d4cef99b..30c309cdda2 100644 --- a/include/grass/iostream/replacementHeap.h +++ b/include/grass/iostream/replacementHeap.h @@ -101,10 +101,10 @@ class ReplacementHeap { public: // allocate array mergeHeap and the runs in runList - ReplacementHeap(size_t arity, queue *runList); + ReplacementHeap(size_t arity, queue *runList); // delete array mergeHeap - ~ReplacementHeap(); + ~ReplacementHeap(); // is heap empty? int empty() const { return (size == 0); } @@ -159,7 +159,7 @@ ReplacementHeap::ReplacementHeap(size_t g_arity, /*****************************************************************/ template -ReplacementHeap::~ReplacementHeap() +ReplacementHeap::~ReplacementHeap() { if (!empty()) { diff --git a/include/grass/iostream/replacementHeapBlock.h b/include/grass/iostream/replacementHeapBlock.h index c1596d67585..f4614eb838b 100644 --- a/include/grass/iostream/replacementHeapBlock.h +++ b/include/grass/iostream/replacementHeapBlock.h @@ -102,10 +102,10 @@ class ReplacementHeapBlock { public: // allocate array mergeHeap, where the streams are stored in runList - ReplacementHeapBlock(queue *> *runList); + ReplacementHeapBlock(queue *> *runList); // delete array mergeHeap - ~ReplacementHeapBlock(); + ~ReplacementHeapBlock(); // is heap empty? int empty() const { return (size == 0); } @@ -161,7 +161,7 @@ ReplacementHeapBlock::ReplacementHeapBlock( /*****************************************************************/ template -ReplacementHeapBlock::~ReplacementHeapBlock() +ReplacementHeapBlock::~ReplacementHeapBlock() { if (!empty()) { From 4616b9d4a276ac1f3f4024e14f155a55557e80a7 Mon Sep 17 00:00:00 2001 From: ShubhamDesai <42180509+ShubhamDesai@users.noreply.github.com> Date: Sat, 26 Oct 2024 16:06:20 -0400 Subject: [PATCH 20/50] lib/vector/Vlib: Fix Resource Leak issues in copy.c (#4533) --- lib/vector/Vlib/copy.c | 91 ++++++++++++++++++++++++++++-------------- 1 file changed, 61 insertions(+), 30 deletions(-) diff --git a/lib/vector/Vlib/copy.c b/lib/vector/Vlib/copy.c index bde7e577c8b..779b5ed4a0f 100644 --- a/lib/vector/Vlib/copy.c +++ b/lib/vector/Vlib/copy.c @@ -82,6 +82,8 @@ int Vect_copy_map_lines_field(struct Map_info *In, int field, struct Map_info *Out) { int ret, format, topo; + const char *geometry_type = NULL; + const char *map_name = NULL; if (Vect_level(In) < 1) G_fatal_error( @@ -127,24 +129,30 @@ int Vect_copy_map_lines_field(struct Map_info *In, int field, /* copy features */ ret += copy_lines_2(In, field, topo, Out); - if (topo == TOPO_NONE && + if (topo == TOPO_NONE) { /* check output feature type, centroids can be exported as * points; boundaries as linestrings */ - strcmp(Vect_get_finfo_geometry_type(Out), "polygon") == 0) { - /* copy areas - external formats and simple features access only */ - ret += Vect__copy_areas(In, field, Out); + geometry_type = Vect_get_finfo_geometry_type(Out); + if (geometry_type && strcmp(geometry_type, "polygon") == 0) { + /* copy areas - external formats and simple features access only + */ + ret += Vect__copy_areas(In, field, Out); + } + G_free((void *)geometry_type); } } else { /* -> copy features on level 1 */ - if (topo == TOPO_NONE) + if (topo == TOPO_NONE) { + map_name = Vect_get_full_name(In); G_warning(_("Vector map <%s> not open on topological level. " "Areas will be skipped!"), - Vect_get_full_name(In)); + map_name); + G_free((void *)map_name); + } ret += copy_lines_1(In, field, Out); } - return ret > 0 ? 1 : 0; } @@ -161,6 +169,7 @@ int Vect_copy_map_lines_field(struct Map_info *In, int field, int copy_lines_1(struct Map_info *In, int field, struct Map_info *Out) { int ret, type; + const char *map_name = NULL; struct line_pnts *Points; struct line_cats *Cats; @@ -174,8 +183,9 @@ int copy_lines_1(struct Map_info *In, int field, struct Map_info *Out) while (TRUE) { type = Vect_read_next_line(In, Points, Cats); if (type == -1) { - G_warning(_("Unable to read vector map <%s>"), - Vect_get_full_name(In)); + map_name = Vect_get_full_name(In); + G_warning(_("Unable to read vector map <%s>"), map_name); + G_free((void *)map_name); ret = 1; break; } @@ -193,7 +203,6 @@ int copy_lines_1(struct Map_info *In, int field, struct Map_info *Out) Vect_write_line(Out, type, Points, Cats); } - Vect_destroy_line_struct(Points); Vect_destroy_cats_struct(Cats); @@ -220,6 +229,7 @@ int copy_lines_2(struct Map_info *In, int field, int topo, struct Map_info *Out) struct line_cats *Cats, *CCats; const char *ftype = NULL; + const char *map_name = NULL; Points = Vect_new_line_struct(); CPoints = Vect_new_line_struct(); @@ -251,8 +261,9 @@ int copy_lines_2(struct Map_info *In, int field, int topo, struct Map_info *Out) G_percent(i, nlines, 2); type = Vect_read_line(In, Points, Cats, i); if (type == -1) { - G_warning(_("Unable to read vector map <%s>"), - Vect_get_full_name(In)); + map_name = Vect_get_full_name(In); + G_warning(_("Unable to read vector map <%s>"), map_name); + G_free((void *)map_name); ret = 1; break; /* free allocated space and return */ } @@ -364,7 +375,8 @@ int copy_lines_2(struct Map_info *In, int field, int topo, struct Map_info *Out) if (-1 == Vect_write_line(Out, type, Points, Cats)) { G_warning(_("Writing new feature failed")); - return 1; + ret = 1; + goto free_exit; } } @@ -372,12 +384,13 @@ int copy_lines_2(struct Map_info *In, int field, int topo, struct Map_info *Out) G_important_message( _("%d features without category or from different layer skipped"), nskipped); - +free_exit: Vect_destroy_line_struct(Points); Vect_destroy_line_struct(CPoints); Vect_destroy_line_struct(NPoints); Vect_destroy_cats_struct(Cats); Vect_destroy_cats_struct(CCats); + G_free((void *)ftype); return ret; } @@ -496,6 +509,7 @@ int is_isle(struct Map_info *Map, int area) int Vect__copy_areas(struct Map_info *In, int field, struct Map_info *Out) { int i, area, nareas, cat, isle, nisles, nparts_alloc, nskipped; + int ret = 0; struct line_pnts **Points; struct line_cats *Cats; @@ -567,7 +581,8 @@ int Vect__copy_areas(struct Map_info *In, int field, struct Map_info *Out) if (0 > V2__write_area_sfa(Out, (const struct line_pnts **)Points, nisles + 1, Cats)) { G_warning(_("Writing area %d failed"), area); - return -1; + ret = -1; + goto free_exit; } } #ifdef HAVE_POSTGRES @@ -575,7 +590,8 @@ int Vect__copy_areas(struct Map_info *In, int field, struct Map_info *Out) if (0 > V2__update_area_pg(Out, (const struct line_pnts **)Points, nisles + 1, cat)) { G_warning(_("Writing area %d failed"), area); - return -1; + ret = -1; + goto free_exit; } } #endif @@ -587,11 +603,13 @@ int Vect__copy_areas(struct Map_info *In, int field, struct Map_info *Out) nskipped); /* free allocated space for isles */ +free_exit: for (i = 0; i < nparts_alloc; i++) Vect_destroy_line_struct(Points[i]); Vect_destroy_cats_struct(Cats); + G_free(Points); - return 0; + return ret; } /*! @@ -615,6 +633,7 @@ int Vect_copy_tables(struct Map_info *In, struct Map_info *Out, int field) { int i, n, type; struct field_info *Fi; + const char *map_name = NULL; n = Vect_get_num_dblinks(In); @@ -631,20 +650,23 @@ int Vect_copy_tables(struct Map_info *In, struct Map_info *Out, int field) In->dblnk->field[i].number); return -1; } - if (field > 0 && Fi->number != field) + if (field > 0 && Fi->number != field) { + Vect_destroy_field_info(Fi); continue; + } if (Vect_copy_table(In, Out, Fi->number, Fi->number, Fi->name, type) != 0) { - + map_name = Vect_get_full_name(In); G_warning( _("Unable to copy table <%s> for layer %d from <%s> to <%s>"), - Fi->table, Fi->number, Vect_get_full_name(In), - Vect_get_name(Out)); + Fi->table, Fi->number, map_name, Vect_get_name(Out)); + G_free((void *)map_name); + Vect_destroy_field_info(Fi); return -1; } + Vect_destroy_field_info(Fi); } - return 0; } @@ -729,10 +751,10 @@ int Vect_copy_table_by_cats(struct Map_info *In, struct Map_info *Out, int field_in, int field_out, const char *field_name, int type, int *cats, int ncats) { - int ret; + int ret = 0; struct field_info *Fi, *Fin; const char *name, *key; - dbDriver *driver; + dbDriver *driver = NULL; G_debug(2, "Vect_copy_table_by_cats(): field_in = %d field_out = %d", field_in, field_out); @@ -757,7 +779,7 @@ int Vect_copy_table_by_cats(struct Map_info *In, struct Map_info *Out, if (ret == -1) { G_warning(_("Unable to add database link for vector map <%s>"), Out->name); - return -1; + goto free_exit; } if (cats) @@ -770,7 +792,8 @@ int Vect_copy_table_by_cats(struct Map_info *In, struct Map_info *Out, Fin->table, key, cats, ncats); if (ret == DB_FAILED) { G_warning(_("Unable to copy table <%s>"), Fin->table); - return -1; + ret = -1; + goto free_exit; } driver = db_start_driver_open_database(Fin->driver, @@ -779,22 +802,30 @@ int Vect_copy_table_by_cats(struct Map_info *In, struct Map_info *Out, if (!driver) { G_warning(_("Unable to open database <%s> with driver <%s>"), Fin->database, Fin->driver); - return -1; + ret = -1; + goto free_exit; } /* do not allow duplicate keys */ if (db_create_index2(driver, Fin->table, Fi->key) != DB_OK) { G_warning(_("Unable to create index")); - return -1; + ret = -1; + goto close_db_free_exit; } if (db_grant_on_table(driver, Fin->table, DB_PRIV_SELECT, DB_GROUP | DB_PUBLIC) != DB_OK) { G_warning(_("Unable to grant privileges on table <%s>"), Fin->table); - return -1; + ret = -1; + goto close_db_free_exit; } +close_db_free_exit: db_close_database_shutdown_driver(driver); - return 0; +free_exit: + Vect_destroy_field_info(Fi); + Vect_destroy_field_info(Fin); + + return ret; } From 791077766d2d93d4feea51b0973db73d3cf328d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edouard=20Choini=C3=A8re?= <27212526+echoix@users.noreply.github.com> Date: Sun, 27 Oct 2024 05:24:18 -0400 Subject: [PATCH 21/50] style: Fix superfluous-else rules for raise, continue and break (RET506, RET507, RET508) (#4565) --- doc/python/m.distance.py | 3 +- gui/wxpython/animation/temporal_manager.py | 7 +- gui/wxpython/core/gcmd.py | 9 +- gui/wxpython/core/render.py | 16 +- gui/wxpython/dbmgr/base.py | 4 +- gui/wxpython/dbmgr/dialogs.py | 17 +- gui/wxpython/gui_core/widgets.py | 2 +- gui/wxpython/iclass/dialogs.py | 5 +- gui/wxpython/iscatt/frame.py | 5 +- gui/wxpython/location_wizard/wizard.py | 3 +- gui/wxpython/mapdisp/statusbar.py | 197 +++++++------ gui/wxpython/nviz/tools.py | 7 +- gui/wxpython/psmap/instructions.py | 4 +- gui/wxpython/timeline/frame.py | 2 +- gui/wxpython/tplot/frame.py | 2 +- gui/wxpython/vnet/dialogs.py | 15 +- gui/wxpython/vnet/vnet_data.py | 9 +- man/build_class_graphical.py | 2 +- pyproject.toml | 3 - python/grass/imaging/images2avi.py | 31 +-- python/grass/pygrass/gis/__init__.py | 2 +- python/grass/pygrass/messages/__init__.py | 3 +- .../pygrass/modules/interface/parameter.py | 10 +- python/grass/pygrass/raster/category.py | 2 +- python/grass/pygrass/vector/table.py | 3 +- python/grass/script/task.py | 3 +- python/grass/temporal/temporal_algebra.py | 82 +++--- python/grass/temporal/temporal_operator.py | 260 +++++++++--------- .../temporal/temporal_raster_base_algebra.py | 13 +- .../grass/temporal/temporal_vector_algebra.py | 2 +- scripts/db.in.ogr/db.in.ogr.py | 3 +- scripts/r.in.wms/wms_cap_parsers.py | 3 +- scripts/r.in.wms/wms_drv.py | 3 +- scripts/v.what.strds/v.what.strds.py | 3 +- .../t.vect.observe.strds.py | 3 +- 35 files changed, 352 insertions(+), 386 deletions(-) diff --git a/doc/python/m.distance.py b/doc/python/m.distance.py index 576760c3b40..2383cbfb669 100755 --- a/doc/python/m.distance.py +++ b/doc/python/m.distance.py @@ -82,8 +82,7 @@ def main(): line = sys.stdin.readline().strip() if not line: # EOF break - else: - coords.append(line.split(",")) + coords.append(line.split(",")) else: # read from coord= command line option p = None diff --git a/gui/wxpython/animation/temporal_manager.py b/gui/wxpython/animation/temporal_manager.py index 1b5037639cf..0f00cc6e329 100644 --- a/gui/wxpython/animation/temporal_manager.py +++ b/gui/wxpython/animation/temporal_manager.py @@ -297,10 +297,9 @@ def _getLabelsAndMaps(self, timeseries): # skip this one, already there followsPoint = False continue - else: - # append the last one (of point time) - listOfMaps.append(lastTimeseries) - end = None + # append the last one (of point time) + listOfMaps.append(lastTimeseries) + end = None else: # append series which is None listOfMaps.append(series) diff --git a/gui/wxpython/core/gcmd.py b/gui/wxpython/core/gcmd.py index 134ed756d23..dfd719b2ff0 100644 --- a/gui/wxpython/core/gcmd.py +++ b/gui/wxpython/core/gcmd.py @@ -311,9 +311,8 @@ def recv_some(p, t=0.1, e=1, tr=5, stderr=0): if r is None: if e: raise Exception(message) - else: - break - elif r: + break + if r: y.append(decode(r)) else: time.sleep(max((x - time.time()) / tr, 0)) @@ -415,7 +414,7 @@ def __init__( _("Error: ") + self.__GetError(), ) ) - elif rerr == sys.stderr: # redirect message to sys + if rerr == sys.stderr: # redirect message to sys stderr.write("Execution failed: '%s'" % (" ".join(self.cmd))) stderr.write( "%sDetails:%s%s" @@ -644,7 +643,7 @@ def _formatMsg(text): for line in text.splitlines(): if len(line) == 0: continue - elif ( + if ( "GRASS_INFO_MESSAGE" in line or "GRASS_INFO_WARNING" in line or "GRASS_INFO_ERROR" in line diff --git a/gui/wxpython/core/render.py b/gui/wxpython/core/render.py index 989287cd4a5..b5fdf34d7dd 100644 --- a/gui/wxpython/core/render.py +++ b/gui/wxpython/core/render.py @@ -1184,32 +1184,32 @@ def SetRegion(self, windres=False, windres3=False): if key == "north": grass_region += "north: %s; " % (region["n"]) continue - elif key == "south": + if key == "south": grass_region += "south: %s; " % (region["s"]) continue - elif key == "east": + if key == "east": grass_region += "east: %s; " % (region["e"]) continue - elif key == "west": + if key == "west": grass_region += "west: %s; " % (region["w"]) continue - elif key == "e-w resol": + if key == "e-w resol": grass_region += "e-w resol: %.10f; " % (region["ewres"]) continue - elif key == "n-s resol": + if key == "n-s resol": grass_region += "n-s resol: %.10f; " % (region["nsres"]) continue - elif key == "cols": + if key == "cols": if windres: continue grass_region += "cols: %d; " % region["cols"] continue - elif key == "rows": + if key == "rows": if windres: continue grass_region += "rows: %d; " % region["rows"] continue - elif key == "n-s resol3" and windres3: + if key == "n-s resol3" and windres3: grass_region += "n-s resol3: %f; " % (region["nsres3"]) elif key == "e-w resol3" and windres3: grass_region += "e-w resol3: %f; " % (region["ewres3"]) diff --git a/gui/wxpython/dbmgr/base.py b/gui/wxpython/dbmgr/base.py index c5eb8877b0a..aeb1a2b3090 100644 --- a/gui/wxpython/dbmgr/base.py +++ b/gui/wxpython/dbmgr/base.py @@ -1659,8 +1659,8 @@ def OnDataItemAdd(self, event): raise ValueError( _("Category number (column %s) is missing.") % keyColumn ) - else: - continue + + continue try: if tlist.columns[columnName[i]]["ctype"] == int: diff --git a/gui/wxpython/dbmgr/dialogs.py b/gui/wxpython/dbmgr/dialogs.py index 8ec2b12f36b..c94e2a71e40 100644 --- a/gui/wxpython/dbmgr/dialogs.py +++ b/gui/wxpython/dbmgr/dialogs.py @@ -648,15 +648,14 @@ def __init__( self.boxSizer = wx.StaticBoxSizer(box, wx.VERTICAL) cId += 1 continue - else: - valueWin = SpinCtrl( - parent=self.dataPanel, - id=wx.ID_ANY, - value=value, - min=-1e9, - max=1e9, - size=(250, -1), - ) + valueWin = SpinCtrl( + parent=self.dataPanel, + id=wx.ID_ANY, + value=value, + min=-1e9, + max=1e9, + size=(250, -1), + ) else: valueWin = TextCtrl( parent=self.dataPanel, id=wx.ID_ANY, value=value, size=(250, -1) diff --git a/gui/wxpython/gui_core/widgets.py b/gui/wxpython/gui_core/widgets.py index 87a09a590d8..b787bf23037 100644 --- a/gui/wxpython/gui_core/widgets.py +++ b/gui/wxpython/gui_core/widgets.py @@ -1603,7 +1603,7 @@ def _loadSettings_v2(self, fd_lines): idx = line.find(";", i_last) if idx < 0: break - elif idx != 0: + if idx != 0: # find out whether it is separator # $$$$; - it is separator # $$$$$; - it is not separator diff --git a/gui/wxpython/iclass/dialogs.py b/gui/wxpython/iclass/dialogs.py index 615e614689f..c868c6e08cf 100644 --- a/gui/wxpython/iclass/dialogs.py +++ b/gui/wxpython/iclass/dialogs.py @@ -486,9 +486,8 @@ def GetSelectedIndices(self, state=wx.LIST_STATE_SELECTED): index = self.GetNextItem(lastFound, wx.LIST_NEXT_ALL, state) if index == -1: break - else: - lastFound = index - indices.append(index) + lastFound = index + indices.append(index) return indices def OnEdit(self, event): diff --git a/gui/wxpython/iscatt/frame.py b/gui/wxpython/iscatt/frame.py index 5350ecbd8a0..3addbad2f06 100644 --- a/gui/wxpython/iscatt/frame.py +++ b/gui/wxpython/iscatt/frame.py @@ -501,9 +501,8 @@ def GetSelectedIndices(self, state=wx.LIST_STATE_SELECTED): index = self.GetNextItem(lastFound, wx.LIST_NEXT_ALL, state) if index == -1: break - else: - lastFound = index - indices.append(index) + lastFound = index + indices.append(index) return indices def DeselectAll(self): diff --git a/gui/wxpython/location_wizard/wizard.py b/gui/wxpython/location_wizard/wizard.py index d553b4e11d9..9f3bf14c886 100644 --- a/gui/wxpython/location_wizard/wizard.py +++ b/gui/wxpython/location_wizard/wizard.py @@ -900,8 +900,7 @@ def OnPageChange(self, event=None): if param["type"] == "bool": if param["value"] is False: continue - else: - self.p4projparams += " +" + param["proj4"] + self.p4projparams += " +" + param["proj4"] elif param["value"] is None: wx.MessageBox( parent=self, diff --git a/gui/wxpython/mapdisp/statusbar.py b/gui/wxpython/mapdisp/statusbar.py index 4fea1ffcc81..8cf5c3b6ff7 100644 --- a/gui/wxpython/mapdisp/statusbar.py +++ b/gui/wxpython/mapdisp/statusbar.py @@ -542,23 +542,22 @@ def ReprojectENToMap(self, e, n, useDefinedProjection): ) if not settings: raise SbException(_("Projection not defined (check the settings)")) + # reproject values + projIn = settings + projOut = RunCommand("g.proj", flags="jf", read=True) + proj = projIn.split(" ")[0].split("=")[1] + if proj in {"ll", "latlong", "longlat"}: + e, n = utils.DMS2Deg(e, n) + proj, coord1 = utils.ReprojectCoordinates( + coord=(e, n), projIn=projIn, projOut=projOut, flags="d" + ) + e, n = coord1 else: - # reproject values - projIn = settings - projOut = RunCommand("g.proj", flags="jf", read=True) - proj = projIn.split(" ")[0].split("=")[1] - if proj in {"ll", "latlong", "longlat"}: - e, n = utils.DMS2Deg(e, n) - proj, coord1 = utils.ReprojectCoordinates( - coord=(e, n), projIn=projIn, projOut=projOut, flags="d" - ) - e, n = coord1 - else: - e, n = float(e), float(n) - proj, coord1 = utils.ReprojectCoordinates( - coord=(e, n), projIn=projIn, projOut=projOut, flags="d" - ) - e, n = coord1 + e, n = float(e), float(n) + proj, coord1 = utils.ReprojectCoordinates( + coord=(e, n), projIn=projIn, projOut=projOut, flags="d" + ) + e, n = coord1 elif self.mapFrame.GetMap().projinfo["proj"] == "ll": e, n = utils.DMS2Deg(e, n) else: @@ -620,32 +619,28 @@ def GetCenterString(self, map): if self.mapFrame.GetProperty("useDefinedProjection"): if not projection: raise SbException(_("Projection not defined (check the settings)")) - else: - proj, coord = utils.ReprojectCoordinates( - coord=(region["center_easting"], region["center_northing"]), - projOut=projection, - flags="d", - ) - if coord: - if proj in {"ll", "latlong", "longlat"} and format == "DMS": - return "%s" % utils.Deg2DMS( - coord[0], coord[1], precision=precision - ) - return "%.*f; %.*f" % (precision, coord[0], precision, coord[1]) - raise SbException(_("Error in projection (check the settings)")) - elif self.mapFrame.GetMap().projinfo["proj"] == "ll" and format == "DMS": + proj, coord = utils.ReprojectCoordinates( + coord=(region["center_easting"], region["center_northing"]), + projOut=projection, + flags="d", + ) + if coord: + if proj in {"ll", "latlong", "longlat"} and format == "DMS": + return "%s" % utils.Deg2DMS(coord[0], coord[1], precision=precision) + return "%.*f; %.*f" % (precision, coord[0], precision, coord[1]) + raise SbException(_("Error in projection (check the settings)")) + if self.mapFrame.GetMap().projinfo["proj"] == "ll" and format == "DMS": return "%s" % utils.Deg2DMS( region["center_easting"], region["center_northing"], precision=precision, ) - else: - return "%.*f; %.*f" % ( - precision, - region["center_easting"], - precision, - region["center_northing"], - ) + return "%.*f; %.*f" % ( + precision, + region["center_easting"], + precision, + region["center_northing"], + ) def SetCenter(self): """Set current map center as item value""" @@ -795,21 +790,19 @@ def ReprojectENFromMap(self, e, n, useDefinedProjection, precision, format): ) if not settings: raise SbException(_("Projection not defined (check the settings)")) - else: - # reproject values - proj, coord = utils.ReprojectCoordinates( - coord=(e, n), projOut=settings, flags="d" - ) - if coord: - e, n = coord - if proj in {"ll", "latlong", "longlat"} and format == "DMS": - return utils.Deg2DMS(e, n, precision=precision) - return "%.*f; %.*f" % (precision, e, precision, n) - raise SbException(_("Error in projection (check the settings)")) - elif self.mapFrame.GetMap().projinfo["proj"] == "ll" and format == "DMS": + # reproject values + proj, coord = utils.ReprojectCoordinates( + coord=(e, n), projOut=settings, flags="d" + ) + if coord: + e, n = coord + if proj in {"ll", "latlong", "longlat"} and format == "DMS": + return utils.Deg2DMS(e, n, precision=precision) + return "%.*f; %.*f" % (precision, e, precision, n) + raise SbException(_("Error in projection (check the settings)")) + if self.mapFrame.GetMap().projinfo["proj"] == "ll" and format == "DMS": return utils.Deg2DMS(e, n, precision=precision) - else: - return "%.*f; %.*f" % (precision, e, precision, n) + return "%.*f; %.*f" % (precision, e, precision, n) class SbRegionExtent(SbTextItem): @@ -872,54 +865,53 @@ def ReprojectRegionFromMap(self, region, useDefinedProjection, precision, format if not settings: raise SbException(_("Projection not defined (check the settings)")) - else: - projOut = settings - proj, coord1 = utils.ReprojectCoordinates( - coord=(region["w"], region["s"]), projOut=projOut, flags="d" - ) - proj, coord2 = utils.ReprojectCoordinates( - coord=(region["e"], region["n"]), projOut=projOut, flags="d" - ) - # useless, used in derived class - proj, coord3 = utils.ReprojectCoordinates( - coord=(0.0, 0.0), projOut=projOut, flags="d" - ) - proj, coord4 = utils.ReprojectCoordinates( - coord=(region["ewres"], region["nsres"]), projOut=projOut, flags="d" - ) - if coord1 and coord2: - if proj in {"ll", "latlong", "longlat"} and format == "DMS": - w, s = utils.Deg2DMS( - coord1[0], coord1[1], string=False, precision=precision - ) - e, n = utils.Deg2DMS( - coord2[0], coord2[1], string=False, precision=precision - ) - ewres, nsres = utils.Deg2DMS( - abs(coord3[0]) - abs(coord4[0]), - abs(coord3[1]) - abs(coord4[1]), - string=False, - hemisphere=False, - precision=precision, - ) - return self._formatRegion( - w=w, s=s, e=e, n=n, ewres=ewres, nsres=nsres - ) - w, s = coord1 - e, n = coord2 - ewres, nsres = coord3 - return self._formatRegion( - w=w, - s=s, - e=e, - n=n, - ewres=ewres, - nsres=nsres, + projOut = settings + proj, coord1 = utils.ReprojectCoordinates( + coord=(region["w"], region["s"]), projOut=projOut, flags="d" + ) + proj, coord2 = utils.ReprojectCoordinates( + coord=(region["e"], region["n"]), projOut=projOut, flags="d" + ) + # useless, used in derived class + proj, coord3 = utils.ReprojectCoordinates( + coord=(0.0, 0.0), projOut=projOut, flags="d" + ) + proj, coord4 = utils.ReprojectCoordinates( + coord=(region["ewres"], region["nsres"]), projOut=projOut, flags="d" + ) + if coord1 and coord2: + if proj in {"ll", "latlong", "longlat"} and format == "DMS": + w, s = utils.Deg2DMS( + coord1[0], coord1[1], string=False, precision=precision + ) + e, n = utils.Deg2DMS( + coord2[0], coord2[1], string=False, precision=precision + ) + ewres, nsres = utils.Deg2DMS( + abs(coord3[0]) - abs(coord4[0]), + abs(coord3[1]) - abs(coord4[1]), + string=False, + hemisphere=False, precision=precision, ) - raise SbException(_("Error in projection (check the settings)")) + return self._formatRegion( + w=w, s=s, e=e, n=n, ewres=ewres, nsres=nsres + ) + w, s = coord1 + e, n = coord2 + ewres, nsres = coord3 + return self._formatRegion( + w=w, + s=s, + e=e, + n=n, + ewres=ewres, + nsres=nsres, + precision=precision, + ) + raise SbException(_("Error in projection (check the settings)")) - elif self.mapFrame.GetMap().projinfo["proj"] == "ll" and format == "DMS": + if self.mapFrame.GetMap().projinfo["proj"] == "ll" and format == "DMS": w, s = utils.Deg2DMS( region["w"], region["s"], string=False, precision=precision ) @@ -930,13 +922,12 @@ def ReprojectRegionFromMap(self, region, useDefinedProjection, precision, format region["ewres"], region["nsres"], string=False, precision=precision ) return self._formatRegion(w=w, s=s, e=e, n=n, ewres=ewres, nsres=nsres) - else: - w, s = region["w"], region["s"] - e, n = region["e"], region["n"] - ewres, nsres = region["ewres"], region["nsres"] - return self._formatRegion( - w=w, s=s, e=e, n=n, ewres=ewres, nsres=nsres, precision=precision - ) + w, s = region["w"], region["s"] + e, n = region["e"], region["n"] + ewres, nsres = region["ewres"], region["nsres"] + return self._formatRegion( + w=w, s=s, e=e, n=n, ewres=ewres, nsres=nsres, precision=precision + ) class SbCompRegionExtent(SbRegionExtent): diff --git a/gui/wxpython/nviz/tools.py b/gui/wxpython/nviz/tools.py index 150fe519635..dce751e6b27 100644 --- a/gui/wxpython/nviz/tools.py +++ b/gui/wxpython/nviz/tools.py @@ -3933,8 +3933,7 @@ def OnSurfacePosition(self, event): self.win["surface"]["position"]["reset"], }: continue - else: - self.FindWindowById(win).SetValue(value) + self.FindWindowById(win).SetValue(value) data = self.GetLayerData("surface") id = data["surface"]["object"]["id"] @@ -4747,8 +4746,8 @@ def OnVolumePosition(self, event): self.win["volume"]["position"]["reset"], }: continue - else: - self.FindWindowById(win).SetValue(value) + + self.FindWindowById(win).SetValue(value) data = self.GetLayerData("volume") id = data["volume"]["object"]["id"] diff --git a/gui/wxpython/psmap/instructions.py b/gui/wxpython/psmap/instructions.py index 82560353806..dcdfb907383 100644 --- a/gui/wxpython/psmap/instructions.py +++ b/gui/wxpython/psmap/instructions.py @@ -223,7 +223,7 @@ def Read(self, filename): buffer = [] continue - elif line.startswith("paper"): + if line.startswith("paper"): instruction = "paper" isBuffer = True buffer.append(line) @@ -698,7 +698,7 @@ def Read(self, instruction, text, **kwargs): if line.split()[1].lower() in {"n", "no", "none"}: instr["border"] = "n" break - elif line.split()[1].lower() in {"y", "yes"}: + if line.split()[1].lower() in {"y", "yes"}: instr["border"] = "y" elif line.startswith("width"): instr["width"] = line.split()[1] diff --git a/gui/wxpython/timeline/frame.py b/gui/wxpython/timeline/frame.py index 0829d8bc3a0..c5c54982ed3 100644 --- a/gui/wxpython/timeline/frame.py +++ b/gui/wxpython/timeline/frame.py @@ -518,7 +518,7 @@ def _checkDatasets(self, datasets): if len(indices) == 0: raise GException(errorMsg) - elif len(indices) >= 2: + if len(indices) >= 2: dlg = wx.SingleChoiceDialog( self, message=_("Please specify the space time dataset <%s>.") % dataset, diff --git a/gui/wxpython/tplot/frame.py b/gui/wxpython/tplot/frame.py index 584d97fbf24..db798081c51 100755 --- a/gui/wxpython/tplot/frame.py +++ b/gui/wxpython/tplot/frame.py @@ -1175,7 +1175,7 @@ def _checkDatasets(self, datasets, typ): if len(indices) == 0: raise GException(errorMsg) - elif len(indices) >= 2: + if len(indices) >= 2: dlg = wx.SingleChoiceDialog( self, message=_("Please specify the space time dataset <%s>.") % dataset, diff --git a/gui/wxpython/vnet/dialogs.py b/gui/wxpython/vnet/dialogs.py index 396f0821c10..2979429a572 100644 --- a/gui/wxpython/vnet/dialogs.py +++ b/gui/wxpython/vnet/dialogs.py @@ -647,11 +647,11 @@ def _updateInputDbMgrData(self): if inpLayer in browseLayers: needLayers.append(inpLayer) continue - else: - wx.BeginBusyCursor() - self.inpDbMgrData["browse"].AddLayer(inpLayer) - wx.EndBusyCursor() - needLayers.append(inpLayer) + + wx.BeginBusyCursor() + self.inpDbMgrData["browse"].AddLayer(inpLayer) + wx.EndBusyCursor() + needLayers.append(inpLayer) for layer in browseLayers: if layer not in needLayers: @@ -1977,7 +1977,6 @@ def GetSelectedIndices(self, state=wx.LIST_STATE_SELECTED): index = self.GetNextItem(lastFound, wx.LIST_NEXT_ALL, state) if index == -1: break - else: - lastFound = index - indices.append(index) + lastFound = index + indices.append(index) return indices diff --git a/gui/wxpython/vnet/vnet_data.py b/gui/wxpython/vnet/vnet_data.py index 9971c9a9699..2074e037350 100644 --- a/gui/wxpython/vnet/vnet_data.py +++ b/gui/wxpython/vnet/vnet_data.py @@ -1187,9 +1187,8 @@ def _savePreviousHist(self, newHist, oldHist): if newHistStepsNum >= self.maxHistSteps: removedHistStep = removedHistData[line] = {} continue - else: - newHist.write("%s%s%s" % ("\n", line, "\n")) - self.histStepsNum = newHistStepsNum + newHist.write("%s%s%s" % ("\n", line, "\n")) + self.histStepsNum = newHistStepsNum elif newHistStepsNum >= self.maxHistSteps: self._parseLine(line, removedHistStep) else: @@ -1289,10 +1288,10 @@ def _getHistStepData(self, histStep): for line in hist: if not line.strip() and isSearchedHistStep: break - elif not line.strip(): + if not line.strip(): newHistStep = True continue - elif isSearchedHistStep: + if isSearchedHistStep: self._parseLine(line, histStepData) if newHistStep: diff --git a/man/build_class_graphical.py b/man/build_class_graphical.py index 554c950d3a8..83338f1942c 100644 --- a/man/build_class_graphical.py +++ b/man/build_class_graphical.py @@ -165,7 +165,7 @@ def generate_page_for_category( img_class = "linkimg" if skip_no_image and not img: continue - elif not img: + if not img: img = "grass_logo.png" img_class = "default-img" if basename.startswith("wxGUI"): diff --git a/pyproject.toml b/pyproject.toml index 3c5950f922b..d739653809e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -208,9 +208,6 @@ ignore = [ "RET501", # unnecessary-return-none "RET502", # implicit-return-value "RET503", # implicit-return - "RET506", # superfluous-else-raise - "RET507", # superfluous-else-continue - "RET508", # superfluous-else-break "RUF003", # ambiguous-unicode-character-comment "RUF005", # collection-literal-concatenation "RUF012", # mutable-class-default diff --git a/python/grass/imaging/images2avi.py b/python/grass/imaging/images2avi.py index 1b0d9d8cd20..9776b9c0db2 100644 --- a/python/grass/imaging/images2avi.py +++ b/python/grass/imaging/images2avi.py @@ -141,19 +141,18 @@ def writeAvi( print(gs.decode(outPut)) print(gs.decode(S.stderr.read())) raise RuntimeError(_("Could not write avi.")) - else: - try: - # Copy avi - shutil.copy(os.path.join(tempDir, "output.avi"), filename) - except Exception as err: - # Clean up - _cleanDir(tempDir) - if bg_task: - return str(err) - raise - + try: + # Copy avi + shutil.copy(os.path.join(tempDir, "output.avi"), filename) + except Exception as err: # Clean up _cleanDir(tempDir) + if bg_task: + return str(err) + raise + + # Clean up + _cleanDir(tempDir) def readAvi(filename, asNumpy=True): @@ -195,11 +194,11 @@ def readAvi(filename, asNumpy=True): # Clean up _cleanDir(tempDir) raise RuntimeError("Could not read avi.") - else: - # Read images - images = images2ims.readIms(os.path.join(tempDir, "im*.jpg"), asNumpy) - # Clean up - _cleanDir(tempDir) + + # Read images + images = images2ims.readIms(os.path.join(tempDir, "im*.jpg"), asNumpy) + # Clean up + _cleanDir(tempDir) # Done return images diff --git a/python/grass/pygrass/gis/__init__.py b/python/grass/pygrass/gis/__init__.py index 597c4bf75fa..29fecd3d699 100644 --- a/python/grass/pygrass/gis/__init__.py +++ b/python/grass/pygrass/gis/__init__.py @@ -114,7 +114,7 @@ def make_mapset(mapset, location=None, gisdbase=None): res = libgis.G_make_mapset(gisdbase, location, mapset) if res == -1: raise GrassError("Cannot create new mapset") - elif res == -2: + if res == -2: raise GrassError("Illegal name") diff --git a/python/grass/pygrass/messages/__init__.py b/python/grass/pygrass/messages/__init__.py index 36356433381..54d9af1b1c5 100644 --- a/python/grass/pygrass/messages/__init__.py +++ b/python/grass/pygrass/messages/__init__.py @@ -262,8 +262,7 @@ def fatal(self, message): if self.raise_on_error is True: raise FatalError(message) - else: - sys.exit(1) + sys.exit(1) def debug(self, level, message): """Send a debug message to stderr diff --git a/python/grass/pygrass/modules/interface/parameter.py b/python/grass/pygrass/modules/interface/parameter.py index 1ec5466bc74..d950cd40008 100644 --- a/python/grass/pygrass/modules/interface/parameter.py +++ b/python/grass/pygrass/modules/interface/parameter.py @@ -18,15 +18,15 @@ def _check_value(param, value): string = (bytes, str) def raiseexcpet(exc, param, ptype, value): - """Function to modifa the error message""" + """Function to modify the error message""" msg = req % (param.name, param.typedesc, ptype, value, str(exc)) if isinstance(exc, ValueError): raise ValueError(msg) - elif isinstance(exc, TypeError): + if isinstance(exc, TypeError): raise TypeError(msg) - else: - exc.message = msg - raise exc + + exc.message = msg + raise exc def check_string(value): """Function to check that a string parameter is already a string""" diff --git a/python/grass/pygrass/raster/category.py b/python/grass/pygrass/raster/category.py index fa4e8d37b12..9c34bb8390f 100644 --- a/python/grass/pygrass/raster/category.py +++ b/python/grass/pygrass/raster/category.py @@ -189,7 +189,7 @@ def _set_c_cat(self, label, min_cat, max_cat=None): return None if err == 0: raise GrassError(_("Null value detected")) - elif err == -1: + if err == -1: raise GrassError(_("Error executing: Rast_set_cat")) def __del__(self): diff --git a/python/grass/pygrass/vector/table.py b/python/grass/pygrass/vector/table.py index 5442d2f1e51..b83f751a0dd 100644 --- a/python/grass/pygrass/vector/table.py +++ b/python/grass/pygrass/vector/table.py @@ -134,8 +134,7 @@ def limit(self, number): """ if not isinstance(number, int): raise ValueError("Must be an integer.") - else: - self._limit = "LIMIT {number}".format(number=number) + self._limit = "LIMIT {number}".format(number=number) return self def group_by(self, *groupby): diff --git a/python/grass/script/task.py b/python/grass/script/task.py index 9867b3d8c49..758372938e3 100644 --- a/python/grass/script/task.py +++ b/python/grass/script/task.py @@ -153,8 +153,7 @@ def get_param(self, value, element="name", raiseError=True): _("Parameter element '%(element)s' not found: '%(value)s'") % {"element": element, "value": value} ) - else: - return None + return None def get_flag(self, aFlag): """Find and return a flag by name diff --git a/python/grass/temporal/temporal_algebra.py b/python/grass/temporal/temporal_algebra.py index 2429b61e35e..a27fa91cd1d 100644 --- a/python/grass/temporal/temporal_algebra.py +++ b/python/grass/temporal/temporal_algebra.py @@ -1156,11 +1156,7 @@ def set_temporal_extent_list(self, maplist, topolist=["EQUAL"], temporal="l"): if returncode == 0: break # Append map to result map list. - elif returncode == 1: - # print(map_new.get_id() + " " + - # str(map_new.get_temporal_extent_as_tuple())) - # print(map_new.condition_value) - # print(map_new.cmd_list) + if returncode == 1: # resultlist.append(map_new) resultdict[map_new.get_id()] = map_new @@ -1243,42 +1239,41 @@ def check_stds(self, input, clear=False, stds_type=None, check_type=True): _("Space time %s dataset <%s> not found") % (stds.get_new_map_instance(None).get_type(), id_input) ) + # Select temporal dataset entry from database. + stds.select(dbif=self.dbif) + if self.use_granularity: + # We create the maplist out of the map array from none-gap objects + maplist = [] + map_array = stds.get_registered_maps_as_objects_by_granularity( + gran=self.granularity, dbif=self.dbif + ) + for entry in map_array: + # Ignore gap objects + if entry[0].get_id() is not None: + maplist.append(entry[0]) else: - # Select temporal dataset entry from database. - stds.select(dbif=self.dbif) - if self.use_granularity: - # We create the maplist out of the map array from none-gap objects - maplist = [] - map_array = stds.get_registered_maps_as_objects_by_granularity( - gran=self.granularity, dbif=self.dbif - ) - for entry in map_array: - # Ignore gap objects - if entry[0].get_id() is not None: - maplist.append(entry[0]) - else: - maplist = stds.get_registered_maps_as_objects(dbif=self.dbif) - # Create map_value as empty list item. - for map_i in maplist: - if "map_value" not in dir(map_i): - map_i.map_value = [] - if "condition_value" not in dir(map_i): - map_i.condition_value = [] - # Set and check global temporal type variable and map. - if map_i.is_time_absolute() and self.temporaltype is None: - self.temporaltype = "absolute" - elif map_i.is_time_relative() and self.temporaltype is None: - self.temporaltype = "relative" - elif ( - map_i.is_time_absolute() and self.temporaltype == "relative" - ) or (map_i.is_time_relative() and self.temporaltype == "absolute"): - self.msgr.fatal( - _( - "Wrong temporal type of space time dataset " - "<%s> <%s> time is required" - ) - % (id_input, self.temporaltype) + maplist = stds.get_registered_maps_as_objects(dbif=self.dbif) + # Create map_value as empty list item. + for map_i in maplist: + if "map_value" not in dir(map_i): + map_i.map_value = [] + if "condition_value" not in dir(map_i): + map_i.condition_value = [] + # Set and check global temporal type variable and map. + if map_i.is_time_absolute() and self.temporaltype is None: + self.temporaltype = "absolute" + elif map_i.is_time_relative() and self.temporaltype is None: + self.temporaltype = "relative" + elif (map_i.is_time_absolute() and self.temporaltype == "relative") or ( + map_i.is_time_relative() and self.temporaltype == "absolute" + ): + self.msgr.fatal( + _( + "Wrong temporal type of space time dataset " + "<%s> <%s> time is required" ) + % (id_input, self.temporaltype) + ) elif isinstance(input, self.mapclass): # Check if the input is a single map and return it as list with one entry. maplist = [input] @@ -2637,9 +2632,9 @@ def p_expr_tmap_function(self, t): _("%s map <%s> not found in GRASS spatial database") % (map_i.get_type(), id_input) ) - else: - # Select dataset entry from database. - map_i.select(dbif=self.dbif) + + # Select dataset entry from database. + map_i.select(dbif=self.dbif) else: raise FatalError( _( @@ -3383,8 +3378,7 @@ def p_error(self, t): "syntax error on line %d, position %i token %s near '%s' expression " "'%s'" % (t.lineno, t.lexpos, t.type, t.value, self.expression) ) - else: - raise SyntaxError("Unexpected syntax error") + raise SyntaxError("Unexpected syntax error") if __name__ == "__main__": diff --git a/python/grass/temporal/temporal_operator.py b/python/grass/temporal/temporal_operator.py index 7d91ed0f65c..d99244c7c49 100644 --- a/python/grass/temporal/temporal_operator.py +++ b/python/grass/temporal/temporal_operator.py @@ -352,16 +352,16 @@ def p_relation_operator(self, t): # Check for correct type. if not self.optype == "relation": raise SyntaxError('Wrong optype "%s" must be "relation"' % self.optype) + + # Set three operator components. + if isinstance(t[2], list): + self.relations = t[2] else: - # Set three operator components. - if isinstance(t[2], list): - self.relations = t[2] - else: - self.relations = [t[2]] - self.temporal = None - self.function = None + self.relations = [t[2]] + self.temporal = None + self.function = None - t[0] = t[2] + t[0] = t[2] def p_relation_bool_operator(self, t): # {||, during} @@ -374,17 +374,17 @@ def p_relation_bool_operator(self, t): """ if not self.optype == "boolean": raise SyntaxError('Wrong optype "%s" must be "boolean"' % self.optype) + + # Set three operator components. + if isinstance(t[5], list): + self.relations = t[5] else: - # Set three operator components. - if isinstance(t[5], list): - self.relations = t[5] - else: - self.relations = [t[5]] - self.temporal = "l" - self.function = t[2] + t[3] - self.aggregate = t[2] + self.relations = [t[5]] + self.temporal = "l" + self.function = t[2] + t[3] + self.aggregate = t[2] - t[0] = t[2] + t[0] = t[2] def p_relation_bool_combi_operator(self, t): # {||, during, &} @@ -401,17 +401,17 @@ def p_relation_bool_combi_operator(self, t): """ if not self.optype == "boolean": raise SyntaxError('Wrong optype "%s" must be "boolean"' % self.optype) + + # Set three operator components. + if isinstance(t[5], list): + self.relations = t[5] else: - # Set three operator components. - if isinstance(t[5], list): - self.relations = t[5] - else: - self.relations = [t[5]] - self.temporal = "l" - self.function = t[2] + t[3] - self.aggregate = t[7] + self.relations = [t[5]] + self.temporal = "l" + self.function = t[2] + t[3] + self.aggregate = t[7] - t[0] = t[2] + t[0] = t[2] def p_relation_bool_combi_operator2(self, t): # {||, during, left} @@ -424,17 +424,17 @@ def p_relation_bool_combi_operator2(self, t): """ if not self.optype == "boolean": raise SyntaxError('Wrong optype "%s" must be "boolean"' % self.optype) + + # Set three operator components. + if isinstance(t[5], list): + self.relations = t[5] else: - # Set three operator components. - if isinstance(t[5], list): - self.relations = t[5] - else: - self.relations = [t[5]] - self.temporal = t[7] - self.function = t[2] + t[3] - self.aggregate = t[2] + self.relations = [t[5]] + self.temporal = t[7] + self.function = t[2] + t[3] + self.aggregate = t[2] - t[0] = t[2] + t[0] = t[2] def p_relation_bool_combi_operator3(self, t): # {||, during, |, left} @@ -451,17 +451,17 @@ def p_relation_bool_combi_operator3(self, t): """ if not self.optype == "boolean": raise SyntaxError('Wrong optype "%s" must be "relation"' % self.optype) + + # Set three operator components. + if isinstance(t[5], list): + self.relations = t[5] else: - # Set three operator components. - if isinstance(t[5], list): - self.relations = t[5] - else: - self.relations = [t[5]] - self.temporal = t[9] - self.function = t[2] + t[3] - self.aggregate = t[7] + self.relations = [t[5]] + self.temporal = t[9] + self.function = t[2] + t[3] + self.aggregate = t[7] - t[0] = t[2] + t[0] = t[2] def p_select_relation_operator(self, t): # {!:} @@ -477,27 +477,28 @@ def p_select_relation_operator(self, t): """ if not self.optype == "select": raise SyntaxError('Wrong optype "%s" must be "select"' % self.optype) - else: - if len(t) == 4: - # Set three operator components. - self.relations = ["equal", "equivalent"] - self.temporal = "l" - self.function = t[2] - elif len(t) == 6: - if isinstance(t[4], list): - self.relations = t[4] - else: - self.relations = [t[4]] - self.temporal = "l" - self.function = t[2] - elif len(t) == 8: - if isinstance(t[4], list): - self.relations = t[4] - else: - self.relations = [t[4]] - self.temporal = t[6] - self.function = t[2] - t[0] = t[2] + + if len(t) == 4: + # Set three operator components. + self.relations = ["equal", "equivalent"] + self.temporal = "l" + self.function = t[2] + elif len(t) == 6: + if isinstance(t[4], list): + self.relations = t[4] + else: + self.relations = [t[4]] + self.temporal = "l" + self.function = t[2] + elif len(t) == 8: + if isinstance(t[4], list): + self.relations = t[4] + else: + self.relations = [t[4]] + self.temporal = t[6] + self.function = t[2] + + t[0] = t[2] def p_hash_relation_operator(self, t): # {#} @@ -513,27 +514,28 @@ def p_hash_relation_operator(self, t): """ if not self.optype == "hash": raise SyntaxError('Wrong optype "%s" must be "hash"' % self.optype) - else: - if len(t) == 4: - # Set three operator components. - self.relations = ["equal"] - self.temporal = "l" - self.function = t[2] - elif len(t) == 6: - if isinstance(t[4], list): - self.relations = t[4] - else: - self.relations = [t[4]] - self.temporal = "l" - self.function = t[2] - elif len(t) == 8: - if isinstance(t[4], list): - self.relations = t[4] - else: - self.relations = [t[4]] - self.temporal = t[6] - self.function = t[2] - t[0] = t[2] + + if len(t) == 4: + # Set three operator components. + self.relations = ["equal"] + self.temporal = "l" + self.function = t[2] + elif len(t) == 6: + if isinstance(t[4], list): + self.relations = t[4] + else: + self.relations = [t[4]] + self.temporal = "l" + self.function = t[2] + elif len(t) == 8: + if isinstance(t[4], list): + self.relations = t[4] + else: + self.relations = [t[4]] + self.temporal = t[6] + self.function = t[2] + + t[0] = t[2] def p_raster_relation_operator(self, t): # {+} @@ -549,27 +551,28 @@ def p_raster_relation_operator(self, t): """ if not self.optype == "raster": raise SyntaxError('Wrong optype "%s" must be "raster"' % self.optype) - else: - if len(t) == 4: - # Set three operator components. - self.relations = ["equal"] - self.temporal = "l" - self.function = t[2] - elif len(t) == 6: - if isinstance(t[4], list): - self.relations = t[4] - else: - self.relations = [t[4]] - self.temporal = "l" - self.function = t[2] - elif len(t) == 8: - if isinstance(t[4], list): - self.relations = t[4] - else: - self.relations = [t[4]] - self.temporal = t[6] - self.function = t[2] - t[0] = t[2] + + if len(t) == 4: + # Set three operator components. + self.relations = ["equal"] + self.temporal = "l" + self.function = t[2] + elif len(t) == 6: + if isinstance(t[4], list): + self.relations = t[4] + else: + self.relations = [t[4]] + self.temporal = "l" + self.function = t[2] + elif len(t) == 8: + if isinstance(t[4], list): + self.relations = t[4] + else: + self.relations = [t[4]] + self.temporal = t[6] + self.function = t[2] + + t[0] = t[2] def p_overlay_relation_operator(self, t): # {+} @@ -585,27 +588,28 @@ def p_overlay_relation_operator(self, t): """ if not self.optype == "overlay": raise SyntaxError('Wrong optype "%s" must be "overlay"' % self.optype) - else: - if len(t) == 4: - # Set three operator components. - self.relations = ["equal"] - self.temporal = "l" - self.function = t[2] - elif len(t) == 6: - if isinstance(t[4], list): - self.relations = t[4] - else: - self.relations = [t[4]] - self.temporal = "l" - self.function = t[2] - elif len(t) == 8: - if isinstance(t[4], list): - self.relations = t[4] - else: - self.relations = [t[4]] - self.temporal = t[6] - self.function = t[2] - t[0] = t[2] + + if len(t) == 4: + # Set three operator components. + self.relations = ["equal"] + self.temporal = "l" + self.function = t[2] + elif len(t) == 6: + if isinstance(t[4], list): + self.relations = t[4] + else: + self.relations = [t[4]] + self.temporal = "l" + self.function = t[2] + elif len(t) == 8: + if isinstance(t[4], list): + self.relations = t[4] + else: + self.relations = [t[4]] + self.temporal = t[6] + self.function = t[2] + + t[0] = t[2] def p_relation(self, t): # The list of relations. Temporal and spatial relations are supported diff --git a/python/grass/temporal/temporal_raster_base_algebra.py b/python/grass/temporal/temporal_raster_base_algebra.py index cb2122f4a37..bb58c8405f7 100644 --- a/python/grass/temporal/temporal_raster_base_algebra.py +++ b/python/grass/temporal/temporal_raster_base_algebra.py @@ -610,7 +610,7 @@ def set_temporal_extent_list( if returncode == 0: break # Append map to result map list. - elif returncode == 1: + if returncode == 1: # print(map_new.cmd_list) # resultlist.append(map_new) if cmd_bool: @@ -969,12 +969,11 @@ def p_expr_spmap_function(self, t): _("%s map <%s> not found in GRASS spatial database") % (map_i.get_type(), id_input) ) - else: - # Select dataset entry from database. - map_i.select(dbif=self.dbif) - # Create command list for map object. - cmdstring = "(%s)" % (map_i.get_map_id()) - map_i.cmd_list = cmdstring + # Select dataset entry from database. + map_i.select(dbif=self.dbif) + # Create command list for map object. + cmdstring = "(%s)" % (map_i.get_map_id()) + map_i.cmd_list = cmdstring # Return map object. t[0] = cmdstring else: diff --git a/python/grass/temporal/temporal_vector_algebra.py b/python/grass/temporal/temporal_vector_algebra.py index 551c69783f5..2f28da0c7e5 100644 --- a/python/grass/temporal/temporal_vector_algebra.py +++ b/python/grass/temporal/temporal_vector_algebra.py @@ -386,7 +386,7 @@ def set_temporal_extent_list(self, maplist, topolist=["EQUAL"], temporal="l"): if returncode == 0: break # Append map to result map list. - elif returncode == 1: + if returncode == 1: # resultlist.append(map_new) resultdict[map_new.get_id()] = map_new if returncode == 0: diff --git a/scripts/db.in.ogr/db.in.ogr.py b/scripts/db.in.ogr/db.in.ogr.py index a95919f4936..b7d7b01b51e 100755 --- a/scripts/db.in.ogr/db.in.ogr.py +++ b/scripts/db.in.ogr/db.in.ogr.py @@ -115,8 +115,7 @@ def main(): "db.execute", input="-", stdin="DROP TABLE %s" % output ) break - else: - gs.fatal(_("Table <%s> already exists") % output) + gs.fatal(_("Table <%s> already exists") % output) # treat DB as real vector map... layer = db_table or None diff --git a/scripts/r.in.wms/wms_cap_parsers.py b/scripts/r.in.wms/wms_cap_parsers.py index 723a63f0b23..e9704651c7b 100644 --- a/scripts/r.in.wms/wms_cap_parsers.py +++ b/scripts/r.in.wms/wms_cap_parsers.py @@ -105,8 +105,7 @@ def __init__(self, cap_file, force_version=None): raise ParseError( _("Missing version attribute root node in Capabilities XML file") ) - else: - wms_version = self.getroot().attrib["version"] + wms_version = self.getroot().attrib["version"] if wms_version == "1.3.0": self.proj_tag = "CRS" diff --git a/scripts/r.in.wms/wms_drv.py b/scripts/r.in.wms/wms_drv.py index e1131918c4a..e825aabe438 100644 --- a/scripts/r.in.wms/wms_drv.py +++ b/scripts/r.in.wms/wms_drv.py @@ -155,8 +155,7 @@ def _download(self): sleep(sleep_time) continue - else: - gs.fatal(_("Unable to write data into tempfile.\n%s") % str(e)) + gs.fatal(_("Unable to write data into tempfile.\n%s") % str(e)) finally: temp_tile_opened.close() diff --git a/scripts/v.what.strds/v.what.strds.py b/scripts/v.what.strds/v.what.strds.py index 8be00f3536d..2c819fd0e44 100644 --- a/scripts/v.what.strds/v.what.strds.py +++ b/scripts/v.what.strds/v.what.strds.py @@ -202,8 +202,7 @@ def main(): if name is None: isvalid = False break - else: - mapname_list.append(name) + mapname_list.append(name) if isvalid: entry = mapmatrizes[0][i] diff --git a/temporal/t.vect.observe.strds/t.vect.observe.strds.py b/temporal/t.vect.observe.strds/t.vect.observe.strds.py index 547f60a3250..7e9ac225890 100755 --- a/temporal/t.vect.observe.strds/t.vect.observe.strds.py +++ b/temporal/t.vect.observe.strds/t.vect.observe.strds.py @@ -185,8 +185,7 @@ def main(): if name is None: isvalid = False break - else: - mapname_list.append(name) + mapname_list.append(name) if isvalid: entry = mapmatrizes[0][i] From ffcb9e1621579bbfbf56e5417cb7946b4d2fe9cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edouard=20Choini=C3=A8re?= <27212526+echoix@users.noreply.github.com> Date: Sun, 27 Oct 2024 09:56:30 -0400 Subject: [PATCH 22/50] temporal: Add precise typing overloads to dataset_factory (#4600) * temporal: Add precise typing overloads to dataset_factory This enables type checkers like mypy or Pyright to understand the returned class from the string passed as the type argument * temporal: Add typing overloads to dataset_factory * temporal: Add dataset_factory implementation with str type for type argument * temporal: Remove dataset_factory overload that listed all literal types * temporal: Update dataset_factory file header * temporal: Add dataset_factory overload with str type for type argument * temporal: Accept None for id argument in dataset_factory overload as used in existing calls --- python/grass/temporal/factory.py | 109 +++++++++++++++++++++++-------- 1 file changed, 80 insertions(+), 29 deletions(-) diff --git a/python/grass/temporal/factory.py b/python/grass/temporal/factory.py index ba7f5e7d4f0..f246700ef44 100644 --- a/python/grass/temporal/factory.py +++ b/python/grass/temporal/factory.py @@ -1,23 +1,18 @@ """ Object factory -Usage: - -.. code-block:: python - - import grass.temporal as tgis - - tgis.register_maps_in_space_time_dataset(type, name, maps) - - -(C) 2012-2013 by the GRASS Development Team +(C) 2012-2024 by the GRASS Development Team This program is free software under the GNU General Public License (>=v2). Read the file COPYING that comes with GRASS for details. -:authors: Soeren Gebbert +:authors: Soeren Gebbert, Edouard Choinière """ +from __future__ import annotations + +from typing import Literal, overload + from .core import get_tgis_message_interface from .space_time_datasets import ( Raster3DDataset, @@ -31,7 +26,65 @@ ############################################################################### -def dataset_factory(type, id): +@overload +def dataset_factory(type: Literal["strds"], id: str) -> SpaceTimeRasterDataset: + pass + + +@overload +def dataset_factory(type: Literal["str3ds"], id: str) -> SpaceTimeRaster3DDataset: + pass + + +@overload +def dataset_factory(type: Literal["stvds"], id: str) -> SpaceTimeVectorDataset: + pass + + +@overload +def dataset_factory(type: Literal["rast", "raster"], id: str) -> RasterDataset: + pass + + +@overload +def dataset_factory( + type: Literal["raster_3d", "rast3d", "raster3d"], + id: str, +) -> Raster3DDataset: + pass + + +@overload +def dataset_factory(type: Literal["vect", "vector"], id: str) -> VectorDataset: + pass + + +@overload +def dataset_factory( + type: str, id: str +) -> ( + SpaceTimeRasterDataset + | SpaceTimeRaster3DDataset + | SpaceTimeVectorDataset + | RasterDataset + | Raster3DDataset + | VectorDataset + | None +): + pass + + +def dataset_factory( + type: str, id: str | None +) -> ( + SpaceTimeRasterDataset + | SpaceTimeRaster3DDataset + | SpaceTimeVectorDataset + | RasterDataset + | Raster3DDataset + | VectorDataset + | None +): """A factory functions to create space time or map datasets :param type: the dataset type: rast or raster; rast3d, raster3d or raster_3d; @@ -39,20 +92,18 @@ def dataset_factory(type, id): :param id: The id of the dataset ("name@mapset") """ if type == "strds": - sp = SpaceTimeRasterDataset(id) - elif type == "str3ds": - sp = SpaceTimeRaster3DDataset(id) - elif type == "stvds": - sp = SpaceTimeVectorDataset(id) - elif type in {"rast", "raster"}: - sp = RasterDataset(id) - elif type in {"raster_3d", "rast3d", "raster3d"}: - sp = Raster3DDataset(id) - elif type in {"vect", "vector"}: - sp = VectorDataset(id) - else: - msgr = get_tgis_message_interface() - msgr.error(_("Unknown dataset type: %s") % type) - return None - - return sp + return SpaceTimeRasterDataset(id) + if type == "str3ds": + return SpaceTimeRaster3DDataset(id) + if type == "stvds": + return SpaceTimeVectorDataset(id) + if type in {"rast", "raster"}: + return RasterDataset(id) + if type in {"raster_3d", "rast3d", "raster3d"}: + return Raster3DDataset(id) + if type in {"vect", "vector"}: + return VectorDataset(id) + + msgr = get_tgis_message_interface() + msgr.error(_("Unknown dataset type: %s") % type) + return None From 84afcf47aaf49dcea2eaec1c0d93143a2b7dc069 Mon Sep 17 00:00:00 2001 From: ShubhamDesai <42180509+ShubhamDesai@users.noreply.github.com> Date: Sun, 27 Oct 2024 17:35:45 -0400 Subject: [PATCH 23/50] r.in.poly: Fix Resource Leak issue in poly2rast.c (#4605) --- raster/r.in.poly/poly2rast.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/raster/r.in.poly/poly2rast.c b/raster/r.in.poly/poly2rast.c index e81d6f421a3..bb707d03e25 100644 --- a/raster/r.in.poly/poly2rast.c +++ b/raster/r.in.poly/poly2rast.c @@ -90,6 +90,7 @@ int poly_to_rast(char *input_file, char *raster_map, char *title, int nrows, if (stat < 0) { Rast_unopen(rfd); + fclose(ifd); return 1; } @@ -98,6 +99,7 @@ int poly_to_rast(char *input_file, char *raster_map, char *title, int nrows, Rast_short_history(raster_map, "raster", &history); Rast_command_history(&history); Rast_write_history(raster_map, &history); + fclose(ifd); return 0; } From 937b2f48d024e9913e5be37dc0b829f1e037160c Mon Sep 17 00:00:00 2001 From: ShubhamDesai <42180509+ShubhamDesai@users.noreply.github.com> Date: Sun, 27 Oct 2024 17:38:58 -0400 Subject: [PATCH 24/50] lib/gis: Fix resource leak issue in copy_dir.c (#4606) --- lib/gis/copy_dir.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/gis/copy_dir.c b/lib/gis/copy_dir.c index 226e25a5a39..8babbc2e964 100644 --- a/lib/gis/copy_dir.c +++ b/lib/gis/copy_dir.c @@ -141,8 +141,10 @@ int G_recursive_copy(const char *src, const char *dst) sprintf(path, "%s/%s", src, dp->d_name); sprintf(path2, "%s/%s", dst, dp->d_name); - if (G_recursive_copy(path, path2) != 0) + if (G_recursive_copy(path, path2) != 0) { + closedir(dirp); return 1; + } } closedir(dirp); From 7d101ed70a6cc87d5f40850ece3184b04d89ee95 Mon Sep 17 00:00:00 2001 From: ShubhamDesai <42180509+ShubhamDesai@users.noreply.github.com> Date: Mon, 28 Oct 2024 04:34:49 -0400 Subject: [PATCH 25/50] r.watershed: Fix Resource Leak issues in close_maps.c (#4607) --- raster/r.watershed/seg/close_maps.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/raster/r.watershed/seg/close_maps.c b/raster/r.watershed/seg/close_maps.c index 1669bbd89c3..56320428c32 100644 --- a/raster/r.watershed/seg/close_maps.c +++ b/raster/r.watershed/seg/close_maps.c @@ -325,6 +325,8 @@ int close_maps(void) } Rast_close(fd); + G_free(afbuf); + G_free(cbuf); Rast_init_colors(&colors); Rast_make_aspect_colors(&colors, -8, 8); From 24469d8dcb73fdcec1c59713de4a8c82ce3eea3e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hern=C3=A1n=20De=20Angelis?= <51515911+dhdeangelis@users.noreply.github.com> Date: Mon, 28 Oct 2024 11:16:17 +0100 Subject: [PATCH 26/50] docs: v.build manual typo fix (#4604) --- vector/v.build/v.build.html | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/vector/v.build/v.build.html b/vector/v.build/v.build.html index 9f51afdb22b..c66da69110a 100644 --- a/vector/v.build/v.build.html +++ b/vector/v.build/v.build.html @@ -27,7 +27,7 @@

    NOTES

    If error vector map is specified, v.build checks:
      -
    • isolated bondaries (which are not forming any areas),
    • +
    • isolated boundaries (which are not forming any areas),
    • centroids outside of area,
    • duplicated centroids.
    @@ -38,7 +38,7 @@

    NOTES

    • lines or boundaries of zero length,
    • -
    • intersecting boundaries, ie. overlapping areas,
    • +
    • intersecting boundaries, i.e. overlapping areas,
    • areas without centroids that are not isles.
    @@ -46,7 +46,7 @@

    EXAMPLES

    Build topology

    -Note that option=build recreates also spatial and category +Note that option=build also recreates spatial and category indices, not only topology. For linked OGR layers (see v.external) also feature index is created. @@ -61,7 +61,7 @@

    Build topology

    Dump topology or indices

    Dump options print topology, spatial, category or feature index to -standard output. Such information can be printed also for vector maps +standard output. Such information can also be printed for vector maps from other mapsets. A description of the vector topology is available in the GRASS GIS 8 Programmer's Manual, section "Vector library topology management". From 6bceb98965a00957beb64fb1d05e29a96e0f87b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hern=C3=A1n=20De=20Angelis?= <51515911+dhdeangelis@users.noreply.github.com> Date: Mon, 28 Oct 2024 15:03:35 +0100 Subject: [PATCH 27/50] docs: v.outlier.html fix typos (#4610) --- vector/v.outlier/v.outlier.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/vector/v.outlier/v.outlier.html b/vector/v.outlier/v.outlier.html index 3cd3ee46a5a..7e615364916 100644 --- a/vector/v.outlier/v.outlier.html +++ b/vector/v.outlier/v.outlier.html @@ -13,12 +13,12 @@

    DESCRIPTION

    (default), or only positive or only negative outliers. Filtering out only positive outliers can be useful to filter out vegetation returns (e.g. from forest canopies) from LIDAR point clouds, in order to -extract Digital Terrain Models. Filtering out only negative outliers +extract digital terrain models (DTMs). Filtering out only negative outliers can be useful to estimate vegetation height.

    -There is a flag to create a vector that can be visualizated by -qgis. That means that topology is build and the z coordinate is +There is a flag to create a vector that can be visualized in +QGIS. That means that topology is built and the z coordinate is considered as a category.

    EXAMPLES

    From b9a543a6233c186840d941d1bd600c7886409948 Mon Sep 17 00:00:00 2001 From: Arohan Ajit Date: Mon, 28 Oct 2024 10:09:56 -0400 Subject: [PATCH 28/50] i.pansharpen: Fixed bare except clause (#4596) --- .flake8 | 2 +- scripts/i.pansharpen/i.pansharpen.py | 11 ++++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/.flake8 b/.flake8 index c29f447c597..e3b2ecf8251 100644 --- a/.flake8 +++ b/.flake8 @@ -100,7 +100,7 @@ per-file-ignores = scripts/v.import/v.import.py: E722, E501 scripts/db.univar/db.univar.py: E501 scripts/d.frame/d.frame.py: E722 - scripts/i.pansharpen/i.pansharpen.py: E722, E501 + scripts/i.pansharpen/i.pansharpen.py: E501 scripts/v.what.strds/v.what.strds.py: E501 # Line too long (esp. module interface definitions) scripts/*/*.py: E501 diff --git a/scripts/i.pansharpen/i.pansharpen.py b/scripts/i.pansharpen/i.pansharpen.py index e78581c8845..730701bfb91 100755 --- a/scripts/i.pansharpen/i.pansharpen.py +++ b/scripts/i.pansharpen/i.pansharpen.py @@ -93,6 +93,7 @@ # %end import os +from grass.exceptions import CalledModuleError try: import numpy as np @@ -458,7 +459,7 @@ def main(): gs.run_command( "g.remove", flags="f", type="raster", pattern="tmp%s*" % pid, quiet=True ) - except: + except CalledModuleError: pass @@ -523,7 +524,7 @@ def brovey(pan, ms1, ms2, ms3, out, pid, sproc): pb.wait(), pg.wait(), pr.wait() try: pb.terminate(), pg.terminate(), pr.terminate() - except: + except OSError: pass # Cleanup @@ -535,7 +536,7 @@ def brovey(pan, ms1, ms2, ms3, out, pid, sproc): type="raster", name="%s,%s,%s" % (panmatch1, panmatch2, panmatch3), ) - except: + except CalledModuleError: pass @@ -575,7 +576,7 @@ def ihs(pan, ms1, ms2, ms3, out, pid, sproc): # Cleanup try: gs.run_command("g.remove", flags="f", quiet=True, type="raster", name=panmatch) - except: + except CalledModuleError: pass @@ -701,7 +702,7 @@ def pca(pan, ms1, ms2, ms3, out, pid, sproc): pb.wait(), pg.wait(), pr.wait() try: pb.terminate(), pg.terminate(), pr.terminate() - except: + except OSError: pass # Cleanup From 94034a3adb01bd8bd415da452f7235b58e1b6a2a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hern=C3=A1n=20De=20Angelis?= <51515911+dhdeangelis@users.noreply.github.com> Date: Tue, 29 Oct 2024 15:20:56 +0100 Subject: [PATCH 29/50] docs: v.to.db.html fix manual typo (#4615) --- vector/v.to.db/v.to.db.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vector/v.to.db/v.to.db.html b/vector/v.to.db/v.to.db.html index 99c2d5b3dbc..f0ba460d450 100644 --- a/vector/v.to.db/v.to.db.html +++ b/vector/v.to.db/v.to.db.html @@ -25,7 +25,7 @@

    NOTES

    all features of same category taken together.

    Line azimuth is calculated as angle from the North direction to the line endnode direction at the line statnode. By default it's reported in decimal degrees (0-360, CW) but -it also may be repored in radians with unit=radians. Azimuth value +it also may be reported in radians with unit=radians. Azimuth value -1 is used to report closed line with it's startnode and endnode being in same place. Azimuth values make sense only if every vector line has only one entry in database (unique CAT value). @@ -165,4 +165,4 @@

    SEE ALSO

    AUTHORS

    Radim Blazek, ITC-irst, Trento, Italy
    -Line sinuousity implemented by Wolf Bergenheim +Line sinuosity implemented by Wolf Bergenheim From ba809db39314aee6e59de23ed3615ea9daedfc23 Mon Sep 17 00:00:00 2001 From: Anna Petrasova Date: Tue, 29 Oct 2024 10:41:47 -0400 Subject: [PATCH 30/50] wxGUI/nviz: fix missing imports (#4611) --- gui/wxpython/nviz/wxnviz.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/gui/wxpython/nviz/wxnviz.py b/gui/wxpython/nviz/wxnviz.py index 32c2541f14e..d11e03d290b 100644 --- a/gui/wxpython/nviz/wxnviz.py +++ b/gui/wxpython/nviz/wxnviz.py @@ -158,6 +158,11 @@ CONST_ATT, DM_FLAT, DM_GOURAUD, + DM_GRID_SURF, + DM_GRID_WIRE, + DM_POLY, + DM_WIRE, + DM_WIRE_POLY, MAP_ATT, MAX_ISOSURFS, GP_delete_site, @@ -2442,6 +2447,11 @@ def Corresponds(self, item): __all__ = [ "DM_FLAT", "DM_GOURAUD", + "DM_GRID_SURF", + "DM_GRID_WIRE", + "DM_POLY", + "DM_WIRE", + "DM_WIRE_POLY", "DRAW_QUICK_SURFACE", "DRAW_QUICK_VLINES", "DRAW_QUICK_VOLUME", From e6fd11079b82d38745f875301c022914e0474887 Mon Sep 17 00:00:00 2001 From: Arohan Ajit Date: Tue, 29 Oct 2024 11:29:11 -0400 Subject: [PATCH 31/50] d.frame: Fix bare except clause (#4597) --- .flake8 | 1 - scripts/d.frame/d.frame.py | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/.flake8 b/.flake8 index e3b2ecf8251..075fb37d075 100644 --- a/.flake8 +++ b/.flake8 @@ -99,7 +99,6 @@ per-file-ignores = scripts/v.unpack/v.unpack.py: E722, E501 scripts/v.import/v.import.py: E722, E501 scripts/db.univar/db.univar.py: E501 - scripts/d.frame/d.frame.py: E722 scripts/i.pansharpen/i.pansharpen.py: E501 scripts/v.what.strds/v.what.strds.py: E501 # Line too long (esp. module interface definitions) diff --git a/scripts/d.frame/d.frame.py b/scripts/d.frame/d.frame.py index ff77316f0ec..165dd712648 100755 --- a/scripts/d.frame/d.frame.py +++ b/scripts/d.frame/d.frame.py @@ -206,7 +206,7 @@ def calculate_frame(frame, at, width, height): """ try: b, t, l, r = list(map(float, at.split(","))) - except: + except ValueError: fatal(_("Invalid frame position: %s") % at) top = round(height - (t / 100.0 * height)) @@ -238,7 +238,7 @@ def create_frame(monitor, frame, at, overwrite=False): width = int(line.split("=", 1)[1].rsplit(" ", 1)[0]) elif "HEIGHT" in line: height = int(line.split("=", 1)[1].rsplit(" ", 1)[0]) - except: + except (ValueError, IndexError): pass if width < 0 or height < 0: From 6e5643d2b91372acc1a0106400670b61b41f1eb9 Mon Sep 17 00:00:00 2001 From: Arohan Ajit Date: Tue, 29 Oct 2024 14:03:17 -0400 Subject: [PATCH 32/50] v.import: Fixed E722 bare except (#4614) --- .flake8 | 2 +- scripts/v.import/v.import.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.flake8 b/.flake8 index 075fb37d075..21272791e52 100644 --- a/.flake8 +++ b/.flake8 @@ -97,7 +97,7 @@ per-file-ignores = scripts/db.out.ogr/db.out.ogr.py: F841 scripts/g.extension/g.extension.py: F841, E722, E501 scripts/v.unpack/v.unpack.py: E722, E501 - scripts/v.import/v.import.py: E722, E501 + scripts/v.import/v.import.py: E501 scripts/db.univar/db.univar.py: E501 scripts/i.pansharpen/i.pansharpen.py: E501 scripts/v.what.strds/v.what.strds.py: E501 diff --git a/scripts/v.import/v.import.py b/scripts/v.import/v.import.py index 4f579c4bf45..1e467cd190b 100755 --- a/scripts/v.import/v.import.py +++ b/scripts/v.import/v.import.py @@ -263,7 +263,7 @@ def main(): if OGRdatasource.lower().endswith("gml"): try: from osgeo import gdal - except: + except ImportError: gs.fatal( _( "Unable to load GDAL Python bindings (requires package " @@ -338,7 +338,7 @@ def main(): if OGRdatasource.lower().endswith("gml"): try: from osgeo import gdal - except: + except ImportError: gs.fatal( _( "Unable to load GDAL Python bindings (requires package " From 86497131a7d1999936d380d1f57870e87690b9db Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 29 Oct 2024 21:02:19 +0000 Subject: [PATCH 33/50] CI(deps): Lock file maintenance (#4564) --- flake.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/flake.lock b/flake.lock index eacc92d3c4f..c507c1ec951 100644 --- a/flake.lock +++ b/flake.lock @@ -19,11 +19,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1728538411, - "narHash": "sha256-f0SBJz1eZ2yOuKUr5CA9BHULGXVSn6miBuUWdTyhUhU=", + "lastModified": 1730045389, + "narHash": "sha256-4spSNTZ6h8Xmvrr9oqfuxc9jarasGj1QOcsgw8BfNd8=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "b69de56fac8c2b6f8fd27f2eca01dcda8e0a4221", + "rev": "0fcb98acb6633445764dafe180e6833eb0f95208", "type": "github" }, "original": { From 9be02eeba6bfd198acb46aacf522f676fcd90fa2 Mon Sep 17 00:00:00 2001 From: Arohan Ajit Date: Wed, 30 Oct 2024 16:55:17 -0400 Subject: [PATCH 34/50] v.unpack: Fixed bare 'except' (#4616) * updated E722 * updated .flake8 * Update v.unpack.py --- .flake8 | 4 ++-- scripts/v.unpack/v.unpack.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.flake8 b/.flake8 index 21272791e52..4bc6b924620 100644 --- a/.flake8 +++ b/.flake8 @@ -95,8 +95,8 @@ per-file-ignores = scripts/r.semantic.label/r.semantic.label.py: E501 scripts/v.report/v.report.py: E721 scripts/db.out.ogr/db.out.ogr.py: F841 - scripts/g.extension/g.extension.py: F841, E722, E501 - scripts/v.unpack/v.unpack.py: E722, E501 + scripts/g.extension/g.extension.py: E501 + scripts/v.unpack/v.unpack.py: E501 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/v.unpack/v.unpack.py b/scripts/v.unpack/v.unpack.py index c3a7a55deb7..7baa1042ccd 100644 --- a/scripts/v.unpack/v.unpack.py +++ b/scripts/v.unpack/v.unpack.py @@ -77,7 +77,7 @@ def main(): tar = tarfile.TarFile.open(name=input_base, mode="r") try: data_name = tar.getnames()[0] - except: + except IndexError: grass.fatal(_("Pack file unreadable")) if flags["p"]: From 9581ca185bf001301f3907fd3f1ca6da09e9e287 Mon Sep 17 00:00:00 2001 From: Arohan Ajit Date: Wed, 30 Oct 2024 17:14:00 -0400 Subject: [PATCH 35/50] wxGUI: Fixed bare 'except' in nviz/ (#4613) * updated E722 * updates * updates --------- Co-authored-by: Anna Petrasova --- .flake8 | 1 - gui/wxpython/nviz/mapwindow.py | 2 +- gui/wxpython/nviz/tools.py | 62 ++++++++++------------------------ 3 files changed, 19 insertions(+), 46 deletions(-) diff --git a/.flake8 b/.flake8 index 4bc6b924620..f0ac4155990 100644 --- a/.flake8 +++ b/.flake8 @@ -23,7 +23,6 @@ per-file-ignores = doc/python/m.distance.py: E501 gui/scripts/d.wms.py: E501 gui/wxpython/image2target/g.gui.image2target.py: E501 - gui/wxpython/nviz/*: E722 gui/wxpython/photo2image/g.gui.photo2image.py: E501 gui/wxpython/psmap/*: E501, E722 gui/wxpython/vdigit/*: F841, E722, F405, F403 diff --git a/gui/wxpython/nviz/mapwindow.py b/gui/wxpython/nviz/mapwindow.py index d3f93f94938..b6609427895 100644 --- a/gui/wxpython/nviz/mapwindow.py +++ b/gui/wxpython/nviz/mapwindow.py @@ -1390,7 +1390,7 @@ def LoadDataLayers(self): GError(parent=self, message=e.value) # when nviz.tools is not yet ready # during opening 3D view 2nd time - except: + except Exception: pass stop = gs.clock() diff --git a/gui/wxpython/nviz/tools.py b/gui/wxpython/nviz/tools.py index dce751e6b27..77f379ef019 100644 --- a/gui/wxpython/nviz/tools.py +++ b/gui/wxpython/nviz/tools.py @@ -160,7 +160,7 @@ def SetInitialMaps(self): else: try: selection = layers[0].GetName() - except: + except (AttributeError, IndexError): continue if ltype == "raster": self.FindWindowById(self.win["surface"]["map"]).SetValue(selection) @@ -734,24 +734,11 @@ def _createDataPage(self): self.mainPanelData = SP.ScrolledPanel(parent=self) self.mainPanelData.SetupScrolling(scroll_x=False) self.mainPanelData.AlwaysShowScrollbars(hflag=False) - try: # wxpython <= 2.8.10 - self.foldpanelData = fpb.FoldPanelBar( - parent=self.mainPanelData, - id=wx.ID_ANY, - style=fpb.FPB_DEFAULT_STYLE, - extraStyle=fpb.FPB_SINGLE_FOLD, - ) - except: - try: # wxpython >= 2.8.11 - self.foldpanelData = fpb.FoldPanelBar( - parent=self.mainPanelData, - id=wx.ID_ANY, - agwStyle=fpb.FPB_SINGLE_FOLD, - ) - except: # to be sure - self.foldpanelData = fpb.FoldPanelBar( - parent=self.mainPanelData, id=wx.ID_ANY, style=fpb.FPB_SINGLE_FOLD - ) + self.foldpanelData = fpb.FoldPanelBar( + parent=self.mainPanelData, + id=wx.ID_ANY, + agwStyle=fpb.FPB_SINGLE_FOLD, + ) self.foldpanelData.Bind(fpb.EVT_CAPTIONBAR, self.OnPressCaption) @@ -814,24 +801,11 @@ def _createAppearancePage(self): self.mainPanelAppear = SP.ScrolledPanel(parent=self) self.mainPanelAppear.SetupScrolling(scroll_x=False) self.mainPanelAppear.AlwaysShowScrollbars(hflag=False) - try: # wxpython <= 2.8.10 - self.foldpanelAppear = fpb.FoldPanelBar( - parent=self.mainPanelAppear, - id=wx.ID_ANY, - style=fpb.FPB_DEFAULT_STYLE, - extraStyle=fpb.FPB_SINGLE_FOLD, - ) - except: - try: # wxpython >= 2.8.11 - self.foldpanelAppear = fpb.FoldPanelBar( - parent=self.mainPanelAppear, - id=wx.ID_ANY, - agwStyle=fpb.FPB_SINGLE_FOLD, - ) - except: # to be sure - self.foldpanelAppear = fpb.FoldPanelBar( - parent=self.mainPanelAppear, id=wx.ID_ANY, style=fpb.FPB_SINGLE_FOLD - ) + self.foldpanelAppear = fpb.FoldPanelBar( + parent=self.mainPanelAppear, + id=wx.ID_ANY, + agwStyle=fpb.FPB_SINGLE_FOLD, + ) self.foldpanelAppear.Bind(fpb.EVT_CAPTIONBAR, self.OnPressCaption) # light page @@ -3360,7 +3334,7 @@ def OnSetSurface(self, event): name = event.GetString() try: self._getLayerPropertiesByName(name, mapType="raster")["surface"] - except: + except (AttributeError, TypeError, KeyError): self.EnablePage("fringe", False) return @@ -3384,7 +3358,7 @@ def OnSetVector(self, event): name = event.GetString() try: data = self._getLayerPropertiesByName(name, mapType="vector")["vector"] - except: + except (AttributeError, TypeError, KeyError): self.EnablePage("vector", False) return layer = self._getMapLayerByName(name, mapType="vector") @@ -3396,7 +3370,7 @@ def OnSetRaster3D(self, event): name = event.GetString() try: data = self._getLayerPropertiesByName(name, mapType="raster_3d")["volume"] - except: + except (AttributeError, TypeError, KeyError): self.EnablePage("volume", False) return @@ -4925,7 +4899,7 @@ def OnCPlaneSelection(self, event): try: planeIndex = int(plane.split()[-1]) - 1 self.EnablePage("cplane", enabled=True) - except: + except (ValueError, IndexError): planeIndex = -1 self.EnablePage("cplane", enabled=False) self.mapWindow.SelectCPlane(planeIndex) @@ -4942,7 +4916,7 @@ def OnCPlaneChanging(self, event): plane = self.FindWindowById(self.win["cplane"]["planes"]).GetStringSelection() try: planeIndex = int(plane.split()[-1]) - 1 - except: # TODO disabled page + except (ValueError, IndexError): # TODO disabled page planeIndex = -1 if event.GetId() in ( @@ -4984,7 +4958,7 @@ def OnCPlaneShading(self, event): plane = self.FindWindowById(self.win["cplane"]["planes"]).GetStringSelection() try: planeIndex = int(plane.split()[-1]) - 1 - except: # TODO disabled page + except (ValueError, IndexError): # TODO disabled page planeIndex = -1 self.mapWindow.cplanes[planeIndex]["shading"] = shading @@ -4999,7 +4973,7 @@ def OnCPlaneReset(self, event): plane = self.FindWindowById(self.win["cplane"]["planes"]).GetStringSelection() try: planeIndex = int(plane.split()[-1]) - 1 - except: # TODO disabled page + except (ValueError, IndexError): # TODO disabled page planeIndex = -1 self.mapWindow.cplanes[planeIndex] = copy.deepcopy( From 528763fb33ed7c696ea7fa19505b5d9ad02fb62e Mon Sep 17 00:00:00 2001 From: ShubhamDesai <42180509+ShubhamDesai@users.noreply.github.com> Date: Wed, 30 Oct 2024 17:28:17 -0400 Subject: [PATCH 36/50] lib/ogsf: Dereference after null check in gvl2.c (#4588) Dereference after null check --- lib/ogsf/gvl2.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/lib/ogsf/gvl2.c b/lib/ogsf/gvl2.c index 473d3e9406e..2c861c4b5ad 100644 --- a/lib/ogsf/gvl2.c +++ b/lib/ogsf/gvl2.c @@ -316,10 +316,16 @@ void GVL_get_dims(int id, int *rows, int *cols, int *depths) *rows = gvl->rows; *cols = gvl->cols; *depths = gvl->depths; - } - G_debug(3, "GVL_get_dims() id=%d, rows=%d, cols=%d, depths=%d", - gvl->gvol_id, gvl->rows, gvl->cols, gvl->depths); + G_debug(3, "GVL_get_dims() id=%d, rows=%d, cols=%d, depths=%d", + gvl->gvol_id, gvl->rows, gvl->cols, gvl->depths); + } + else { + G_debug(2, + "GVL_get_dims(): Attempted to access a null volume structure " + "for id=%d", + id); + } return; } From 00f51c9e7c22b9643de2b472bc4f6ef4296ceb90 Mon Sep 17 00:00:00 2001 From: Arohan Ajit Date: Thu, 31 Oct 2024 11:27:33 -0400 Subject: [PATCH 37/50] v.report: Updated instance checks (#4618) --- .flake8 | 1 - scripts/v.report/v.report.py | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/.flake8 b/.flake8 index f0ac4155990..3adda73f281 100644 --- a/.flake8 +++ b/.flake8 @@ -92,7 +92,6 @@ per-file-ignores = 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/v.report/v.report.py: E721 scripts/db.out.ogr/db.out.ogr.py: F841 scripts/g.extension/g.extension.py: E501 scripts/v.unpack/v.unpack.py: E501 diff --git a/scripts/v.report/v.report.py b/scripts/v.report/v.report.py index 29d9d3c914e..80e9e8a1189 100755 --- a/scripts/v.report/v.report.py +++ b/scripts/v.report/v.report.py @@ -224,7 +224,7 @@ def main(): # calculate percentages records4 = [float(r[-1]) * 100 / total for r in records3] - if type(records1[0]) == int: + if isinstance(records1[0], int): records3 = [[r1] + [r4] for r1, r4 in zip(records1, records4)] else: records3 = [r1 + [r4] for r1, r4 in zip(records1, records4)] From ba0a4951958b20b0c1fca339c4fa92714095bacc Mon Sep 17 00:00:00 2001 From: Vaclav Petras Date: Thu, 31 Oct 2024 12:49:36 -0400 Subject: [PATCH 38/50] r.mask.status: Always output name of the mask (#4531) For both active and inactive raster mask, show the name of the raster which is used (or would be used) for the mask. This will allow tools like r.mask or GUI to do lower-level operations with or around mask without a need to know about defaults or user mechanism to change the name. I'm repurposing the existing 'name' (full_name) key which is now always set (as opposed to being null when no mask is present) as the 'present' boolean key already has the information on the mask presence. I'm renaming full_name to name because that creates a simpler interface (which is whole point of outputting full name as opposed to two keys to get name and mapset). --- include/grass/defs/raster.h | 1 + lib/raster/mask_info.c | 21 ++++++++++++ raster/r.mask.status/main.c | 34 +++++++------------ raster/r.mask.status/r.mask.status.html | 20 ++++++++--- .../r.mask.status/tests/r_mask_status_test.py | 23 +++++++------ 5 files changed, 63 insertions(+), 36 deletions(-) diff --git a/include/grass/defs/raster.h b/include/grass/defs/raster.h index 7f358562c72..bbdc8bfeaa1 100644 --- a/include/grass/defs/raster.h +++ b/include/grass/defs/raster.h @@ -392,6 +392,7 @@ int Rast_option_to_interp_type(const struct Option *); /* mask_info.c */ char *Rast_mask_info(void); +char *Rast_mask_name(void); bool Rast_mask_status(char *, char *, bool *, char *, char *); int Rast__mask_info(char *, char *); bool Rast_mask_is_present(void); diff --git a/lib/raster/mask_info.c b/lib/raster/mask_info.c index 317bab75b63..25d61341ebe 100644 --- a/lib/raster/mask_info.c +++ b/lib/raster/mask_info.c @@ -49,6 +49,27 @@ char *Rast_mask_info(void) return G_store(text); } +/** + * @brief Retrieves the name of the raster mask to use. + * + * The returned raster map name is fully qualified, i.e., in the form + % "name@mapset". + * + * The mask name is "MASK@", where is the current + * mapset. + * + * The memory for the returned mask name is dynamically allocated using + * G_store(). It is the caller's responsibility to free the memory with + * G_free() when it is no longer needed. + * + * @returns A dynamically allocated string containing the mask name. + */ +char *Rast_mask_name(void) +{ + // Mask name is always "MASK@". + 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 39/50] 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 40/50] 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 41/50] 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 42/50] 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 43/50] 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 44/50] 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 45/50] 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 46/50] 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 47/50] 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 From e37730b936cf4ed27878b2ded63c7fe68b8d979e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edouard=20Choini=C3=A8re?= <27212526+echoix@users.noreply.github.com> Date: Sat, 2 Nov 2024 11:31:34 -0400 Subject: [PATCH 48/50] style: Sort package lists, configure options, and other various sortable files (#4563) * style: Sort packages in Vagrantfile * style: Sort configure flags in package.nix * style: Sort .gunittest.cfg * style: Sort Travis build files * style: Sort python optional_requirements.txt * style: Sort configure flags in GitHub workflows * style: Sort packages and configure flags for binder * style: Sort packages, configure flags, cmake flags and wget downloads in Dockerfiles * style: Sort configure flags in Vagrant script * style: Sort svn author name files with linux sort command * style: Sort contributors.csv and contributors_extra.csv * style: Sort rpm package spec * style: Sort packages and configure flags in mswindows build scripts * style: Sort macosx build script Readme * style: Sort singularity file * Apply changes from https://src.fedoraproject.org/rpms/grass/blob/rawhide/f/grass.spec --- .github/workflows/build_ubuntu-22.04.sh | 24 +-- .../workflows/build_ubuntu-22.04_without_x.sh | 26 +-- .github/workflows/coverity.yml | 27 +-- .github/workflows/macos_install.sh | 64 +++---- .github/workflows/optional_requirements.txt | 2 +- .gunittest.cfg | 2 +- .travis/linux.script.sh | 28 ++-- Dockerfile | 2 +- Vagrantfile | 24 +-- binder/apt.txt | 1 - binder/postBuild | 12 +- contributors.csv | 32 ++-- contributors_extra.csv | 6 +- docker/alpine/Dockerfile | 2 +- docker/debian/Dockerfile | 18 +- docker/ubuntu/Dockerfile | 2 +- docker/ubuntu_wxgui/Dockerfile | 20 +-- macosx/ReadMe.md | 112 +++++++++---- mswindows/crosscompile.sh | 44 ++--- mswindows/osgeo4w/build_osgeo4w.sh | 57 ++++--- mswindows/osgeo4w/package.sh | 90 +++++----- package.nix | 2 +- rpm/grass.spec | 156 +++++++++++------- singularity/debian/singularityfile_debian | 30 ++-- utils/svn_name_git_author.csv | 2 +- utils/svn_name_github_name.csv | 52 +++--- utils/vagrant/compile.sh | 32 ++-- 27 files changed, 478 insertions(+), 391 deletions(-) diff --git a/.github/workflows/build_ubuntu-22.04.sh b/.github/workflows/build_ubuntu-22.04.sh index 3beeccf9bbd..677c46d5f33 100755 --- a/.github/workflows/build_ubuntu-22.04.sh +++ b/.github/workflows/build_ubuntu-22.04.sh @@ -31,26 +31,26 @@ set -u export INSTALL_PREFIX=$1 ./configure \ - --prefix="$INSTALL_PREFIX/" \ --enable-largefile \ - --with-cxx \ - --with-zstd \ - --with-bzlib \ + --prefix="$INSTALL_PREFIX/" \ --with-blas \ + --with-bzlib \ + --with-cxx \ + --with-fftw \ + --with-freetype \ + --with-freetype-includes="/usr/include/freetype2/" \ + --with-geos \ --with-lapack \ --with-libsvm \ - --with-readline \ + --with-netcdf \ --with-openmp \ --with-pdal \ - --with-pthread \ - --with-tiff \ - --with-freetype \ - --with-freetype-includes="/usr/include/freetype2/" \ --with-proj-share=/usr/share/proj \ - --with-geos \ + --with-pthread \ + --with-readline \ --with-sqlite \ - --with-fftw \ - --with-netcdf + --with-tiff \ + --with-zstd eval $makecmd make install diff --git a/.github/workflows/build_ubuntu-22.04_without_x.sh b/.github/workflows/build_ubuntu-22.04_without_x.sh index 5df3a0b7e33..7e05457a4ee 100755 --- a/.github/workflows/build_ubuntu-22.04_without_x.sh +++ b/.github/workflows/build_ubuntu-22.04_without_x.sh @@ -30,25 +30,25 @@ set -u export INSTALL_PREFIX=$1 ./configure \ - --prefix="$INSTALL_PREFIX/" \ --enable-largefile \ - --with-cxx \ - --with-zstd \ - --with-bzlib \ + --prefix="$INSTALL_PREFIX/" \ --with-blas \ - --with-lapack \ - --with-readline \ - --without-openmp \ - --with-pdal \ - --without-pthread \ - --with-tiff \ + --with-bzlib \ + --with-cxx \ + --with-fftw \ --with-freetype \ --with-freetype-includes="/usr/include/freetype2/" \ - --with-proj-share=/usr/share/proj \ --with-geos \ + --with-lapack \ + --with-netcdf \ + --with-pdal \ + --with-proj-share=/usr/share/proj \ + --with-readline \ --with-sqlite \ - --with-fftw \ - --with-netcdf + --with-tiff \ + --with-zstd \ + --without-openmp \ + --without-pthread eval $makecmd make install diff --git a/.github/workflows/coverity.yml b/.github/workflows/coverity.yml index 51ab83015ca..5253a9ee7a4 100644 --- a/.github/workflows/coverity.yml +++ b/.github/workflows/coverity.yml @@ -58,25 +58,26 @@ jobs: echo "CFLAGS=${{ env.CFLAGS }}" >> $GITHUB_ENV echo "CXXFLAGS=${{ env.CXXFLAGS }}" >> $GITHUB_ENV ./configure \ - --prefix="$HOME/install/" \ --enable-largefile \ - --with-cxx \ - --with-zstd \ - --with-bzlib \ + --prefix="$HOME/install/" \ --with-blas \ - --with-lapack \ - --with-readline \ - --without-openmp \ - --with-pdal \ - --without-pthread \ - --with-tiff \ + --with-bzlib \ + --with-cxx \ + --with-fftw \ --with-freetype \ --with-freetype-includes="/usr/include/freetype2/" \ - --with-proj-share=/usr/share/proj \ --with-geos \ + --with-lapack \ + --with-netcdf \ + --with-pdal \ + --with-proj-share=/usr/share/proj \ + --with-readline \ --with-sqlite \ - --with-fftw \ - --with-netcdf + --with-tiff \ + --with-zstd \ + --without-openmp \ + --without-pthread + env: CFLAGS: -fPIC -g CXXFLAGS: -fPIC -g diff --git a/.github/workflows/macos_install.sh b/.github/workflows/macos_install.sh index 8a94bc15c6a..31d7d23ce8d 100755 --- a/.github/workflows/macos_install.sh +++ b/.github/workflows/macos_install.sh @@ -12,51 +12,51 @@ INSTALL_PREFIX=$1 CONFIGURE_FLAGS="\ --prefix=${INSTALL_PREFIX} \ - --with-opengl=aqua \ - --with-openmp \ - --without-x \ + --with-blas=openblas \ + --with-bzlib \ + --with-bzlib-includes=${CONDA_PREFIX}/include \ + --with-bzlib-libs=${CONDA_PREFIX}/lib \ + --with-cairo \ + --with-cairo-includes=${CONDA_PREFIX}/include/cairo \ + --with-cairo-ldflags="-lcairo" \ + --with-cairo-libs=${CONDA_PREFIX}/lib \ + --with-cxx \ + --with-fftw-includes=${CONDA_PREFIX}/include \ + --with-fftw-libs=${CONDA_PREFIX}/lib \ --with-freetype \ --with-freetype-includes=${CONDA_PREFIX}/include/freetype2 \ --with-freetype-libs=${CONDA_PREFIX}/lib \ --with-gdal=${CONDA_PREFIX}/bin/gdal-config \ - --with-proj-includes=${CONDA_PREFIX}/include \ - --with-proj-libs=${CONDA_PREFIX}/lib \ - --with-proj-share=${CONDA_PREFIX}/share/proj \ --with-geos=${CONDA_PREFIX}/bin/geos-config \ + --with-includes=${CONDA_PREFIX}/include \ + --with-lapack=openblas \ --with-libpng=${CONDA_PREFIX}/bin/libpng-config \ - --with-tiff-includes=${CONDA_PREFIX}/include \ - --with-tiff-libs=${CONDA_PREFIX}/lib \ - --with-postgres=yes \ - --with-postgres-includes=${CONDA_PREFIX}/include \ - --with-postgres-libs=${CONDA_PREFIX}/lib \ - --without-mysql \ - --with-sqlite \ - --with-sqlite-libs=${CONDA_PREFIX}/lib \ - --with-sqlite-includes=${CONDA_PREFIX}/include \ - --with-fftw-includes=${CONDA_PREFIX}/include \ - --with-fftw-libs=${CONDA_PREFIX}/lib \ - --with-cxx \ - --with-cairo \ - --with-cairo-includes=${CONDA_PREFIX}/include/cairo \ - --with-cairo-libs=${CONDA_PREFIX}/lib \ - --with-cairo-ldflags="-lcairo" \ - --with-zstd \ - --with-zstd-libs=${CONDA_PREFIX}/lib \ - --with-zstd-includes=${CONDA_PREFIX}/include \ - --with-bzlib \ - --with-bzlib-libs=${CONDA_PREFIX}/lib \ - --with-bzlib-includes=${CONDA_PREFIX}/include \ + --with-libs=${CONDA_PREFIX}/lib \ --with-netcdf=${CONDA_PREFIX}/bin/nc-config \ - --with-blas=openblas \ - --with-lapack=openblas \ --with-netcdf=${CONDA_PREFIX}/bin/nc-config \ --with-nls \ - --with-libs=${CONDA_PREFIX}/lib \ - --with-includes=${CONDA_PREFIX}/include \ + --with-opengl=aqua \ + --with-openmp \ --with-pdal \ + --with-postgres-includes=${CONDA_PREFIX}/include \ + --with-postgres-libs=${CONDA_PREFIX}/lib \ + --with-postgres=yes \ + --with-proj-includes=${CONDA_PREFIX}/include \ + --with-proj-libs=${CONDA_PREFIX}/lib \ + --with-proj-share=${CONDA_PREFIX}/share/proj \ --with-readline \ --with-readline-includes=${CONDA_PREFIX}/include/readline \ --with-readline-libs=${CONDA_PREFIX}/lib + --with-sqlite \ + --with-sqlite-includes=${CONDA_PREFIX}/include \ + --with-sqlite-libs=${CONDA_PREFIX}/lib \ + --with-tiff-includes=${CONDA_PREFIX}/include \ + --with-tiff-libs=${CONDA_PREFIX}/lib \ + --with-zstd \ + --with-zstd-includes=${CONDA_PREFIX}/include \ + --with-zstd-libs=${CONDA_PREFIX}/lib \ + --without-mysql \ + --without-x \ " export CFLAGS="-O2 -pipe -arch ${CONDA_ARCH} -DGL_SILENCE_DEPRECATION -Wall -Wextra -Wpedantic -Wvla" diff --git a/.github/workflows/optional_requirements.txt b/.github/workflows/optional_requirements.txt index 244a75e2933..078e9fadfb8 100644 --- a/.github/workflows/optional_requirements.txt +++ b/.github/workflows/optional_requirements.txt @@ -1,4 +1,4 @@ folium +ipyleaflet jupyter PyVirtualDisplay -ipyleaflet diff --git a/.gunittest.cfg b/.gunittest.cfg index 2117fde9d7a..45ae87c12a4 100644 --- a/.gunittest.cfg +++ b/.gunittest.cfg @@ -12,8 +12,8 @@ exclude = python/grass/temporal/testsuite/unittests_temporal_raster_algebra_equal_ts.py python/grass/temporal/testsuite/unittests_temporal_raster_conditionals_complement_else.py raster/r.in.lidar/testsuite/test_base_resolution.sh - temporal/t.connect/testsuite/test_distr_tgis_db_raster3d.py temporal/t.connect/testsuite/test_distr_tgis_db_raster.py + temporal/t.connect/testsuite/test_distr_tgis_db_raster3d.py temporal/t.connect/testsuite/test_distr_tgis_db_vector.py temporal/t.info/testsuite/test.t.info.sh temporal/t.rast.aggregate/testsuite/test_aggregation_relative.py diff --git a/.travis/linux.script.sh b/.travis/linux.script.sh index 4944f7e894e..f2ab000dfc3 100755 --- a/.travis/linux.script.sh +++ b/.travis/linux.script.sh @@ -11,28 +11,28 @@ echo "MAKEFLAGS is '$MAKEFLAGS'" ./configure --host=x86_64-linux-gnu \ --build=x86_64-linux-gnu \ + --enable-largefile \ + --enable-shared \ --prefix=/usr/lib \ - --sysconfdir=/etc \ --sharedstatedir=/var \ - --enable-shared \ - --with-postgres \ + --sysconfdir=/etc \ + --with-blas \ + --with-cairo \ --with-cxx \ - --with-gdal \ --with-freetype \ - --with-readline \ - --with-nls \ - --with-odbc \ + --with-freetype-includes=/usr/include/freetype2/ \ + --with-gdal \ --with-geos \ --with-lapack \ --with-netcdf \ - --with-blas \ - --with-sqlite \ - --with-zstd \ - --enable-largefile \ - --with-freetype-includes=/usr/include/freetype2/ \ + --with-nls \ + --with-odbc \ + --with-pdal \ + --with-postgres \ --with-postgres-includes=/usr/include/postgresql/ \ --with-proj-share=/usr/share/proj \ - --with-cairo \ - --with-pdal + --with-readline \ + --with-sqlite \ + --with-zstd make CFLAGS="$CFLAGS $GRASS_EXTRA_CFLAGS" CXXFLAGS="$CXXFLAGS $GRASS_EXTRA_CXXFLAGS" diff --git a/Dockerfile b/Dockerfile index 6b928fb46c9..a3645bc558d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -131,9 +131,9 @@ ARG GRASS_CONFIG="\ " ARG GRASS_PYTHON_PACKAGES="\ - Pillow \ matplotlib \ numpy \ + Pillow \ pip \ ply \ psycopg2 \ diff --git a/Vagrantfile b/Vagrantfile index 035bb0c64cb..99c373e82ef 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -43,11 +43,11 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| packageList = [ "autoconf2.69", "autotools-dev", - "make", + "bison", + "flex", "g++", "gettext", - "flex", - "bison", + "libblas-dev", "libcairo2-dev", "libfftw3-dev", "libfreetype6-dev", @@ -55,27 +55,27 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| "libgeos-dev", "libglu1-mesa-dev", "libjpeg-dev", - "libpng-dev", - "libtiff-dev", + "liblapack-dev", "libmysqlclient-dev", "libncurses5-dev", + "libnetcdf-dev", + "libpng-dev", "libpq-dev", "libproj-dev", - "proj-bin", "libreadline-dev", "libsqlite3-dev", + "libtiff-dev", "libxmu-dev", + "make", + "netcdf-bin", + "proj-bin", "python3", - "python3-wxgtk4.0", "python3-dateutil", "python3-dev", "python3-numpy", - "python3-ply", "python3-pil", - "libnetcdf-dev", - "netcdf-bin", - "libblas-dev", - "liblapack-dev", + "python3-ply", + "python3-wxgtk4.0", "unixodbc-dev", "zlib1g-dev", # "libpdal-dev" diff --git a/binder/apt.txt b/binder/apt.txt index 1ee0d6836f9..7f4a3500c82 100644 --- a/binder/apt.txt +++ b/binder/apt.txt @@ -19,7 +19,6 @@ liblapack-dev libncurses5-dev libnetcdf-dev libpdal-dev -libgeos-dev libpng-dev libpq-dev libproj-dev diff --git a/binder/postBuild b/binder/postBuild index 138326daa18..fd462729ec3 100755 --- a/binder/postBuild +++ b/binder/postBuild @@ -5,15 +5,15 @@ set -e # compile ./configure \ - --with-nls \ - --with-cxx \ - --with-readline \ --with-bzlib \ - --with-proj-share=/usr/share/proj \ - --with-geos=/usr/bin/geos-config \ --with-cairo \ - --with-opengl-libs=/usr/include/GL \ + --with-cxx \ --with-freetype=yes --with-freetype-includes="/usr/include/freetype2/" \ + --with-geos=/usr/bin/geos-config \ + --with-nls \ + --with-opengl-libs=/usr/include/GL \ + --with-proj-share=/usr/share/proj \ + --with-readline \ --with-sqlite=yes \ --without-pdal make diff --git a/contributors.csv b/contributors.csv index 5f501d9f077..c9236bb1aea 100644 --- a/contributors.csv +++ b/contributors.csv @@ -1,25 +1,25 @@ cvs_id,name,email,country,osgeo_id,rfc2_agreed,orcid --,Ivan Shmakov,,Russia,1gray,yes,- --,Eric Patton,,Canada,epatton,yes,- --,Laura Toma,,USA,ltoma,yes,- --,Markus Metz,,Germany,mmetz,yes,0000-0002-4038-8754 --,Maris Nartiss,,Latvia,marisn,yes,0000-0002-3875-740X --,Marco Pasetti,,Italy,marcopx,yes,- --,Yann Chemin,,France,ychemin,yes,0000-0001-9232-5512 --,Colin Nielsen,,USA,cnielsen,yes,- +-,Anna Petrášová,,Czech Republic,annakrat,yes,0000-0002-5120-5538 -,Anne Ghisla,,Italy,aghisla,yes,- +-,Colin Nielsen,,USA,cnielsen,yes,- +-,Eric Patton,,Canada,epatton,yes,- -,Helmut Kudrnovsky,,Austria,hellik,yes,0000-0001-6622-7169 --,Anna Petrášová,,Czech Republic,annakrat,yes,0000-0002-5120-5538 +-,Ivan Shmakov,,Russia,1gray,yes,- +-,Laura Toma,,USA,ltoma,yes,- -,Luca Delucchi,,Italy,lucadelu,yes,0000-0002-0493-3516 --,Václav Petráš,,Czech Republic,wenzeslaus,yes,0000-0001-5566-9236 --,Pietro Zambelli,,Italy,zarch,yes,0000-0002-6187-3572 --,Štěpán Turek,,Czech Republic,turek,yes,- +-,Marco Pasetti,,Italy,marcopx,yes,- -,Margherita Di Leo,,Italy,madi,yes,0000-0002-0279-7557 --,Veronica Andreo,,Argentina,veroandreo,yes,0000-0002-4633-2161 --,Stefan Blumentrath,,Norway,sbl,yes,0000-0001-6675-1331 +-,Maris Nartiss,,Latvia,marisn,yes,0000-0002-3875-740X +-,Markus Metz,,Germany,mmetz,yes,0000-0002-4038-8754 +-,Nicklas Larsson,,Hungary/Sweden,nilason,yes,- -,Ondřej Pešek,,Czech Republic,pesekon2,yes,0000-0002-2363-8002 +-,Pietro Zambelli,,Italy,zarch,yes,0000-0002-6187-3572 +-,Stefan Blumentrath,,Norway,sbl,yes,0000-0001-6675-1331 +-,Štěpán Turek,,Czech Republic,turek,yes,- -,Tomáš Zigo,,Slovak Republic,tmszi,yes,- --,Nicklas Larsson,,Hungary/Sweden,nilason,yes,- +-,Václav Petráš,,Czech Republic,wenzeslaus,yes,0000-0001-5566-9236 +-,Veronica Andreo,,Argentina,veroandreo,yes,0000-0002-4633-2161 +-,Yann Chemin,,France,ychemin,yes,0000-0001-9232-5512 alex,Alex Shevlakov,,Russia,-,-,- andreas,Andreas Lange,,Germany,-,-,- benjamin,Benjamin Ducke,,Germany,benducke,yes,0000-0002-0560-4749 @@ -52,9 +52,9 @@ michel,Michel Wurtz,,France,-,-,- mike,Mike Thomas,,Australia,-,-,- moritz,Moritz Lennert,,Belgium,mlennert,yes,0000-0002-2870-4515 msieczka,Maciej Sieczka,,Poland,msieczka,yes,- +pallech,Serena Pallecchi,,Italy,-,-,- paul,Paul Kelly,,UK,pkelly,yes,- paulo,Paulo Marcondes,,Brazil,pmarcondes,-,- -pallech,Serena Pallecchi,,Italy,-,-,- radim,Radim Blazek,,Czech Republic,rblazek,-,- roberto,Roberto Micarelli,,Italy,-,-,- robertoa,Roberto Antolin,,Spain,rantolin,yes,- diff --git a/contributors_extra.csv b/contributors_extra.csv index 5bcbcaaa67d..1cfa5ac4a82 100644 --- a/contributors_extra.csv +++ b/contributors_extra.csv @@ -1,11 +1,11 @@ name,email,country,rfc2_agreed Adam Laža,,Czech Republic,yes +Aldo Clerici,,Italy,- Alfonso Vitti,,Italy,- -Anna Zanchetta,,Italy,yes Andrea Aime,,Italy,- Angus Carr,,Canada,- +Anna Zanchetta,,Italy,yes Antonio Galea,,Italy,- -Aldo Clerici,,Italy,- Ari Jolma,,Finland,- Bill Hughes,,USA,- Brook Milligan,,USA,- @@ -23,8 +23,8 @@ Eric Mitchell,,-,- Francesco Pirotti,,Italy,- Ivan Mincik,,Slovakia,- Jacques Bouchard,,France,- -Jarrett Keifer,,USA,- Jaro Hofierka,,Slovakia,- +Jarrett Keifer,,USA,- Jeshua Lacock,,USA,- Lars Ahlzen,,-,- Lorenzo Moretti,,Italy,- diff --git a/docker/alpine/Dockerfile b/docker/alpine/Dockerfile index b6dbebf6666..8163b5d9b08 100644 --- a/docker/alpine/Dockerfile +++ b/docker/alpine/Dockerfile @@ -29,11 +29,11 @@ ENV GRASS_RUN_PACKAGES="\ gdal-driver-JP2OpenJPEG \ gdal-driver-LIBKML \ gdal-driver-MSSQLSpatial \ + gdal-driver-netCDF \ gdal-driver-ODBC \ gdal-driver-PG \ gdal-driver-PNG \ gdal-driver-WMS \ - gdal-driver-netCDF \ gdal-tools \ geos \ geos-dev \ diff --git a/docker/debian/Dockerfile b/docker/debian/Dockerfile index 8021ccf409e..6df50c8e14d 100644 --- a/docker/debian/Dockerfile +++ b/docker/debian/Dockerfile @@ -88,15 +88,15 @@ RUN echo en_US.UTF-8 UTF-8 >> /etc/locale.gen && locale-gen WORKDIR /src RUN mkdir vdatum && \ cd vdatum && \ - wget -q http://download.osgeo.org/proj/vdatum/usa_geoid2012.zip && unzip -j -u usa_geoid2012.zip -d /usr/share/proj; \ - wget -q http://download.osgeo.org/proj/vdatum/usa_geoid2009.zip && unzip -j -u usa_geoid2009.zip -d /usr/share/proj; \ - wget -q http://download.osgeo.org/proj/vdatum/usa_geoid2003.zip && unzip -j -u usa_geoid2003.zip -d /usr/share/proj; \ + wget -q http://download.osgeo.org/proj/vdatum/egm08_25/egm08_25.gtx && mv egm08_25.gtx /usr/share/proj; \ + wget -q http://download.osgeo.org/proj/vdatum/egm96_15/egm96_15.gtx && mv egm96_15.gtx /usr/share/proj; \ wget -q http://download.osgeo.org/proj/vdatum/usa_geoid1999.zip && unzip -j -u usa_geoid1999.zip -d /usr/share/proj; \ + wget -q http://download.osgeo.org/proj/vdatum/usa_geoid2003.zip && unzip -j -u usa_geoid2003.zip -d /usr/share/proj; \ + wget -q http://download.osgeo.org/proj/vdatum/usa_geoid2009.zip && unzip -j -u usa_geoid2009.zip -d /usr/share/proj; \ + wget -q http://download.osgeo.org/proj/vdatum/usa_geoid2012.zip && unzip -j -u usa_geoid2012.zip -d /usr/share/proj; \ wget -q http://download.osgeo.org/proj/vdatum/vertcon/vertconc.gtx && mv vertconc.gtx /usr/share/proj; \ wget -q http://download.osgeo.org/proj/vdatum/vertcon/vertcone.gtx && mv vertcone.gtx /usr/share/proj; \ wget -q http://download.osgeo.org/proj/vdatum/vertcon/vertconw.gtx && mv vertconw.gtx /usr/share/proj; \ - wget -q http://download.osgeo.org/proj/vdatum/egm96_15/egm96_15.gtx && mv egm96_15.gtx /usr/share/proj; \ - wget -q http://download.osgeo.org/proj/vdatum/egm08_25/egm08_25.gtx && mv egm08_25.gtx /usr/share/proj; \ cd .. && \ rm -rf vdatum @@ -116,16 +116,16 @@ RUN wget -q \ -DCMAKE_C_COMPILER=gcc \ -DCMAKE_CXX_COMPILER=g++ \ -DCMAKE_MAKE_PROGRAM=make \ - -DBUILD_PLUGIN_PYTHON=ON \ + -DBUILD_PGPOINTCLOUD_TESTS=OFF \ -DBUILD_PLUGIN_CPD=OFF \ -DBUILD_PLUGIN_GREYHOUND=ON \ -DBUILD_PLUGIN_HEXBIN=ON \ - -DHEXER_INCLUDE_DIR=/usr/include/ \ - -DBUILD_PLUGIN_NITF=OFF \ -DBUILD_PLUGIN_ICEBRIDGE=ON \ + -DBUILD_PLUGIN_NITF=OFF \ -DBUILD_PLUGIN_PGPOINTCLOUD=OFF \ - -DBUILD_PGPOINTCLOUD_TESTS=OFF \ + -DBUILD_PLUGIN_PYTHON=ON \ -DBUILD_PLUGIN_SQLITE=ON \ + -DHEXER_INCLUDE_DIR=/usr/include/ \ -DWITH_LASZIP=OFF \ -DWITH_LAZPERF=ON \ -DWITH_TESTS=ON && \ diff --git a/docker/ubuntu/Dockerfile b/docker/ubuntu/Dockerfile index 6b928fb46c9..a3645bc558d 100644 --- a/docker/ubuntu/Dockerfile +++ b/docker/ubuntu/Dockerfile @@ -131,9 +131,9 @@ ARG GRASS_CONFIG="\ " ARG GRASS_PYTHON_PACKAGES="\ - Pillow \ matplotlib \ numpy \ + Pillow \ pip \ ply \ psycopg2 \ diff --git a/docker/ubuntu_wxgui/Dockerfile b/docker/ubuntu_wxgui/Dockerfile index 0d1ead788a3..80dbbb1d409 100644 --- a/docker/ubuntu_wxgui/Dockerfile +++ b/docker/ubuntu_wxgui/Dockerfile @@ -122,15 +122,15 @@ RUN echo en_US.UTF-8 UTF-8 >> /etc/locale.gen && locale-gen WORKDIR /src RUN mkdir vdatum && \ cd vdatum && \ - wget -q http://download.osgeo.org/proj/vdatum/usa_geoid2012.zip && unzip -j -u usa_geoid2012.zip -d /usr/share/proj; \ - wget -q http://download.osgeo.org/proj/vdatum/usa_geoid2009.zip && unzip -j -u usa_geoid2009.zip -d /usr/share/proj; \ - wget -q http://download.osgeo.org/proj/vdatum/usa_geoid2003.zip && unzip -j -u usa_geoid2003.zip -d /usr/share/proj; \ + wget -q http://download.osgeo.org/proj/vdatum/egm08_25/egm08_25.gtx && mv egm08_25.gtx /usr/share/proj; \ + wget -q http://download.osgeo.org/proj/vdatum/egm96_15/egm96_15.gtx && mv egm96_15.gtx /usr/share/proj; \ wget -q http://download.osgeo.org/proj/vdatum/usa_geoid1999.zip && unzip -j -u usa_geoid1999.zip -d /usr/share/proj; \ + wget -q http://download.osgeo.org/proj/vdatum/usa_geoid2003.zip && unzip -j -u usa_geoid2003.zip -d /usr/share/proj; \ + wget -q http://download.osgeo.org/proj/vdatum/usa_geoid2009.zip && unzip -j -u usa_geoid2009.zip -d /usr/share/proj; \ + wget -q http://download.osgeo.org/proj/vdatum/usa_geoid2012.zip && unzip -j -u usa_geoid2012.zip -d /usr/share/proj; \ wget -q http://download.osgeo.org/proj/vdatum/vertcon/vertconc.gtx && mv vertconc.gtx /usr/share/proj; \ wget -q http://download.osgeo.org/proj/vdatum/vertcon/vertcone.gtx && mv vertcone.gtx /usr/share/proj; \ wget -q http://download.osgeo.org/proj/vdatum/vertcon/vertconw.gtx && mv vertconw.gtx /usr/share/proj; \ - wget -q http://download.osgeo.org/proj/vdatum/egm96_15/egm96_15.gtx && mv egm96_15.gtx /usr/share/proj; \ - wget -q http://download.osgeo.org/proj/vdatum/egm08_25/egm08_25.gtx && mv egm08_25.gtx /usr/share/proj; \ cd .. && \ rm -rf vdatum @@ -150,16 +150,16 @@ RUN wget -q \ -DCMAKE_C_COMPILER=gcc \ -DCMAKE_CXX_COMPILER=g++ \ -DCMAKE_MAKE_PROGRAM=make \ - -DBUILD_PLUGIN_PYTHON=ON \ + -DBUILD_PGPOINTCLOUD_TESTS=OFF \ -DBUILD_PLUGIN_CPD=OFF \ -DBUILD_PLUGIN_GREYHOUND=ON \ -DBUILD_PLUGIN_HEXBIN=ON \ - -DHEXER_INCLUDE_DIR=/usr/include/ \ - -DBUILD_PLUGIN_NITF=OFF \ -DBUILD_PLUGIN_ICEBRIDGE=ON \ + -DBUILD_PLUGIN_NITF=OFF \ -DBUILD_PLUGIN_PGPOINTCLOUD=OFF \ - -DBUILD_PGPOINTCLOUD_TESTS=OFF \ + -DBUILD_PLUGIN_PYTHON=ON \ -DBUILD_PLUGIN_SQLITE=ON \ + -DHEXER_INCLUDE_DIR=/usr/include/ \ -DWITH_LASZIP=OFF \ -DWITH_LAZPERF=ON \ -DWITH_TESTS=ON && \ @@ -186,8 +186,8 @@ ENV CXXFLAGS "$MYCXXFLAGS" # Configure compile and install GRASS GIS # wxGUI require -# --with-x # --with-nls +# --with-x ENV NUMTHREADS=4 RUN make distclean || echo "nothing to clean" RUN /src/grass_build/configure \ diff --git a/macosx/ReadMe.md b/macosx/ReadMe.md index 86fb1c0ba38..085c09c691b 100644 --- a/macosx/ReadMe.md +++ b/macosx/ReadMe.md @@ -172,6 +172,11 @@ just remove the `--prefix` and `--enable-macosx-app` flags)*: ```bash ./configure \ + --enable-macosx-app \ + --prefix=/Applications \ + --with-cxx \ + --with-fftw-includes=/Library/Frameworks/FFTW3.framework/unix/include \ + --with-fftw-libs=/Library/Frameworks/FFTW3.framework/unix/lib \ --with-freetype \ --with-freetype-includes= \ "/Library/Frameworks/FreeType.framework/unix/include/freetype2 \ @@ -179,36 +184,31 @@ just remove the `--prefix` and `--enable-macosx-app` flags)*: --with-freetype-libs=/Library/Frameworks/FreeType.framework/unix/lib \ --with-gdal=/Library/Frameworks/GDAL.framework/Programs/gdal-config \ --with-geos=/Library/Frameworks/GEOS.framework/Programs/geos-config \ - --with-proj \ - --with-proj-includes=/Library/Frameworks/PROJ.framework/unix/include \ - --with-proj-libs=/Library/Frameworks/PROJ.framework/unix/lib \ - --with-proj-share=/Library/Frameworks/PROJ.framework/Resources/proj \ --with-jpeg-includes=/Library/Frameworks/UnixImageIO.framework/unix/include \ --with-jpeg-libs=/Library/Frameworks/UnixImageIO.framework/unix/lib \ + --with-odbc \ + --with-opengl=aqua \ --with-png-includes=/Library/Frameworks/UnixImageIO.framework/unix/include \ --with-png-libs=/Library/Frameworks/UnixImageIO.framework/unix/lib \ - --with-tiff-includes=/Library/Frameworks/UnixImageIO.framework/unix/include \ - --with-tiff-libs=/Library/Frameworks/UnixImageIO.framework/unix/lib \ - --without-postgres \ - --without-mysql \ - --with-odbc \ + --with-proj \ + --with-proj-includes=/Library/Frameworks/PROJ.framework/unix/include \ + --with-proj-libs=/Library/Frameworks/PROJ.framework/unix/lib \ + --with-proj-share=/Library/Frameworks/PROJ.framework/Resources/proj \ --with-sqlite \ - --with-sqlite-libs=/Library/Frameworks/SQLite3.framework/unix/lib \ --with-sqlite-includes=/Library/Frameworks/SQLite3.framework/unix/include \ - --with-fftw-includes=/Library/Frameworks/FFTW3.framework/unix/include \ - --with-fftw-libs=/Library/Frameworks/FFTW3.framework/unix/lib \ - --with-cxx \ + --with-sqlite-libs=/Library/Frameworks/SQLite3.framework/unix/lib \ --with-tcltk-includes="/Library/Frameworks/Tcl.framework/Headers \ /Library/Frameworks/Tk.framework/Headers \ /Library/Frameworks/Tk.framework/PrivateHeaders" \ --with-tcltk-libs=/usr/local/lib \ + --with-tiff-includes=/Library/Frameworks/UnixImageIO.framework/unix/include \ + --with-tiff-libs=/Library/Frameworks/UnixImageIO.framework/unix/lib \ --with-x \ - --without-motif \ --without-glw \ - --with-opengl=aqua \ - --without-readline \ - --prefix=/Applications \ - --enable-macosx-app + --without-motif \ + --without-mysql \ + --without-postgres \ + --without-readline ``` That's a long line, but you have to be very explicit in the GRASS configure @@ -533,10 +533,21 @@ For i386: ```sh cd build-i386 -../configure --enable-shared --disable-static --disable-debug \ - --disable-ffserver --disable-network --enable-gpl --enable-pthreads \ - --enable-swscale --disable-vhook --disable-ffplay --disable-ffmpeg \ - --disable-amd3dnow --arch=i386 --extra-cflags="-arch i386" \ +../configure \ + --arch=i386 \ + --disable-amd3dnow \ + --disable-debug \ + --disable-ffmpeg \ + --disable-ffplay \ + --disable-ffserver \ + --disable-network \ + --disable-static \ + --disable-vhook \ + --enable-gpl \ + --enable-pthreads \ + --enable-shared \ + --enable-swscale \ + --extra-cflags="-arch i386" \ --extra-ldflags="-arch i386" ``` @@ -555,10 +566,21 @@ Now, the PPC build: ```sh cd ../build-ppc -../configure --enable-shared --disable-static --disable-debug \ - --disable-ffserver --disable-network --enable-gpl --enable-pthreads \ - --enable-swscale --disable-vhook --disable-ffplay --disable-ffmpeg \ - --enable-altivec --arch=ppc --extra-cflags="-arch ppc" \ +../configure \ + --arch=ppc \ + --disable-debug \ + --disable-ffmpeg \ + --disable-ffplay \ + --disable-ffserver \ + --disable-network \ + --disable-static \ + --disable-vhook \ + --enable-altivec \ + --enable-gpl \ + --enable-pthreads \ + --enable-shared \ + --enable-swscale \ + --extra-cflags="-arch ppc" \ --extra-ldflags="-arch ppc" make ``` @@ -572,10 +594,21 @@ For x86_64: ```sh cd build-x86_64 -../configure --enable-shared --disable-static --disable-debug \ - --disable-ffserver --disable-network --enable-gpl --enable-pthreads \ - --enable-swscale --disable-vhook --disable-ffplay --disable-ffmpeg \ - --disable-amd3dnow --arch=x86_64 --extra-cflags="-arch x86\_64" \ +../configure \ + --arch=x86_64 \ + --disable-amd3dnow \ + --disable-debug \ + --disable-ffmpeg \ + --disable-ffplay \ + --disable-ffserver \ + --disable-network \ + --disable-static \ + --disable-vhook \ + --enable-gpl \ + --enable-pthreads \ + --enable-shared \ + --enable-swscale \ + --extra-cflags="-arch x86\_64" \ --extra-ldflags="-arch x86_64" ``` @@ -588,10 +621,21 @@ And ppc64: ```sh cd ../build-ppc64 -../configure --enable-shared --disable-static --disable-debug \ - --disable-ffserver --disable-network --enable-gpl --enable-pthreads \ - --enable-swscale --disable-vhook --disable-ffplay --disable-ffmpeg \ - --enable-altivec --arch=ppc64 --extra-cflags="-arch ppc64" \ +../configure \ + --arch=ppc64 \ + --disable-debug \ + --disable-ffmpeg \ + --disable-ffplay \ + --disable-ffserver \ + --disable-network \ + --disable-static \ + --disable-vhook \ + --enable-altivec \ + --enable-gpl \ + --enable-pthreads \ + --enable-shared \ + --enable-swscale \ + --extra-cflags="-arch ppc64" \ --extra-ldflags="-arch ppc64" ``` diff --git a/mswindows/crosscompile.sh b/mswindows/crosscompile.sh index d1b834df008..ec43dcab689 100755 --- a/mswindows/crosscompile.sh +++ b/mswindows/crosscompile.sh @@ -129,17 +129,17 @@ CFLAGS="-g -O2 -Wall" \ CXXFLAGS="-g -O2 -Wall" \ LDFLAGS="-lcurses" \ ./configure \ ---with-nls \ ---with-readline \ ---with-freetype-includes=$freetype_include \ ---with-bzlib \ ---with-postgres \ ---with-pthread \ ---with-openmp \ --with-blas \ ---with-lapack \ +--with-bzlib \ +--with-freetype-includes=$freetype_include \ --with-geos \ +--with-lapack \ --with-netcdf \ +--with-nls \ +--with-openmp \ +--with-postgres \ +--with-pthread \ +--with-readline \ >> /dev/stdout make clean default @@ -159,10 +159,10 @@ fi build_arch=`sed -n '/^ARCH[ \t]*=/{s/^.*=[ \t]*//; p}' include/Make/Platform.make` for i in \ config.log \ - include/Make/Platform.make \ + error.log \ include/Make/Doxyfile_arch_html \ include/Make/Doxyfile_arch_latex \ - error.log \ + include/Make/Platform.make \ ; do cp -a $i $i.$build_arch done @@ -186,19 +186,19 @@ PKG_CONFIG=$mxe_bin-pkg-config \ ./configure \ --build=$build_arch \ --host=$arch \ ---with-nls \ ---with-readline \ ---with-freetype-includes=$mxe_shared/include/freetype2 \ ---with-bzlib \ ---with-postgres \ ---with-pthread \ ---with-openmp \ --with-blas \ ---with-lapack \ +--with-bzlib \ +--with-freetype-includes=$mxe_shared/include/freetype2 \ +--with-gdal=$mxe_shared/bin/gdal-config \ --with-geos=$mxe_shared/bin/geos-config \ +--with-lapack \ --with-netcdf=$mxe_shared/bin/nc-config \ ---with-gdal=$mxe_shared/bin/gdal-config \ +--with-nls \ --with-opengl=windows \ +--with-openmp \ +--with-postgres \ +--with-pthread \ +--with-readline \ >> /dev/stdout make clean default @@ -217,10 +217,10 @@ fi arch=`sed -n '/^ARCH[ \t]*=/{s/^.*=[ \t]*//; p}' include/Make/Platform.make` for i in \ config.log \ - include/Make/Platform.make \ + error.log \ include/Make/Doxyfile_arch_html \ include/Make/Doxyfile_arch_latex \ - error.log \ + include/Make/Platform.make \ ; do cp -a $i $i.$arch done @@ -307,8 +307,8 @@ for i in \ done for i in \ - proj \ gdal \ + proj \ ; do rm -rf $dist/share/$i cp -a $mxe_shared/share/$i $dist/share/$i diff --git a/mswindows/osgeo4w/build_osgeo4w.sh b/mswindows/osgeo4w/build_osgeo4w.sh index d38354d4b78..98ed16aac1e 100755 --- a/mswindows/osgeo4w/build_osgeo4w.sh +++ b/mswindows/osgeo4w/build_osgeo4w.sh @@ -22,49 +22,48 @@ export PYTHONHOME=${OSGEO4W_ROOT_MSYS}/apps/Python312 export ARCH=x86_64-w64-mingw32 ./configure \ + --bindir=${OSGEO4W_ROOT_MSYS}/bin \ + --enable-largefile \ + --enable-shared \ --host=${ARCH} \ - --with-libs="${OSGEO4W_ROOT_MSYS}/lib ${OSGEO4W_ROOT_MSYS}/bin" \ - --with-includes=${OSGEO4W_ROOT_MSYS}/include \ + --includedir=${OSGEO4W_ROOT_MSYS}/include \ --libexecdir=${OSGEO4W_ROOT_MSYS}/bin \ --prefix=${OSGEO4W_ROOT_MSYS}/apps/grass \ - --bindir=${OSGEO4W_ROOT_MSYS}/bin \ - --includedir=${OSGEO4W_ROOT_MSYS}/include \ - --without-x \ + --with-blas \ + --with-bzlib \ + --with-cairo \ + --with-cairo-includes=${OSGEO4W_ROOT_MSYS}/include \ + --with-cairo-ldflags="-L${SRC}/mswindows/osgeo4w/lib -lcairo" \ + --with-cairo-libs=$OSGEO4W_ROOT_MSYS/lib \ --with-cxx \ - --enable-shared \ - --enable-largefile \ - --with-openmp \ --with-fftw \ - --with-nls \ - --with-readline \ - --with-blas \ - --with-lapack \ --with-freetype \ --with-freetype-includes=${OSGEO4W_ROOT_MSYS}/include/freetype2 \ - --with-proj-share=${OSGEO4W_ROOT_MSYS}/share/proj \ - --with-proj-includes=${OSGEO4W_ROOT_MSYS}/include \ - --with-proj-libs=${OSGEO4W_ROOT_MSYS}/lib \ + --with-gdal=${SRC}/mswindows/osgeo4w/gdal-config \ + --with-geos=${SRC}/mswindows/osgeo4w/geos-config \ + --with-includes=${OSGEO4W_ROOT_MSYS}/include \ + --with-lapack \ + --with-liblas=${SRC}/mswindows/osgeo4w/liblas-config \ + --with-libs="${OSGEO4W_ROOT_MSYS}/lib ${OSGEO4W_ROOT_MSYS}/bin" \ + --with-netcdf=${OSGEO4W_ROOT_MSYS}/bin/nc-config \ + --with-nls \ + --with-odbc \ + --with-opengl=windows \ + --with-openmp \ --with-postgres \ --with-postgres-includes=${OSGEO4W_ROOT_MSYS}/include \ --with-postgres-libs=${OSGEO4W_ROOT_MSYS}/lib \ - --with-gdal=${SRC}/mswindows/osgeo4w/gdal-config \ - --with-geos=${SRC}/mswindows/osgeo4w/geos-config \ + --with-proj-includes=${OSGEO4W_ROOT_MSYS}/include \ + --with-proj-libs=${OSGEO4W_ROOT_MSYS}/lib \ + --with-proj-share=${OSGEO4W_ROOT_MSYS}/share/proj \ + --with-readline \ + --with-regex \ --with-sqlite \ --with-sqlite-includes=${OSGEO4W_ROOT_MSYS}/include \ --with-sqlite-libs=${OSGEO4W_ROOT_MSYS}/lib \ - --with-regex \ - --with-nls \ --with-zstd \ - --with-odbc \ - --with-cairo \ - --with-cairo-includes=${OSGEO4W_ROOT_MSYS}/include \ - --with-cairo-libs=$OSGEO4W_ROOT_MSYS/lib \ - --with-cairo-ldflags="-L${SRC}/mswindows/osgeo4w/lib -lcairo" \ - --with-opengl=windows \ - --with-bzlib \ - --with-liblas=${SRC}/mswindows/osgeo4w/liblas-config \ - --with-netcdf=${OSGEO4W_ROOT_MSYS}/bin/nc-config \ - --without-pdal + --without-pdal \ + --without-x make diff --git a/mswindows/osgeo4w/package.sh b/mswindows/osgeo4w/package.sh index b3113292c99..c189cf92c93 100755 --- a/mswindows/osgeo4w/package.sh +++ b/mswindows/osgeo4w/package.sh @@ -107,32 +107,32 @@ fi exec 3>&1 > >(tee mswindows/osgeo4w/package.log) 2>&1 DLLS=" - /mingw64/bin/zlib1.dll - /mingw64/bin/libbz2-1.dll - /mingw64/bin/libiconv-2.dll - /mingw64/bin/libfontconfig-1.dll - /mingw64/bin/libgfortran-5.dll - /mingw64/bin/libbrotlidec.dll + /mingw64/bin/libblas.dll /mingw64/bin/libbrotlicommon.dll - /mingw64/bin/libintl-8.dll - /mingw64/bin/libsystre-0.dll - /mingw64/bin/libtre-5.dll - /mingw64/bin/libwinpthread-1.dll + /mingw64/bin/libbrotlidec.dll + /mingw64/bin/libbz2-1.dll /mingw64/bin/libcairo-2.dll - /mingw64/bin/libpixman-1-0.dll - /mingw64/bin/libpng16-16.dll + /mingw64/bin/libfftw3-3.dll + /mingw64/bin/libfontconfig-1.dll /mingw64/bin/libfreetype-6.dll - /mingw64/bin/libharfbuzz-0.dll + /mingw64/bin/libgcc_s_seh-1.dll + /mingw64/bin/libgfortran-5.dll /mingw64/bin/libglib-2.0-0.dll /mingw64/bin/libgomp-1.dll /mingw64/bin/libgraphite2.dll - /mingw64/bin/libpcre-1.dll - /mingw64/bin/libstdc++-6.dll - /mingw64/bin/libgcc_s_seh-1.dll - /mingw64/bin/libfftw3-3.dll - /mingw64/bin/libblas.dll + /mingw64/bin/libharfbuzz-0.dll + /mingw64/bin/libiconv-2.dll + /mingw64/bin/libintl-8.dll /mingw64/bin/liblapack.dll + /mingw64/bin/libpcre-1.dll + /mingw64/bin/libpixman-1-0.dll + /mingw64/bin/libpng16-16.dll /mingw64/bin/libquadmath-0.dll + /mingw64/bin/libstdc++-6.dll + /mingw64/bin/libsystre-0.dll + /mingw64/bin/libtre-5.dll + /mingw64/bin/libwinpthread-1.dll + /mingw64/bin/zlib1.dll " if ! [ -f mswindows/osgeo4w/configure-stamp ]; then @@ -153,47 +153,47 @@ if ! [ -f mswindows/osgeo4w/configure-stamp ]; then log configure ./configure \ + --bindir=$OSGEO4W_ROOT_MSYS/bin \ + --enable-largefile \ + --enable-shared \ --host=x86_64-w64-mingw32 \ - --with-libs="$OSGEO4W_ROOT_MSYS/lib" \ - --with-includes=$OSGEO4W_ROOT_MSYS/include \ + --includedir=$OSGEO4W_ROOT_MSYS/include \ --libexecdir=$OSGEO4W_ROOT_MSYS/bin \ --prefix=$OSGEO4W_ROOT_MSYS/apps/grass \ - --bindir=$OSGEO4W_ROOT_MSYS/bin \ - --includedir=$OSGEO4W_ROOT_MSYS/include \ - --with-opengl=windows \ - --without-x \ + --with-blas \ + --with-bzlib \ + --with-cairo \ + --with-cairo-includes=$OSGEO4W_ROOT_MSYS/include \ + --with-cairo-ldflags="-L$PWD/mswindows/osgeo4w/lib -lcairo -lfontconfig" \ --with-cxx \ - --enable-shared \ - --enable-largefile \ --with-fftw \ --with-freetype \ --with-freetype-includes=/mingw64/include/freetype2 \ - --with-proj-share=$OSGEO4W_ROOT_MSYS/share/proj \ - --with-proj-includes=$OSGEO4W_ROOT_MSYS/include \ - --with-proj-libs=$OSGEO4W_ROOT_MSYS/lib \ + --with-gdal=$PWD/mswindows/osgeo4w/gdal-config \ + --with-geos=$PWD/mswindows/osgeo4w/geos-config \ + --with-includes=$OSGEO4W_ROOT_MSYS/include \ + --with-lapack \ + --with-lapack-includes=/mingw64/include \ + --with-liblas=$PWD/mswindows/osgeo4w/liblas-config \ + --with-libs="$OSGEO4W_ROOT_MSYS/lib" \ + --with-netcdf=${OSGEO4W_ROOT_MSYS}/bin/nc-config \ + --with-nls \ + --with-odbc \ + --with-opengl=windows \ + --with-openmp \ --with-postgres \ --with-postgres-includes=$OSGEO4W_ROOT_MSYS/include \ --with-postgres-libs=$PWD/mswindows/osgeo4w/lib \ - --with-gdal=$PWD/mswindows/osgeo4w/gdal-config \ - --with-geos=$PWD/mswindows/osgeo4w/geos-config \ + --with-proj-includes=$OSGEO4W_ROOT_MSYS/include \ + --with-proj-libs=$OSGEO4W_ROOT_MSYS/lib \ + --with-proj-share=$OSGEO4W_ROOT_MSYS/share/proj \ + --with-regex \ --with-sqlite \ --with-sqlite-includes=$OSGEO4W_ROOT_MSYS/include \ --with-sqlite-libs=$PWD/mswindows/osgeo4w/lib \ - --with-regex \ - --with-nls \ --with-zstd \ - --with-odbc \ - --with-netcdf=${OSGEO4W_ROOT_MSYS}/bin/nc-config \ - --with-blas \ - --with-lapack \ - --with-lapack-includes=/mingw64/include \ - --with-openmp \ - --with-cairo \ - --with-cairo-includes=$OSGEO4W_ROOT_MSYS/include \ - --with-cairo-ldflags="-L$PWD/mswindows/osgeo4w/lib -lcairo -lfontconfig" \ - --with-bzlib \ - --with-liblas=$PWD/mswindows/osgeo4w/liblas-config \ - --without-pdal + --without-pdal \ + --without-x touch mswindows/osgeo4w/configure-stamp fi diff --git a/package.nix b/package.nix index 3f1d03697c7..edf1e3e18a4 100644 --- a/package.nix +++ b/package.nix @@ -100,8 +100,8 @@ stdenv.mkDerivation (finalAttrs: { "--with-cxx" "--with-fftw" "--with-freetype" - "--with-geos" "--with-gdal" + "--with-geos" "--with-lapack" "--with-libsvm" "--with-nls" diff --git a/rpm/grass.spec b/rpm/grass.spec index 90c79bc939f..3e4675db621 100644 --- a/rpm/grass.spec +++ b/rpm/grass.spec @@ -1,8 +1,8 @@ -%global shortver 83 +%global shortver 84 %global macrosdir %(d=%{_rpmconfigdir}/macros.d; [ -d $d ] || d=%{_sysconfdir}/rpm; echo $d) Name: grass -Version: 8.3.0 +Version: 8.4.0 Release: 3%{?dist} Summary: GRASS GIS - Geographic Resources Analysis Support System @@ -37,64 +37,66 @@ BuildRequires: flexiblas-devel %else BuildRequires: blas-devel, lapack-devel %endif +BuildRequires: bzip2-devel BuildRequires: cairo-devel -BuildRequires: gcc-c++ BuildRequires: desktop-file-utils BuildRequires: fftw-devel BuildRequires: flex BuildRequires: freetype-devel +BuildRequires: gcc-c++ BuildRequires: gdal-devel BuildRequires: geos-devel BuildRequires: gettext BuildRequires: laszip-devel BuildRequires: libappstream-glib BuildRequires: libpng-devel +%if 0%{?rhel} && 0%{?rhel} == 7 +BuildRequires: postgresql-devel +%else +BuildRequires: libpq-devel +%endif BuildRequires: libtiff-devel BuildRequires: libXmu-devel -BuildRequires: mesa-libGL-devel -BuildRequires: mesa-libGLU-devel +BuildRequires: libzstd-devel +BuildRequires: make %if (0%{?rhel} > 7 || 0%{?fedora}) BuildRequires: mariadb-connector-c-devel openssl-devel %else BuildRequires: mysql-devel %endif +BuildRequires: mesa-libGL-devel +BuildRequires: mesa-libGLU-devel BuildRequires: netcdf-devel +BuildRequires: PDAL +BuildRequires: PDAL-devel +BuildRequires: PDAL-libs +BuildRequires: proj-devel BuildRequires: python3 %if 0%{?rhel} == 7 # EPEL7 -BuildRequires: python%{python3_version_nodots}-numpy -%else -BuildRequires: python3-numpy -%endif -%if 0%{?rhel} && 0%{?rhel} == 7 -BuildRequires: postgresql-devel +BuildRequires: python%{python3_version_nodots}-dateutil %else -BuildRequires: libpq-devel +BuildRequires: python3-dateutil %endif -BuildRequires: proj-devel +BuildRequires: python3-devel %if 0%{?rhel} == 7 # EPEL7 -BuildRequires: python%{python3_version_nodots}-dateutil +BuildRequires: python%{python3_version_nodots}-numpy %else -BuildRequires: python3-dateutil +BuildRequires: python3-numpy %endif -BuildRequires: python3-devel BuildRequires: python3-pillow -BuildRequires: PDAL -BuildRequires: PDAL-libs -BuildRequires: PDAL-devel BuildRequires: readline-devel BuildRequires: sqlite-devel BuildRequires: subversion BuildRequires: unixODBC-devel BuildRequires: zlib-devel -BuildRequires: bzip2-devel -BuildRequires: libzstd-devel -BuildRequires: make Requires: bzip2-libs -Requires: libzstd Requires: geos +Requires: libzstd +Requires: PDAL +Requires: PDAL-libs # fedora >= 34: Nothing %if (0%{?rhel} > 7 || 0%{?fedora} < 34) Requires: proj-datumgrid @@ -103,26 +105,23 @@ Requires: proj-datumgrid-world Requires: python3 %if 0%{?rhel} == 7 # EPEL7 -Requires: python%{python3_version_nodots}-numpy +Requires: python%{python3_version_nodots}-dateutil %else -Requires: python3-numpy +Requires: python3-dateutil %endif %if 0%{?rhel} == 7 # EPEL7 -Requires: python%{python3_version_nodots}-dateutil +Requires: python%{python3_version_nodots}-numpy %else -Requires: python3-dateutil +Requires: python3-numpy %endif Requires: python3-wxpython4 -Requires: PDAL -Requires: PDAL-libs %if "%{_lib}" == "lib" %global cpuarch 32 %else %global cpuarch 64 %endif - Requires: %{name}-libs%{?_isa} = %{version}-%{release} %description @@ -170,47 +169,50 @@ find -name \*.pl | xargs sed -i -e 's,#!/usr/bin/env perl,#!%{__perl},' %build %configure \ --prefix=%{_libdir} \ - --with-cxx \ - --with-tiff \ - --with-png \ - --with-postgres \ -%if 0%{?rhel} > 7 - --with-mysql=no \ -%else - --with-mysql \ -%endif - --with-opengl \ - --with-odbc \ - --with-fftw \ --with-blas \ - --with-lapack \ %if %{with flexiblas} --with-blas-includes=%{_includedir}/flexiblas \ - --with-lapack-includes=%{_includedir}/flexiblas \ %endif + --with-bzlib \ --with-cairo \ + --with-cairo-ldflags=-lfontconfig \ + --with-cxx \ + --with-fftw \ --with-freetype \ - --with-nls \ - --with-pdal \ - --with-readline \ - --with-regex \ - --with-openmp \ + --with-freetype-includes=%{_includedir}/freetype2 \ --with-gdal=%{_bindir}/gdal-config \ - --with-wxwidgets=%{_bindir}/wx-config \ --with-geos=%{_bindir}/geos-config \ - --with-netcdf=%{_bindir}/nc-config \ + --with-lapack \ +%if %{with flexiblas} + --with-lapack-includes=%{_includedir}/flexiblas \ +%endif +%if 0%{?rhel} > 7 + --with-mysql=no \ +%else + --with-mysql \ +%endif --with-mysql-includes=%{_includedir}/mysql \ %if (0%{?fedora} >= 27) --with-mysql-libs=%{_libdir} \ %else --with-mysql-libs=%{_libdir}/mysql \ %endif + --with-netcdf=%{_bindir}/nc-config \ + --with-nls \ + --with-odbc \ + --with-opengl \ + --with-openmp \ + --with-pdal \ + --with-png \ + --with-postgres \ --with-postgres-includes=%{_includedir}/pgsql \ - --with-cairo-ldflags=-lfontconfig \ - --with-freetype-includes=%{_includedir}/freetype2 \ - --with-bzlib \ - --with-zstd \ - --with-proj-share=%{_datadir}/proj + --with-proj-share=%{_datadir}/proj \ + --with-readline \ + --with-regex \ + --with-tiff \ + --with-wxwidgets=%{_bindir}/wx-config \ + --with-zstd + # .package_note hack for RHBZ #2084342 and RHBZ #2102895 sed -i "s+ -Wl,-dT,${RPM_BUILD_DIR}/grass-%{version}/.package_note-grass-%{version}-%{release}.%{_arch}.ld++g" include/Make/Platform.make @@ -338,6 +340,48 @@ fi %{_libdir}/%{name}%{shortver}/include %changelog +* Sat Oct 26 2024 Markus Neteler - 8.4.0-3 +- Sort requirements and flags (https://github.com/OSGeo/grass/pull/4563/ by Edouard Choinière) + +* Fri Sep 06 2024 Sandro Mani - 8.4.0-2 +- Rebuild (PDAL) + +* Sun Jul 28 2024 Markus Neteler - 8.4.0-1 +- Update to 8.4.0 + +* Thu Jul 18 2024 Fedora Release Engineering - 8.3.2-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild + +* Tue May 14 2024 Sandro Mani - 8.3.2-3 +- Rebuild (gdal) + +* Tue Mar 19 2024 Sandro Mani - 8.3.2-2 +- Rebuild (PDAL) + +* Thu Mar 07 2024 Markus Neteler - 8.3.2-1 +- Update to 8.3.2 (#2268514) + +* Wed Jan 24 2024 Fedora Release Engineering - 8.3.1-6 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild + +* Sat Jan 20 2024 Fedora Release Engineering - 8.3.1-5 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild + +* Wed Jan 3 2024 Florian Weimer - 8.3.1-4 +- Fix C compatibility issue in MySQL port handling + +* Wed Nov 15 2023 Sandro Mani - 8.3.1-3 +- Rebuild (gdal) + +* Sat Oct 28 2023 Markus Neteler 8.3.1-2 +- fix obsolete configure parameters + +* Thu Oct 26 2023 Fedora Release Monitoring - 8.3.1-1 +- Update to GRASS GIS 8.3.1 (#2246359) + +* Sat Oct 14 2023 Sandro Mani - 8.3.0-4 +- Rebuild (PDAL) + * Sun Aug 06 2023 Alexandre Detiste - 8.3.0-3 - Remove support for RHEL6: Grass is now Python3 only diff --git a/singularity/debian/singularityfile_debian b/singularity/debian/singularityfile_debian index 267d7a74ad5..5858bec6911 100644 --- a/singularity/debian/singularityfile_debian +++ b/singularity/debian/singularityfile_debian @@ -17,8 +17,8 @@ Singularity container for GRASS GIS to be run into GRASS main directory # Install useful libraries apt-get -y update apt-get -y install \ - build-essential \ bison \ + build-essential \ bzip2 \ cmake \ curl \ @@ -40,10 +40,10 @@ Singularity container for GRASS GIS to be run into GRASS main directory libgsl-dev \ libjpeg-dev \ libjsoncpp-dev \ + libncurses5-dev \ + libnetcdf-dev \ libopenblas-base \ libopenblas-dev \ - libnetcdf-dev \ - libncurses5-dev \ libopenjp2-7 \ libopenjp2-7-dev \ libpdal-dev \ @@ -94,29 +94,29 @@ Singularity container for GRASS GIS to be run into GRASS main directory GRASS_PYTHON=/usr/bin/python3 ./configure \ --enable-largefile \ - --with-cxx \ - --with-nls \ - --with-readline \ - --with-sqlite \ --with-bzlib \ - --with-zstd \ --with-cairo \ --with-cairo-ldflags=-lfontconfig \ + --with-cxx \ + --with-fftw \ --with-freetype \ --with-freetype-includes="/usr/include/freetype2/" \ - --with-fftw \ + --with-geos=/usr/bin/geos-config \ --with-netcdf \ + --with-nls \ --with-pdal \ - --with-proj \ - --with-proj-share=/usr/share/proj \ - --with-geos=/usr/bin/geos-config \ --with-postgres \ --with-postgres-includes="/usr/include/postgresql" \ + --with-proj \ + --with-proj-share=/usr/share/proj \ + --with-readline \ + --with-sqlite \ + --with-zstd \ + --without-ffmpeg \ --without-mysql \ --without-odbc \ - --without-openmp \ - --without-ffmpeg \ - --without-opengl + --without-opengl \ + --without-openmp make -j 2 && make install && ldconfig # Create generic GRASS GIS binary name regardless of version number ln -sf `find /usr/local/bin -name "grass??" | sort | tail -n 1` /usr/local/bin/grass diff --git a/utils/svn_name_git_author.csv b/utils/svn_name_git_author.csv index 4811a539a82..ba1ac70d21d 100644 --- a/utils/svn_name_git_author.csv +++ b/utils/svn_name_git_author.csv @@ -130,7 +130,6 @@ paul,Paul Kelly pcav,Paolo Cavallini pesekon2,Ondřej Pešek pierreroudier,Pierre Roudier -rodrigopitanga,Rodrigo Rodrigues Da Silva pkelly,Paul Kelly pmarcondes,Paulo Marcondes @@ -146,6 +145,7 @@ robertomarzocchi,Roberto Marzocchi roberto,Roberto Flor roberto,Roberto Micarelli Robifag,Roberta Fagandini +rodrigopitanga,Rodrigo Rodrigues Da Silva roger,Roger S. Miller rorschach,Ben Hur sbl,Stefan Blumentrath diff --git a/utils/svn_name_github_name.csv b/utils/svn_name_github_name.csv index 55504c24d67..97f0f859267 100644 --- a/utils/svn_name_github_name.csv +++ b/utils/svn_name_github_name.csv @@ -1,56 +1,56 @@ svn_name,github_name 1gray,1gray aghisla,aghisla -benjamin,benducke +annakrat,petrasovaa +barton,cmbarton benducke,benducke +benjamin,benducke bernhard,bernhardreiter -cnielsen,cdwren -pvanbosgeo,ecodiv -radim,blazek -barton,cmbarton -cmbarton,cmbarton -michael,cmbarton -mic,zwischenloesung -maciej,czka -msieczka,czka +cepicky,jachym +chemin,YannChemin +cho,HuidaeCho clements,glynnc +cmbarton,cmbarton +cnielsen,cdwren +frankw,warmerdam glynn,glynnc hamish,HamishB -hellik,hellik +hcho,HuidaeCho helena,hmitaso -soeren,huhabla +hellik,hellik huhabla,huhabla -cho,HuidaeCho -hcho,HuidaeCho +isaacullah,isaacullah jachym,jachym -cepicky,jachym -william,kyngchaos kyngchaos,kyngchaos landa,landam -martinl,landam ltoma,lauratoma lucadelu,lucadelu +maciej,czka madi,madi -mmetz,metzm +markus,neteler +martinl,landam +michael,cmbarton +mic,zwischenloesung mlennert,mlennert +mmetz,metzm moritz,mlennert -markus,neteler +msieczka,czka neteler,neteler nikosa,NikosAlexandris -sbl,ninsbl -turek,ostepok paulo,paulomarcondes -annakrat,petrasovaa +pvanbosgeo,ecodiv +radim,blazek rantolin,rantolin robertoa,rantolin +sbl,ninsbl sholl,sholl +soeren,huhabla stephan,sholl +turek,ostepok +ullah,isaacullah veroandreo,veroandreo -frankw,warmerdam warmerdam,warmerdam wenzeslaus,wenzeslaus -chemin,YannChemin +william,kyngchaos ychemin,YannChemin zarch,zarch -ullah,isaacullah -isaacullah,isaacullah diff --git a/utils/vagrant/compile.sh b/utils/vagrant/compile.sh index 058eb70b1f9..5e1abc01735 100755 --- a/utils/vagrant/compile.sh +++ b/utils/vagrant/compile.sh @@ -19,31 +19,31 @@ cd /vagrant if [ ! -f "include/Make/Platform.make" ] ; then ./configure \ --bindir=/usr/bin \ - --srcdir=/vagrant \ - --prefix=/usr/lib \ + --enable-largefile \ --enable-shared \ - --with-postgres \ - --with-mysql \ + --prefix=/usr/lib \ + --srcdir=/vagrant \ + --with-blas \ + --with-bzlib \ + --with-cairo \ --with-cxx \ - --with-x \ + --with-freetype \ + --with-freetype-includes=/usr/include/freetype2 \ --with-gdal \ --with-geos \ - --with-freetype \ - --with-readline \ + --with-lapack \ + --with-mysql \ + --with-mysql-includes=`mysql_config --include | sed -e 's/-I//'` \ + --with-netcdf \ --with-nls \ --with-odbc \ - --with-netcdf \ - --with-blas \ - --with-lapack \ - --with-sqlite \ - --enable-largefile \ - --with-freetype-includes=/usr/include/freetype2 \ + --with-postgres \ --with-postgres-includes=`pg_config --includedir` \ - --with-mysql-includes=`mysql_config --include | sed -e 's/-I//'` \ --with-proj-share=/usr/share/proj \ - --with-cairo \ --with-pthread \ - --with-bzlib \ + --with-readline \ + --with-sqlite \ + --with-x \ --without-pdal fi From 35ebcb33a3275f335f6a86b283e8d5a65676a4e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edouard=20Choini=C3=A8re?= <27212526+echoix@users.noreply.github.com> Date: Sun, 3 Nov 2024 10:59:24 -0500 Subject: [PATCH 49/50] python: Add typing to RPC server and Messenger (#4639) * grass.pygrass.rpc.base: Add typing annotations for lock and conn * grass.pygrass.rpc.base: Use context manager for lock in dummy_server * grass.pygrass.rpc.base: Use context manager for threadLock in RPCServerBase * grass.pygrass.rpc.base: Remove release lock in context manager * grass.pygrass.rpc.base: Add more typing annotations * grass.pygrass.rpc.base: Check for None to satisfy mypy type checking * grass.pygrass.rpc.base: Remove release lock in context managers, as they would be released when unlocked (RuntimeError: release unlocked lock) * grass.pygrass.rpc.base: Sort imports * grass.temporal.c_libraries_interface: Use context manager for lock in c_library_server * grass.temporal.c_libraries_interface: Add typing annotations for lock and conn * grass.pygrass.rpc.base: Change date of file header * grass.pygrass.rpc.base: Update docs of conn argument to mention that it is a multiprocessing.Connection object obtained from multiprocessing.Pipe * grass.temporal.c_libraries_interface: Change date of file header * grass.pygrass.rpc: Sort imports * grass.temporal.c_libraries_interface: Sort imports * Update docs of conn argument to mention that it is a multiprocessing.Connection object obtained from multiprocessing.Pipe * grass.pygrass.messages: Sort imports * Update docs of conn argument to mention that it is a multiprocessing.connection.Connection object obtained from multiprocessing.Pipe * grass.pygrass.rpc: Use context manager to acquire and release the lock * Fix typo in python/grass/pygrass/messages/testsuite/test_pygrass_messages_doctests.py * grass.pygrass.messages: Fix typo in message_server * grass.pygrass.messages: Missing "IMPORTANT" message type in message_server * grass.pygrass.messages: Add return type to get_msgr * grass.pygrass.messages: Add types to signatures in Messenger class and rest of file * grass.pygrass.messages: Use context manager for acquiring the lock in message_server() * grass.pygrass.messages: Add types to message_types to track missing conditions * grass.pygrass.messages: Extract message only for message_types where the variable is used * grass.pygrass.messages: Add parameter descriptions to percent(self, n, d, s) * grass.pygrass.messages: Initialize Messenger fields without setting them to None * grass.pygrass.messages: Fix typo * grass.pygrass.messages: Change date of file header --- python/grass/pygrass/messages/__init__.py | 158 +++++++++--------- .../test_pygrass_messages_doctests.py | 2 +- python/grass/pygrass/rpc/__init__.py | 29 ++-- python/grass/pygrass/rpc/base.py | 107 ++++++------ .../grass/temporal/c_libraries_interface.py | 108 +++++++----- 5 files changed, 223 insertions(+), 181 deletions(-) diff --git a/python/grass/pygrass/messages/__init__.py b/python/grass/pygrass/messages/__init__.py index 54d9af1b1c5..b5fe052883c 100644 --- a/python/grass/pygrass/messages/__init__.py +++ b/python/grass/pygrass/messages/__init__.py @@ -6,34 +6,45 @@ Fast and exit-safe interface to GRASS C-library message functions -(C) 2013 by the GRASS Development Team +(C) 2013-2024 by the GRASS Development Team This program is free software under the GNU General Public License (>=v2). Read the file COPYING that comes with GRASS for details. -@author Soeren Gebbert +@author Soeren Gebbert, Edouard Choinière """ +from __future__ import annotations + import sys -from multiprocessing import Process, Lock, Pipe +from multiprocessing import Lock, Pipe, Process +from typing import TYPE_CHECKING, Literal, NoReturn import grass.lib.gis as libgis - from grass.exceptions import FatalError +if TYPE_CHECKING: + from multiprocessing.connection import Connection + from multiprocessing.context import _LockLike + + _MessagesLiteral = Literal[ + "INFO", "IMPORTANT", "VERBOSE", "WARNING", "ERROR", "FATAL" + ] + -def message_server(lock, conn): +def message_server(lock: _LockLike, conn: Connection) -> NoReturn: """The GRASS message server function designed to be a target for multiprocessing.Process :param lock: A multiprocessing.Lock - :param conn: A multiprocessing.Pipe + :param conn: A multiprocessing.connection.Connection object obtained from + multiprocessing.Pipe This function will use the G_* message C-functions from grass.lib.gis to provide an interface to the GRASS C-library messaging system. - The data that is send through the pipe must provide an + The data that is sent through the pipe must provide an identifier string to specify which C-function should be called. The following identifiers are supported: @@ -52,9 +63,9 @@ def message_server(lock, conn): - "FATAL" Calls G_fatal_error(), this functions is only for testing purpose - The that is end through the pipe must be a list of values: + The data that is sent through the pipe must be a list of values: - - Messages: ["INFO|VERBOSE|WARNING|ERROR|FATAL", "MESSAGE"] + - Messages: ["INFO|IMPORTANT|VERBOSE|WARNING|ERROR|FATAL", "MESSAGE"] - Debug: ["DEBUG", level, "MESSAGE"] - Percent: ["PERCENT", n, d, s] @@ -65,44 +76,42 @@ def message_server(lock, conn): # Avoid busy waiting conn.poll(None) data = conn.recv() - message_type = data[0] + message_type: Literal[_MessagesLiteral, "DEBUG", "PERCENT", "STOP"] = data[0] # Only one process is allowed to write to stderr - lock.acquire() - - # Stop the pipe and the infinite loop - if message_type == "STOP": - conn.close() - lock.release() - libgis.G_debug(1, "Stop messenger server") - sys.exit() - - message = data[1] - - if message_type == "PERCENT": - n = int(data[1]) - d = int(data[2]) - s = int(data[3]) - libgis.G_percent(n, d, s) - elif message_type == "DEBUG": - level = data[1] - message = data[2] - libgis.G_debug(level, message) - elif message_type == "VERBOSE": - libgis.G_verbose_message(message) - elif message_type == "INFO": - libgis.G_message(message) - elif message_type == "IMPORTANT": - libgis.G_important_message(message) - elif message_type == "WARNING": - libgis.G_warning(message) - elif message_type == "ERROR": - libgis.G_important_message("ERROR: %s" % message) - # This is for testing only - elif message_type == "FATAL": - libgis.G_fatal_error(message) - - lock.release() + with lock: + # Stop the pipe and the infinite loop + if message_type == "STOP": + conn.close() + libgis.G_debug(1, "Stop messenger server") + sys.exit() + + if message_type == "PERCENT": + n = int(data[1]) + d = int(data[2]) + s = int(data[3]) + libgis.G_percent(n, d, s) + continue + if message_type == "DEBUG": + level = int(data[1]) + message_debug = data[2] + libgis.G_debug(level, message_debug) + continue + + message: str = data[1] + if message_type == "VERBOSE": + libgis.G_verbose_message(message) + elif message_type == "INFO": + libgis.G_message(message) + elif message_type == "IMPORTANT": + libgis.G_important_message(message) + elif message_type == "WARNING": + libgis.G_warning(message) + elif message_type == "ERROR": + libgis.G_important_message("ERROR: %s" % message) + # This is for testing only + elif message_type == "FATAL": + libgis.G_fatal_error(message) class Messenger: @@ -165,14 +174,19 @@ class Messenger: """ - def __init__(self, raise_on_error=False): - self.client_conn = None - self.server_conn = None - self.server = None + client_conn: Connection + server_conn: Connection + server: Process + + def __init__(self, raise_on_error: bool = False) -> None: self.raise_on_error = raise_on_error - self.start_server() + self.client_conn, self.server_conn = Pipe() + self.lock = Lock() + self.server = Process(target=message_server, args=(self.lock, self.server_conn)) + self.server.daemon = True + self.server.start() - def start_server(self): + def start_server(self) -> None: """Start the messenger server and open the pipe""" self.client_conn, self.server_conn = Pipe() self.lock = Lock() @@ -180,7 +194,7 @@ def start_server(self): self.server.daemon = True self.server.start() - def _check_restart_server(self): + def _check_restart_server(self) -> None: """Restart the server if it was terminated""" if self.server.is_alive() is True: return @@ -189,55 +203,50 @@ def _check_restart_server(self): self.start_server() self.warning("Needed to restart the messenger server") - def message(self, message): + def message(self, message: str) -> None: """Send a message to stderr :param message: the text of message - :type message: str G_message() will be called in the messenger server process """ self._check_restart_server() self.client_conn.send(["INFO", message]) - def verbose(self, message): + def verbose(self, message: str) -> None: """Send a verbose message to stderr :param message: the text of message - :type message: str G_verbose_message() will be called in the messenger server process """ self._check_restart_server() self.client_conn.send(["VERBOSE", message]) - def important(self, message): + def important(self, message: str) -> None: """Send an important message to stderr :param message: the text of message - :type message: str G_important_message() will be called in the messenger server process """ self._check_restart_server() self.client_conn.send(["IMPORTANT", message]) - def warning(self, message): + def warning(self, message: str) -> None: """Send a warning message to stderr :param message: the text of message - :type message: str G_warning() will be called in the messenger server process """ self._check_restart_server() self.client_conn.send(["WARNING", message]) - def error(self, message): + def error(self, message: str) -> None: """Send an error message to stderr :param message: the text of message - :type message: str G_important_message() with an additional "ERROR:" string at the start will be called in the messenger server process @@ -245,11 +254,10 @@ def error(self, message): self._check_restart_server() self.client_conn.send(["ERROR", message]) - def fatal(self, message): + def fatal(self, message: str) -> NoReturn: """Send an error message to stderr, call sys.exit(1) or raise FatalError :param message: the text of message - :type message: str This function emulates the behavior of G_fatal_error(). It prints an error message to stderr and calls sys.exit(1). If raise_on_error @@ -264,30 +272,29 @@ def fatal(self, message): raise FatalError(message) sys.exit(1) - def debug(self, level, message): + def debug(self, level: int, message: str) -> None: """Send a debug message to stderr :param message: the text of message - :type message: str G_debug() will be called in the messenger server process """ self._check_restart_server() self.client_conn.send(["DEBUG", level, message]) - def percent(self, n, d, s): + def percent(self, n: int, d: int, s: int) -> None: """Send a percentage to stderr - :param message: the text of message - :type message: str - + :param n: The current element + :param d: Total number of elements + :param s: Increment size G_percent() will be called in the messenger server process """ self._check_restart_server() self.client_conn.send(["PERCENT", n, d, s]) - def stop(self): + def stop(self) -> None: """Stop the messenger server and close the pipe""" if self.server is not None and self.server.is_alive(): self.client_conn.send( @@ -300,12 +307,11 @@ def stop(self): if self.client_conn is not None: self.client_conn.close() - def set_raise_on_error(self, raise_on_error=True): + def set_raise_on_error(self, raise_on_error: bool = True) -> None: """Set the fatal error behavior :param raise_on_error: if True a FatalError exception will be raised instead of calling sys.exit(1) - :type raise_on_error: bool - If raise_on_error == True, a FatalError exception will be raised if fatal() is called @@ -315,7 +321,7 @@ def set_raise_on_error(self, raise_on_error=True): """ self.raise_on_error = raise_on_error - def get_raise_on_error(self): + def get_raise_on_error(self) -> bool: """Get the fatal error behavior :returns: True if a FatalError exception will be raised or False if @@ -323,7 +329,7 @@ def get_raise_on_error(self): """ return self.raise_on_error - def test_fatal_error(self, message): + def test_fatal_error(self, message: str) -> None: """Force the messenger server to call G_fatal_error()""" import time @@ -338,7 +344,7 @@ def get_msgr( ], *args, **kwargs, -): +) -> Messenger: """Return a Messenger instance. :returns: the Messenger instance. diff --git a/python/grass/pygrass/messages/testsuite/test_pygrass_messages_doctests.py b/python/grass/pygrass/messages/testsuite/test_pygrass_messages_doctests.py index 72c20873cd6..67cd9cb3aed 100644 --- a/python/grass/pygrass/messages/testsuite/test_pygrass_messages_doctests.py +++ b/python/grass/pygrass/messages/testsuite/test_pygrass_messages_doctests.py @@ -28,7 +28,7 @@ def load_tests(loader, tests, ignore): # TODO: this must be somewhere when doctest is called, not here - # TODO: ultimate solution is not to use _ as a buildin in lib/python + # TODO: ultimate solution is not to use _ as a builtin in lib/python # for now it is the only place where it works grass.gunittest.utils.do_doctest_gettext_workaround() # this should be called at some top level diff --git a/python/grass/pygrass/rpc/__init__.py b/python/grass/pygrass/rpc/__init__.py index a6ab19b9369..e95c3453250 100644 --- a/python/grass/pygrass/rpc/__init__.py +++ b/python/grass/pygrass/rpc/__init__.py @@ -11,17 +11,18 @@ """ import sys -from multiprocessing import Process, Lock, Pipe from ctypes import CFUNCTYPE, c_void_p +from multiprocessing import Lock, Pipe, Process +import grass.lib.gis as libgis from grass.exceptions import FatalError +from grass.pygrass import utils +from grass.pygrass.gis.region import Region +from grass.pygrass.raster import RasterRow, raster2numpy_img from grass.pygrass.vector import VectorTopo from grass.pygrass.vector.basic import Bbox -from grass.pygrass.raster import RasterRow, raster2numpy_img -import grass.lib.gis as libgis + from .base import RPCServerBase -from grass.pygrass.gis.region import Region -from grass.pygrass import utils ############################################################################### ############################################################################### @@ -41,7 +42,8 @@ def _get_raster_image_as_np(lock, conn, data): a numpy array with RGB or Gray values. :param lock: A multiprocessing.Lock instance - :param conn: A multiprocessing.Pipe instance used to send True or False + :param conn: A multiprocessing.connection.Connection object obtained from + multiprocessing.Pipe used to send True or False :param data: The list of data entries [function_id, raster_name, extent, color] """ array = None @@ -87,7 +89,8 @@ def _get_vector_table_as_dict(lock, conn, data): """Get the table of a vector map layer as dictionary :param lock: A multiprocessing.Lock instance - :param conn: A multiprocessing.Pipe instance used to send True or False + :param conn: A multiprocessing.connection.Connection object obtained from + multiprocessing.Pipe used to send True or False :param data: The list of data entries [function_id, name, mapset, where] """ @@ -128,7 +131,8 @@ def _get_vector_features_as_wkb_list(lock, conn, data): point, centroid, line, boundary, area :param lock: A multiprocessing.Lock instance - :param conn: A multiprocessing.Pipe instance used to send True or False + :param conn: A multiprocessing.connection.Connection object obtained from + multiprocessing.Pipe used to send True or False :param data: The list of data entries [function_id,name,mapset,extent, feature_type, field] @@ -196,7 +200,8 @@ def data_provider_server(lock, conn): multiprocessing.Process :param lock: A multiprocessing.Lock - :param conn: A multiprocessing.Pipe + :param conn: A multiprocessing.connection.Connection object obtained from + multiprocessing.Pipe """ def error_handler(data): @@ -229,9 +234,8 @@ def error_handler(data): # Avoid busy waiting conn.poll(None) data = conn.recv() - lock.acquire() - functions[data[0]](lock, conn, data) - lock.release() + with lock: + functions[data[0]](lock, conn, data) test_vector_name = "data_provider_vector_map" @@ -461,6 +465,7 @@ def get_vector_features_as_wkb_list( if __name__ == "__main__": import doctest + from grass.pygrass.modules import Module Module("g.region", n=40, s=0, e=40, w=0, res=10) diff --git a/python/grass/pygrass/rpc/base.py b/python/grass/pygrass/rpc/base.py index 38cf48c1581..c436300c170 100644 --- a/python/grass/pygrass/rpc/base.py +++ b/python/grass/pygrass/rpc/base.py @@ -2,7 +2,7 @@ Fast and exit-safe interface to PyGRASS Raster and Vector layer using multiprocessing -(C) 2015 by the GRASS Development Team +(C) 2015-2024 by the GRASS Development Team This program is free software under the GNU General Public License (>=v2). Read the file COPYING that comes with GRASS for details. @@ -10,35 +10,42 @@ :authors: Soeren Gebbert """ -from grass.exceptions import FatalError -import time -import threading -import sys -from multiprocessing import Process, Lock, Pipe +from __future__ import annotations + import logging +import sys +import threading +import time +from multiprocessing import Lock, Pipe, Process +from typing import TYPE_CHECKING, NoReturn + +from grass.exceptions import FatalError + +if TYPE_CHECKING: + from multiprocessing.connection import Connection + from multiprocessing.synchronize import _LockLike ############################################################################### -def dummy_server(lock, conn): +def dummy_server(lock: _LockLike, conn: Connection) -> NoReturn: """Dummy server process :param lock: A multiprocessing.Lock - :param conn: A multiprocessing.Pipe + :param conn: A multiprocessing.connection.Connection object obtained from + multiprocessing.Pipe """ while True: # Avoid busy waiting conn.poll(None) data = conn.recv() - lock.acquire() - if data[0] == 0: - conn.close() - lock.release() - sys.exit() - if data[0] == 1: - raise Exception("Server process intentionally killed by exception") - lock.release() + with lock: + if data[0] == 0: + conn.close() + sys.exit() + if data[0] == 1: + raise Exception("Server process intentionally killed by exception") class RPCServerBase: @@ -82,12 +89,12 @@ class RPCServerBase: """ - def __init__(self): - self.client_conn = None - self.server_conn = None + def __init__(self) -> None: + self.client_conn: Connection | None = None + self.server_conn: Connection | None = None self.queue = None self.server = None - self.checkThread = None + self.checkThread: threading.Thread | None = None self.threadLock = threading.Lock() self.start_server() self.start_checker_thread() @@ -96,10 +103,10 @@ def __init__(self): # logging.basicConfig(level=logging.DEBUG) def is_server_alive(self): - return self.server.is_alive() + return self.server.is_alive() if self.server is not None else False def is_check_thread_alive(self): - return self.checkThread.is_alive() + return self.checkThread.is_alive() if self.checkThread is not None else False def start_checker_thread(self): if self.checkThread is not None and self.checkThread.is_alive(): @@ -111,21 +118,19 @@ def start_checker_thread(self): self.checkThread.start() def stop_checker_thread(self): - self.threadLock.acquire() - self.stopThread = True - self.threadLock.release() - self.checkThread.join(None) + with self.threadLock: + self.stopThread = True + if self.checkThread is not None: + self.checkThread.join(None) def thread_checker(self): """Check every 200 micro seconds if the server process is alive""" while True: time.sleep(0.2) self._check_restart_server(caller="Server check thread") - self.threadLock.acquire() - if self.stopThread is True: - self.threadLock.release() - return - self.threadLock.release() + with self.threadLock: + if self.stopThread is True: + return def start_server(self): """This function must be re-implemented in the subclasses""" @@ -140,24 +145,25 @@ def start_server(self): def check_server(self): self._check_restart_server() - def _check_restart_server(self, caller="main thread"): + def _check_restart_server(self, caller="main thread") -> None: """Restart the server if it was terminated""" logging.debug("Check libgis server restart") - self.threadLock.acquire() - if self.server.is_alive() is True: - self.threadLock.release() - return - self.client_conn.close() - self.server_conn.close() - self.start_server() - - if self.stopped is not True: - logging.warning( - "Needed to restart the libgis server, caller: {caller}", caller=caller - ) + with self.threadLock: + if self.server is not None and self.server.is_alive() is True: + return + if self.client_conn is not None: + self.client_conn.close() + if self.server_conn is not None: + self.server_conn.close() + self.start_server() + + if self.stopped is not True: + logging.warning( + "Needed to restart the libgis server, caller: {caller}", + caller=caller, + ) - self.threadLock.release() self.stopped = False def safe_receive(self, message): @@ -184,11 +190,12 @@ def stop(self): self.stop_checker_thread() if self.server is not None and self.server.is_alive(): - self.client_conn.send( - [ - 0, - ] - ) + if self.client_conn is not None: + self.client_conn.send( + [ + 0, + ] + ) self.server.terminate() if self.client_conn is not None: self.client_conn.close() diff --git a/python/grass/temporal/c_libraries_interface.py b/python/grass/temporal/c_libraries_interface.py index 0d24fc0f732..2b7f9f033f3 100644 --- a/python/grass/temporal/c_libraries_interface.py +++ b/python/grass/temporal/c_libraries_interface.py @@ -2,7 +2,7 @@ Fast and exit-safe interface to GRASS C-library functions using ctypes and multiprocessing -(C) 2013 by the GRASS Development Team +(C) 2013-2024 by the GRASS Development Team This program is free software under the GNU General Public License (>=v2). Read the file COPYING that comes with GRASS for details. @@ -10,11 +10,14 @@ :authors: Soeren Gebbert """ +from __future__ import annotations + import logging import sys from ctypes import CFUNCTYPE, POINTER, byref, c_int, c_void_p, cast from datetime import datetime from multiprocessing import Lock, Pipe, Process +from typing import TYPE_CHECKING import grass.lib.date as libdate import grass.lib.gis as libgis @@ -29,6 +32,10 @@ from grass.pygrass.vector import VectorTopo from grass.script.utils import encode +if TYPE_CHECKING: + from multiprocessing.connection import Connection + from multiprocessing.synchronize import _LockLike + ############################################################################### @@ -63,12 +70,13 @@ class RPCDefs: ############################################################################### -def _read_map_full_info(lock, conn, data): +def _read_map_full_info(lock: _LockLike, conn: Connection, data): """Read full map specific metadata from the spatial database using PyGRASS functions. :param lock: A multiprocessing.Lock instance - :param conn: A multiprocessing.Pipe instance used to send True or False + :param conn: A multiprocessing.connection.Connection object obtained from + multiprocessing.Pipe used to send True or False :param data: The list of data entries [function_id, maptype, name, mapset] """ info = None @@ -190,7 +198,7 @@ def _read_vector_full_info(name, mapset, layer=None): return info -def _fatal_error(lock, conn, data): +def _fatal_error(lock: _LockLike, conn: Connection, data): """Calls G_fatal_error()""" libgis.G_fatal_error("Fatal Error in C library server") @@ -198,11 +206,12 @@ def _fatal_error(lock, conn, data): ############################################################################### -def _get_mapset(lock, conn, data): +def _get_mapset(lock: _LockLike, conn: Connection, data): """Return the current mapset :param lock: A multiprocessing.Lock instance - :param conn: A multiprocessing.Pipe instance used to send True or False + :param conn: A multiprocessing.connection.Connection object obtained from + multiprocessing.Pipe used to send True or False :param data: The mapset as list entry 1 [function_id] :returns: Name of the current mapset @@ -214,11 +223,12 @@ def _get_mapset(lock, conn, data): ############################################################################### -def _get_location(lock, conn, data): +def _get_location(lock: _LockLike, conn: Connection, data): """Return the current location :param lock: A multiprocessing.Lock instance - :param conn: A multiprocessing.Pipe instance used to send True or False + :param conn: A multiprocessing.connection.Connection object obtained from + multiprocessing.Pipe used to send True or False :param data: The mapset as list entry 1 [function_id] :returns: Name of the location @@ -230,11 +240,12 @@ def _get_location(lock, conn, data): ############################################################################### -def _get_gisdbase(lock, conn, data): +def _get_gisdbase(lock: _LockLike, conn: Connection, data): """Return the current gisdatabase :param lock: A multiprocessing.Lock instance - :param conn: A multiprocessing.Pipe instance used to send True or False + :param conn: A multiprocessing.connection.Connection object obtained from + multiprocessing.Pipe used to send True or False :param data: The mapset as list entry 1 [function_id] :returns: Name of the gisdatabase @@ -246,11 +257,12 @@ def _get_gisdbase(lock, conn, data): ############################################################################### -def _get_driver_name(lock, conn, data): +def _get_driver_name(lock: _LockLike, conn: Connection, data): """Return the temporal database driver of a specific mapset :param lock: A multiprocessing.Lock instance - :param conn: A multiprocessing.Pipe instance used to send True or False + :param conn: A multiprocessing.connection.Connection object obtained from + multiprocessing.Pipe used to send True or False :param data: The mapset as list entry 1 [function_id, mapset] :returns: Name of the driver or None if no temporal database present @@ -264,11 +276,12 @@ def _get_driver_name(lock, conn, data): ############################################################################### -def _get_database_name(lock, conn, data): +def _get_database_name(lock: _LockLike, conn: Connection, data): """Return the temporal database name of a specific mapset :param lock: A multiprocessing.Lock instance - :param conn: A multiprocessing.Pipe instance used to send True or False + :param conn: A multiprocessing.connection.Connection object obtained from + multiprocessing.Pipe used to send True or False :param data: The mapset as list entry 1 [function_id, mapset] :returns: Name of the database or None if no temporal database present @@ -293,11 +306,12 @@ def _get_database_name(lock, conn, data): ############################################################################### -def _available_mapsets(lock, conn, data): +def _available_mapsets(lock: _LockLike, conn: Connection, data): """Return all available mapsets the user can access as a list of strings :param lock: A multiprocessing.Lock instance - :param conn: A multiprocessing.Pipe instance used to send True or False + :param conn: A multiprocessing.connection.Connection object obtained from + multiprocessing.Pipe used to send True or False :param data: The list of data entries [function_id] :returns: Names of available mapsets as list of strings @@ -349,12 +363,13 @@ def _available_mapsets(lock, conn, data): ############################################################################### -def _has_timestamp(lock, conn, data): +def _has_timestamp(lock: _LockLike, conn: Connection, data): """Check if the file based GRASS timestamp is present and send True or False using the provided pipe. :param lock: A multiprocessing.Lock instance - :param conn: A multiprocessing.Pipe instance used to send True or False + :param conn: A multiprocessing.connection.Connection object obtained from + multiprocessing.Pipe used to send True or False :param data: The list of data entries [function_id, maptype, name, mapset, layer] @@ -381,7 +396,7 @@ def _has_timestamp(lock, conn, data): ############################################################################### -def _read_timestamp(lock, conn, data): +def _read_timestamp(lock: _LockLike, conn: Connection, data): """Read the file based GRASS timestamp and send the result using the provided pipe. @@ -401,7 +416,8 @@ def _read_timestamp(lock, conn, data): The end time may be None in case of a time instance. :param lock: A multiprocessing.Lock instance - :param conn: A multiprocessing.Pipe instance used to send the result + :param conn: A multiprocessing.connection.Connection object obtained from + multiprocessing.Pipe used to send the result :param data: The list of data entries [function_id, maptype, name, mapset, layer] @@ -429,7 +445,7 @@ def _read_timestamp(lock, conn, data): ############################################################################### -def _write_timestamp(lock, conn, data): +def _write_timestamp(lock: _LockLike, conn: Connection, data): """Write the file based GRASS timestamp the return values of the called C-functions using the provided pipe. @@ -440,7 +456,8 @@ def _write_timestamp(lock, conn, data): values description. :param lock: A multiprocessing.Lock instance - :param conn: A multiprocessing.Pipe instance used to send True or False + :param conn: A multiprocessing.connection.Connection object obtained from + multiprocessing.Pipe used to send True or False :param data: The list of data entries [function_id, maptype, name, mapset, layer, timestring] """ @@ -473,7 +490,7 @@ def _write_timestamp(lock, conn, data): ############################################################################### -def _remove_timestamp(lock, conn, data): +def _remove_timestamp(lock: _LockLike, conn: Connection, data): """Remove the file based GRASS timestamp the return values of the called C-functions using the provided pipe. @@ -484,7 +501,8 @@ def _remove_timestamp(lock, conn, data): values description. :param lock: A multiprocessing.Lock instance - :param conn: A multiprocessing.Pipe instance used to send True or False + :param conn: A multiprocessing.connection.Connection object obtained from + multiprocessing.Pipe used to send True or False :param data: The list of data entries [function_id, maptype, name, mapset, layer] @@ -508,7 +526,7 @@ def _remove_timestamp(lock, conn, data): ############################################################################### -def _read_semantic_label(lock, conn, data): +def _read_semantic_label(lock: _LockLike, conn: Connection, data): """Read the file based GRASS band identifier the result using the provided pipe. @@ -516,7 +534,8 @@ def _read_semantic_label(lock, conn, data): Rast_read_semantic_label: either a semantic label string or None. :param lock: A multiprocessing.Lock instance - :param conn: A multiprocessing.Pipe instance used to send True or False + :param conn: A multiprocessing.connection.Connection object obtained from + multiprocessing.Pipe used to send True or False :param data: The list of data entries [function_id, maptype, name, mapset, layer, timestring] @@ -547,14 +566,15 @@ def _read_semantic_label(lock, conn, data): ############################################################################### -def _write_semantic_label(lock, conn, data): +def _write_semantic_label(lock: _LockLike, conn: Connection, data): """Write the file based GRASS band identifier. Rises ValueError on invalid semantic label. Always sends back True. :param lock: A multiprocessing.Lock instance - :param conn: A multiprocessing.Pipe instance used to send True or False + :param conn: A multiprocessing.connection.Connection object obtained from + multiprocessing.Pipe used to send True or False :param data: The list of data entries [function_id, maptype, name, mapset, layer, timestring] @@ -583,13 +603,14 @@ def _write_semantic_label(lock, conn, data): ############################################################################### -def _remove_semantic_label(lock, conn, data): +def _remove_semantic_label(lock: _LockLike, conn: Connection, data): """Remove the file based GRASS band identifier. The value to be send via pipe is the return value of G_remove_misc. :param lock: A multiprocessing.Lock instance - :param conn: A multiprocessing.Pipe instance used to send True or False + :param conn: A multiprocessing.connection.Connection object obtained from + multiprocessing.Pipe used to send True or False :param data: The list of data entries [function_id, maptype, name, mapset, layer, timestring] @@ -616,14 +637,15 @@ def _remove_semantic_label(lock, conn, data): ############################################################################### -def _map_exists(lock, conn, data): +def _map_exists(lock: _LockLike, conn: Connection, data): """Check if a map exists in the spatial database The value to be send via pipe is True in case the map exists and False if not. :param lock: A multiprocessing.Lock instance - :param conn: A multiprocessing.Pipe instance used to send True or False + :param conn: A multiprocessing.connection.Connection object obtained from + multiprocessing.Pipe used to send True or False :param data: The list of data entries [function_id, maptype, name, mapset] """ @@ -648,12 +670,13 @@ def _map_exists(lock, conn, data): ############################################################################### -def _read_map_info(lock, conn, data): +def _read_map_info(lock: _LockLike, conn: Connection, data): """Read map specific metadata from the spatial database using C-library functions :param lock: A multiprocessing.Lock instance - :param conn: A multiprocessing.Pipe instance used to send True or False + :param conn: A multiprocessing.connection.Connection object obtained from + multiprocessing.Pipe used to send True or False :param data: The list of data entries [function_id, maptype, name, mapset] """ kvp = None @@ -955,11 +978,12 @@ def _read_vector_info(name, mapset): ############################################################################### -def _read_map_history(lock, conn, data): +def _read_map_history(lock: _LockLike, conn: Connection, data): """Read map history from the spatial database using C-library functions :param lock: A multiprocessing.Lock instance - :param conn: A multiprocessing.Pipe instance used to send True or False + :param conn: A multiprocessing.connection.Connection object obtained from + multiprocessing.Pipe used to send True or False :param data: The list of data entries [function_id, maptype, name, mapset] """ kvp = None @@ -1174,7 +1198,7 @@ def _convert_timestamp_from_grass(ts): ############################################################################### -def _stop(lock, conn, data): +def _stop(lock: _LockLike, conn: Connection, data): libgis.G_debug(1, "Stop C-interface server") conn.close() lock.release() @@ -1184,12 +1208,13 @@ def _stop(lock, conn, data): ############################################################################### -def c_library_server(lock, conn): +def c_library_server(lock: _LockLike, conn: Connection): """The GRASS C-libraries server function designed to be a target for multiprocessing.Process :param lock: A multiprocessing.Lock - :param conn: A multiprocessing.Pipe + :param conn: A multiprocessing.connection.Connection object obtained from + multiprocessing.Pipe """ def error_handler(data): @@ -1239,9 +1264,8 @@ def error_handler(data): # Avoid busy waiting conn.poll(None) data = conn.recv() - lock.acquire() - functions[data[0]](lock, conn, data) - lock.release() + with lock: + functions[data[0]](lock, conn, data) class CLibrariesInterface(RPCServerBase): From d4bb783424e1799a3306f26e413dcfaa148de9bc Mon Sep 17 00:00:00 2001 From: Nicklas Larsson Date: Mon, 4 Nov 2024 23:29:36 +0100 Subject: [PATCH 50/50] CI: add expat dependency to macOS runner (#4646) --- .github/workflows/macos_dependencies.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/macos_dependencies.txt b/.github/workflows/macos_dependencies.txt index 8ef1d3460f6..28e680d3ae5 100644 --- a/.github/workflows/macos_dependencies.txt +++ b/.github/workflows/macos_dependencies.txt @@ -2,6 +2,7 @@ cairo clangxx_osx-arm64 clang_osx-arm64 cmake +expat fftw flex freetype