diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 7d7c6e6..9ebebcb 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -2,7 +2,7 @@ exclude: "node_modules|migrations|.venv|tests/dev/|tests/fixtures/|presentations fail_fast: false repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v5.0.0 + rev: v6.0.0 hooks: - id: check-added-large-files args: ["--maxkb=500"] @@ -17,19 +17,19 @@ repos: - id: trailing-whitespace args: [--markdown-linebreak-ext=md] - - repo: https://github.com/psf/black - rev: 24.10.0 + - repo: https://github.com/psf/black-pre-commit-mirror + rev: 26.3.1 hooks: - id: black - repo: https://github.com/pycqa/isort - rev: 5.13.2 + rev: 8.0.1 hooks: - id: isort args: ["--profile", "black", "--filter-files"] - repo: https://github.com/pycqa/flake8 - rev: 7.1.1 + rev: 7.3.0 hooks: - id: flake8 language: python diff --git a/docs/conf.py b/docs/conf.py index dd5f919..ccca322 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -1,7 +1,7 @@ #!python3 """ - Configuration for project documentation using Sphinx. +Configuration for project documentation using Sphinx. """ # standard diff --git a/gml_application_schema_toolbox/__about__.py b/gml_application_schema_toolbox/__about__.py index 2455130..35b7c2f 100644 --- a/gml_application_schema_toolbox/__about__.py +++ b/gml_application_schema_toolbox/__about__.py @@ -1,8 +1,8 @@ #! python3 # noqa: E265 """ - Metadata about the package to easily retrieve informations about it. - See: https://packaging.python.org/guides/single-sourcing-package-version/ +Metadata about the package to easily retrieve informations about it. +See: https://packaging.python.org/guides/single-sourcing-package-version/ """ from configparser import ConfigParser diff --git a/gml_application_schema_toolbox/constants.py b/gml_application_schema_toolbox/constants.py index bb5f1de..63e1ad1 100644 --- a/gml_application_schema_toolbox/constants.py +++ b/gml_application_schema_toolbox/constants.py @@ -1,7 +1,7 @@ #! python3 # noqa: E265 """ - Plugin constants. +Plugin constants. """ # ############################################################################ diff --git a/gml_application_schema_toolbox/core/gmlas_xpath.py b/gml_application_schema_toolbox/core/gmlas_xpath.py index f74f492..56c07a4 100644 --- a/gml_application_schema_toolbox/core/gmlas_xpath.py +++ b/gml_application_schema_toolbox/core/gmlas_xpath.py @@ -60,14 +60,10 @@ def resolve_xpath(self, ogr_layer_name, ogr_layer_pkid_name, pkid_value, xpath): field_name = None field_category = None field_max_occurs = 0 - for f in self._ds.ExecuteSQL( - """ + for f in self._ds.ExecuteSQL(""" select field_xpath, field_name, field_category, field_max_occurs from {}_ogr_fields_metadata -where layer_name='{}'""".format( - self._schema, ogr_layer_name - ) - ): +where layer_name='{}'""".format(self._schema, ogr_layer_name)): field_xpath = f.GetField("field_xpath").split("/") if lstartswith(field_xpath, layer_xpath): # remove the layer_xpath diff --git a/gml_application_schema_toolbox/gui/bbox_widget.py b/gml_application_schema_toolbox/gui/bbox_widget.py index c3a5590..7fb20fd 100644 --- a/gml_application_schema_toolbox/gui/bbox_widget.py +++ b/gml_application_schema_toolbox/gui/bbox_widget.py @@ -62,7 +62,7 @@ def useLayerExtent(self): layerName = layer.name() extents.append(layerName) extentsDict[layerName] = {"extent": layer.extent(), "authid": authid} - (item, ok) = QInputDialog.getItem( + item, ok = QInputDialog.getItem( self, self.tr("Select extent"), self.tr("Use extent from"), extents, False ) if ok: diff --git a/gml_application_schema_toolbox/gui/gmlas_panel_mixin.py b/gml_application_schema_toolbox/gui/gmlas_panel_mixin.py index d0f70eb..2c55bdd 100644 --- a/gml_application_schema_toolbox/gui/gmlas_panel_mixin.py +++ b/gml_application_schema_toolbox/gui/gmlas_panel_mixin.py @@ -21,6 +21,7 @@ * * ***************************************************************************/ """ + # PyQGIS import processing diff --git a/gml_application_schema_toolbox/main.py b/gml_application_schema_toolbox/main.py index a29cbe2..7e99850 100644 --- a/gml_application_schema_toolbox/main.py +++ b/gml_application_schema_toolbox/main.py @@ -191,8 +191,7 @@ def unload(self): def onAbout(self): self.about_dlg = QWidget() vlayout = QVBoxLayout() - lbl_about_main = QLabel( - """ + lbl_about_main = QLabel("""

{}

Version: {}

This plugin is a prototype aiming at experimenting with the manipulation of Complex Features streams.

@@ -221,10 +220,7 @@ def onAbout(self):
  • The Association of Finnish Local and Regional Authorities (through Gispo.fi)
  • - """.format( - __title__, __version__ - ) - ) + """.format(__title__, __version__)) lbl_about_main.setWordWrap(True) vlayout.addWidget(lbl_about_main) hlayout = QHBoxLayout() diff --git a/gml_application_schema_toolbox/model_dialog.py b/gml_application_schema_toolbox/model_dialog.py index 42d69cc..3e501d2 100644 --- a/gml_application_schema_toolbox/model_dialog.py +++ b/gml_application_schema_toolbox/model_dialog.py @@ -274,7 +274,7 @@ def distance(p1, p2): def add_link(table_name, table_name2, y_idx): tx, ty, tw, th, table = table_pos[table_name] tx2, ty2, tw2, th2, _ = table_pos[table_name2] - (ax, ay, aw, ah) = table.widget().attributeCoords(y_idx) + ax, ay, aw, ah = table.widget().attributeCoords(y_idx) l1 = QLineF(ax - 3, ay + ah / 2.0, tx2 + tw2 / 2.0, ty2 + th2 / 2.0) l2 = QLineF(ax + aw + 3, ay + ah / 2.0, tx2 + tw2 / 2.0, ty2 + th2 / 2.0) if l1.length() < l2.length(): diff --git a/gml_application_schema_toolbox/processing/provider.py b/gml_application_schema_toolbox/processing/provider.py index 33fd4dd..0ae4740 100644 --- a/gml_application_schema_toolbox/processing/provider.py +++ b/gml_application_schema_toolbox/processing/provider.py @@ -1,7 +1,7 @@ #! python3 # noqa: E265 """ - Processing provider module. +Processing provider module. """ # PyQGIS diff --git a/gml_application_schema_toolbox/resources/gui/dlg_settings.py b/gml_application_schema_toolbox/resources/gui/dlg_settings.py index 09fc425..d552ef5 100644 --- a/gml_application_schema_toolbox/resources/gui/dlg_settings.py +++ b/gml_application_schema_toolbox/resources/gui/dlg_settings.py @@ -1,7 +1,7 @@ #! python3 # noqa: E265 """ - Plugin settings dialog. +Plugin settings dialog. """ # standard diff --git a/gml_application_schema_toolbox/toolbelt/file_downloader.py b/gml_application_schema_toolbox/toolbelt/file_downloader.py index d081f48..341d7a7 100644 --- a/gml_application_schema_toolbox/toolbelt/file_downloader.py +++ b/gml_application_schema_toolbox/toolbelt/file_downloader.py @@ -1,7 +1,7 @@ #! python3 # noqa: E265 """ - Functions used to manage network requests (remote files, etc.) +Functions used to manage network requests (remote files, etc.) """ # Standard library diff --git a/gml_application_schema_toolbox/toolbelt/preferences.py b/gml_application_schema_toolbox/toolbelt/preferences.py index c2c3eb6..2edc233 100644 --- a/gml_application_schema_toolbox/toolbelt/preferences.py +++ b/gml_application_schema_toolbox/toolbelt/preferences.py @@ -1,7 +1,7 @@ #! python3 # noqa: E265 """ - Plugin settings. +Plugin settings. """ # standard diff --git a/gml_application_schema_toolbox/viewers/wml2_timeseries.py b/gml_application_schema_toolbox/viewers/wml2_timeseries.py index 4ce69ca..98d93f6 100644 --- a/gml_application_schema_toolbox/viewers/wml2_timeseries.py +++ b/gml_application_schema_toolbox/viewers/wml2_timeseries.py @@ -189,7 +189,7 @@ def displayPlot(self): self.scene().displayPlot() def mouseMoveEvent(self, event): - (x, y) = (event.x(), event.y()) + x, y = (event.x(), event.y()) pt = self.mapToScene(x, y) self.scene().onMouseOver(pt) diff --git a/tests/qgis/test_custom_viewers.py b/tests/qgis/test_custom_viewers.py index 0d526a9..71a9d14 100644 --- a/tests/qgis/test_custom_viewers.py +++ b/tests/qgis/test_custom_viewers.py @@ -1,21 +1,20 @@ #! python3 # noqa E265 """ - Usage from the repo root folder: +Usage from the repo root folder: - Launch it with something like +Launch it with something like - `QGIS_DEBUG=0 QGIS_PREFIX_PATH=/home/hme/src/QGIS/build/output PYTHONPATH=/home/hme/src/QGIS/build/output/python python3 test_custom_viewers.py` +`QGIS_DEBUG=0 QGIS_PREFIX_PATH=/home/hme/src/QGIS/build/output PYTHONPATH=/home/hme/src/QGIS/build/output/python python3 test_custom_viewers.py` - .. code-block:: bash +.. code-block:: bash - # for whole tests - python -m unittest tests.test_custom_viewers - # for specific test - python -m unittest tests.test_custom_viewers.TestCustomViewers.test_custom_viewers_layer + # for whole tests + python -m unittest tests.test_custom_viewers + # for specific test + python -m unittest tests.test_custom_viewers.TestCustomViewers.test_custom_viewers_layer """ - # PyQGIS from qgis.testing import unittest from sip import wrappertype diff --git a/tests/qgis/test_gmlas_xpath.py b/tests/qgis/test_gmlas_xpath.py index bcfb349..801b90c 100644 --- a/tests/qgis/test_gmlas_xpath.py +++ b/tests/qgis/test_gmlas_xpath.py @@ -1,14 +1,14 @@ #! python3 # noqa E265 """ - Usage from the repo root folder: +Usage from the repo root folder: - .. code-block:: bash +.. code-block:: bash - # for whole tests - python -m unittest tests.test_gmlas_xpath - # for specific test - python -m unittest tests.test_gmlas_xpath.TestGMLASXPath.test_geologylog + # for whole tests + python -m unittest tests.test_gmlas_xpath + # for specific test + python -m unittest tests.test_gmlas_xpath.TestGMLASXPath.test_geologylog """ # standard library diff --git a/tests/qgis/test_load_as_xml.py b/tests/qgis/test_load_as_xml.py index 76cdbeb..3ecf678 100644 --- a/tests/qgis/test_load_as_xml.py +++ b/tests/qgis/test_load_as_xml.py @@ -1,21 +1,20 @@ #! python3 # noqa E265 """ - Usage from the repo root folder: +Usage from the repo root folder: - Launch it with something like +Launch it with something like - `QGIS_DEBUG=0 QGIS_PREFIX_PATH=/home/hme/src/QGIS/build/output PYTHONPATH=/home/hme/src/QGIS/build/output/python python3 test_load_as_xml.py` +`QGIS_DEBUG=0 QGIS_PREFIX_PATH=/home/hme/src/QGIS/build/output PYTHONPATH=/home/hme/src/QGIS/build/output/python python3 test_load_as_xml.py` - .. code-block:: bash +.. code-block:: bash - # for whole tests - python -m unittest tests.test_load_as_xml - # for specific test - python -m unittest tests.test_load_as_xml.TestLoadAsXML.test_load_as_xml_layer + # for whole tests + python -m unittest tests.test_load_as_xml + # for specific test + python -m unittest tests.test_load_as_xml.TestLoadAsXML.test_load_as_xml_layer """ - # standard library from pathlib import Path diff --git a/tests/qgis/test_load_in_qgis.py b/tests/qgis/test_load_in_qgis.py index 8e3ba59..3d92a7f 100644 --- a/tests/qgis/test_load_in_qgis.py +++ b/tests/qgis/test_load_in_qgis.py @@ -1,18 +1,18 @@ #! python3 # noqa E265 """ - Usage from the repo root folder: +Usage from the repo root folder: - Launch it with something like +Launch it with something like - `QGIS_DEBUG=0 QGIS_PREFIX_PATH=/home/hme/src/QGIS/build/output PYTHONPATH=/home/hme/src/QGIS/build/output/python python3 test_load_in_qgis.py` +`QGIS_DEBUG=0 QGIS_PREFIX_PATH=/home/hme/src/QGIS/build/output PYTHONPATH=/home/hme/src/QGIS/build/output/python python3 test_load_in_qgis.py` - .. code-block:: bash +.. code-block:: bash - # for whole tests - python -m unittest tests.test_load_in_qgis - # for specific test - python -m unittest tests.test_load_in_qgis.TestLoadInQGIS.test_geologylog + # for whole tests + python -m unittest tests.test_load_in_qgis + # for specific test + python -m unittest tests.test_load_in_qgis.TestLoadInQGIS.test_geologylog """ # standard library diff --git a/tests/qgis/test_plg_preferences.py b/tests/qgis/test_plg_preferences.py index 357bbf7..1fc4070 100644 --- a/tests/qgis/test_plg_preferences.py +++ b/tests/qgis/test_plg_preferences.py @@ -1,14 +1,14 @@ #! python3 # noqa E265 """ - Usage from the repo root folder: +Usage from the repo root folder: - .. code-block:: bash +.. code-block:: bash - # for whole tests - python -m unittest tests.test_plg_preferences - # for specific test - python -m unittest tests.test_plg_preferences.TestPlgPreferences.test_plg_preferences_structure + # for whole tests + python -m unittest tests.test_plg_preferences + # for specific test + python -m unittest tests.test_plg_preferences.TestPlgPreferences.test_plg_preferences_structure """ # standard library diff --git a/tests/unit/test_plg_metadata.py b/tests/unit/test_plg_metadata.py index d6e78ee..21b2707 100644 --- a/tests/unit/test_plg_metadata.py +++ b/tests/unit/test_plg_metadata.py @@ -1,13 +1,13 @@ #! python3 # noqa E265 """ - Usage from the repo root folder: +Usage from the repo root folder: - .. code-block:: bash - # for whole tests - python -m unittest tests.test_plg_metadata - # for specific test - python -m unittest tests.test_plg_metadata.TestPluginMetadata.test_version_semver +.. code-block:: bash + # for whole tests + python -m unittest tests.test_plg_metadata + # for specific test + python -m unittest tests.test_plg_metadata.TestPluginMetadata.test_version_semver """ # standard library