From 04519299a3269ac3e2ec37bf00f34bb8940d7971 Mon Sep 17 00:00:00 2001 From: Christian Ledermann Date: Thu, 29 Sep 2022 17:57:43 +0100 Subject: [PATCH 01/66] back to development --- docs/HISTORY.txt | 5 +++++ pygeoif/functions.py | 8 +++++++- pygeoif/types.py | 2 +- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/docs/HISTORY.txt b/docs/HISTORY.txt index fa011980..bfb266cd 100644 --- a/docs/HISTORY.txt +++ b/docs/HISTORY.txt @@ -1,6 +1,11 @@ Changelog ========= + +1.1 (unreleased) +------------------ + + 1.0 (2022/09/29) ------------------------ diff --git a/pygeoif/functions.py b/pygeoif/functions.py index 2cefcda8..f6d9bce1 100644 --- a/pygeoif/functions.py +++ b/pygeoif/functions.py @@ -159,4 +159,10 @@ def compare_coordinates( return False -__all__ = ["centroid", "compare_coordinates", "convex_hull", "dedupe", "signed_area"] +__all__ = [ + "centroid", + "compare_coordinates", + "convex_hull", + "dedupe", + "signed_area", +] diff --git a/pygeoif/types.py b/pygeoif/types.py index d14a767c..51ef76ae 100644 --- a/pygeoif/types.py +++ b/pygeoif/types.py @@ -56,7 +56,7 @@ class GeoInterfaceBase(TypedDict): class GeoInterface(GeoInterfaceBase, total=False): - """Geointerfaces provides an optional bbox.""" + """GeoInterface provides an optional bbox.""" bbox: Bounds From 208e9920b7a814ca67ba1d1761c361332b2df468 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 3 Oct 2022 16:46:32 +0000 Subject: [PATCH 02/66] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/regebro/pyroma: 3.2 → 4.0](https://github.com/regebro/pyroma/compare/3.2...4.0) --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 2b5d1fc6..9c4091e3 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -100,7 +100,7 @@ repos: - id: check-github-actions - id: check-readthedocs - repo: https://github.com/regebro/pyroma - rev: "3.2" + rev: "4.0" hooks: - id: pyroma ... From 77259469bc26cf3d9f70832b47bd2f4a6b7d4f3e Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 10 Oct 2022 16:48:21 +0000 Subject: [PATCH 03/66] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/psf/black: 22.8.0 → 22.10.0](https://github.com/psf/black/compare/22.8.0...22.10.0) - [github.com/pre-commit/mirrors-mypy: v0.981 → v0.982](https://github.com/pre-commit/mirrors-mypy/compare/v0.981...v0.982) --- .pre-commit-config.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 9c4091e3..672cd554 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -41,7 +41,7 @@ repos: hooks: - id: isort - repo: https://github.com/psf/black - rev: 22.8.0 + rev: 22.10.0 hooks: - id: black - repo: https://github.com/PyCQA/flake8 @@ -82,7 +82,7 @@ repos: - flake8-use-fstring - pep8-naming - repo: https://github.com/pre-commit/mirrors-mypy - rev: v0.981 + rev: v0.982 hooks: - id: mypy - repo: https://github.com/Lucas-C/pre-commit-hooks-markup From 50f844ee37189c0ccffa95569a4ed378b81f3acd Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 13 Oct 2022 18:24:26 +0000 Subject: [PATCH 04/66] Bump actions/setup-node from 3.5.0 to 3.5.1 Bumps [actions/setup-node](https://github.com/actions/setup-node) from 3.5.0 to 3.5.1. - [Release notes](https://github.com/actions/setup-node/releases) - [Commits](https://github.com/actions/setup-node/compare/v3.5.0...v3.5.1) --- updated-dependencies: - dependency-name: actions/setup-node dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- .github/workflows/codesee-arch-diagram.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/codesee-arch-diagram.yml b/.github/workflows/codesee-arch-diagram.yml index d6752af0..f877b1ee 100644 --- a/.github/workflows/codesee-arch-diagram.yml +++ b/.github/workflows/codesee-arch-diagram.yml @@ -36,7 +36,7 @@ jobs: # CodeSee Maps Go support uses a static binary so there's no setup step required. - name: Configure Node.js 14 - uses: actions/setup-node@v3.5.0 + uses: actions/setup-node@v3.5.1 if: ${{ fromJSON(steps.detect-languages.outputs.languages).javascript }} with: node-version: '14' From fbba13cba3a127314d4c09b4cb046b6078bc8157 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 24 Oct 2022 16:44:52 +0000 Subject: [PATCH 05/66] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/python-jsonschema/check-jsonschema: 0.18.3 → 0.18.4](https://github.com/python-jsonschema/check-jsonschema/compare/0.18.3...0.18.4) --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 672cd554..73afe70c 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -94,7 +94,7 @@ repos: hooks: - id: check-manifest - repo: https://github.com/python-jsonschema/check-jsonschema - rev: 0.18.3 + rev: 0.18.4 hooks: - id: check-github-workflows - id: check-github-actions From 450123762e4199dbb20ed3b3827e0c9e553ca889 Mon Sep 17 00:00:00 2001 From: Christian Ledermann Date: Tue, 25 Oct 2022 09:59:14 +0100 Subject: [PATCH 06/66] test 3.11 final --- .github/workflows/run-all-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/run-all-tests.yml b/.github/workflows/run-all-tests.yml index efe7a516..f9b16412 100644 --- a/.github/workflows/run-all-tests.yml +++ b/.github/workflows/run-all-tests.yml @@ -9,7 +9,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: ['3.7', '3.8', '3.9', '3.10', '3.11-dev'] + python-version: ['3.7', '3.8', '3.9', '3.10', '3.11'] steps: - uses: actions/checkout@v3 From 33c7d8ebbe1e707365631c9a6765dcadf63a834a Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 31 Oct 2022 16:49:37 +0000 Subject: [PATCH 07/66] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/hakancelikdev/unimport: 0.12.1 → 0dc8d609eb670eeb3335958acddcb6059cc4b8dd](https://github.com/hakancelikdev/unimport/compare/0.12.1...0dc8d609eb670eeb3335958acddcb6059cc4b8dd) --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 73afe70c..a8457e9a 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -32,7 +32,7 @@ repos: hooks: - id: absolufy-imports - repo: https://github.com/hakancelikdev/unimport - rev: 0.12.1 + rev: 0dc8d609eb670eeb3335958acddcb6059cc4b8dd hooks: - id: unimport args: [--remove, --include-star-import, --ignore-init, --gitignore] From 320f5bd21a380525b74cbf697aff6b2be92bfcab Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 7 Nov 2022 16:42:56 +0000 Subject: [PATCH 08/66] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/hakancelikdev/unimport: 0dc8d609eb670eeb3335958acddcb6059cc4b8dd → a56235171fc28dff6a879c377bb7392679552671](https://github.com/hakancelikdev/unimport/compare/0dc8d609eb670eeb3335958acddcb6059cc4b8dd...a56235171fc28dff6a879c377bb7392679552671) --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index a8457e9a..81b05633 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -32,7 +32,7 @@ repos: hooks: - id: absolufy-imports - repo: https://github.com/hakancelikdev/unimport - rev: 0dc8d609eb670eeb3335958acddcb6059cc4b8dd + rev: a56235171fc28dff6a879c377bb7392679552671 hooks: - id: unimport args: [--remove, --include-star-import, --ignore-init, --gitignore] From 5af7c710f2a2255f40b3401fc9151e5efb650186 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 14 Nov 2022 16:47:30 +0000 Subject: [PATCH 09/66] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/hakancelikdev/unimport: a56235171fc28dff6a879c377bb7392679552671 → 004b5dd0c8112330275beb52c4ccfce016a4b945](https://github.com/hakancelikdev/unimport/compare/a56235171fc28dff6a879c377bb7392679552671...004b5dd0c8112330275beb52c4ccfce016a4b945) - [github.com/pre-commit/mirrors-mypy: v0.982 → v0.990](https://github.com/pre-commit/mirrors-mypy/compare/v0.982...v0.990) - [github.com/python-jsonschema/check-jsonschema: 0.18.4 → 0.19.1](https://github.com/python-jsonschema/check-jsonschema/compare/0.18.4...0.19.1) --- .pre-commit-config.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 81b05633..534de782 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -32,7 +32,7 @@ repos: hooks: - id: absolufy-imports - repo: https://github.com/hakancelikdev/unimport - rev: a56235171fc28dff6a879c377bb7392679552671 + rev: 004b5dd0c8112330275beb52c4ccfce016a4b945 hooks: - id: unimport args: [--remove, --include-star-import, --ignore-init, --gitignore] @@ -82,7 +82,7 @@ repos: - flake8-use-fstring - pep8-naming - repo: https://github.com/pre-commit/mirrors-mypy - rev: v0.982 + rev: v0.990 hooks: - id: mypy - repo: https://github.com/Lucas-C/pre-commit-hooks-markup @@ -94,7 +94,7 @@ repos: hooks: - id: check-manifest - repo: https://github.com/python-jsonschema/check-jsonschema - rev: 0.18.4 + rev: 0.19.1 hooks: - id: check-github-workflows - id: check-github-actions From 23332d4fadc13cefdf97efb11f93e9189b1c4eb7 Mon Sep 17 00:00:00 2001 From: Christian Ledermann Date: Tue, 15 Nov 2022 09:49:17 +0000 Subject: [PATCH 10/66] add python 3.12 to test matrix --- .github/workflows/run-all-tests.yml | 4 ++-- pygeoif/__init__.py | 1 - pygeoif/exceptions.py | 1 - pygeoif/factories.py | 1 - pygeoif/feature.py | 1 - pygeoif/functions.py | 1 - pygeoif/geometry.py | 1 - pygeoif/types.py | 1 - 8 files changed, 2 insertions(+), 9 deletions(-) diff --git a/.github/workflows/run-all-tests.yml b/.github/workflows/run-all-tests.yml index f9b16412..8c251927 100644 --- a/.github/workflows/run-all-tests.yml +++ b/.github/workflows/run-all-tests.yml @@ -9,7 +9,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: ['3.7', '3.8', '3.9', '3.10', '3.11'] + python-version: ['3.7', '3.8', '3.9', '3.10', '3.11', '3.12-dev'] steps: - uses: actions/checkout@v3 @@ -35,7 +35,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: ['3.9'] + python-version: ['3.10'] steps: - uses: actions/checkout@v3 diff --git a/pygeoif/__init__.py b/pygeoif/__init__.py index bb9c53b2..d030abd7 100644 --- a/pygeoif/__init__.py +++ b/pygeoif/__init__.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # # Copyright (C) 2012 - 2022 Christian Ledermann # diff --git a/pygeoif/exceptions.py b/pygeoif/exceptions.py index 9b694ca9..0974b098 100644 --- a/pygeoif/exceptions.py +++ b/pygeoif/exceptions.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # # Copyright (C) 2012 -2022 Christian Ledermann # diff --git a/pygeoif/factories.py b/pygeoif/factories.py index 675b8bf8..ccbc36e3 100644 --- a/pygeoif/factories.py +++ b/pygeoif/factories.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # # Copyright (C) 2012 -2022 Christian Ledermann # diff --git a/pygeoif/feature.py b/pygeoif/feature.py index f287c4a5..040d7766 100644 --- a/pygeoif/feature.py +++ b/pygeoif/feature.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # # Copyright (C) 2012 -2022 Christian Ledermann # diff --git a/pygeoif/functions.py b/pygeoif/functions.py index f6d9bce1..a3cf0d48 100644 --- a/pygeoif/functions.py +++ b/pygeoif/functions.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # # Copyright (C) 2012 -2022 Christian Ledermann # diff --git a/pygeoif/geometry.py b/pygeoif/geometry.py index a3bdb64a..064d2e90 100644 --- a/pygeoif/geometry.py +++ b/pygeoif/geometry.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # # Copyright (C) 2012 -2022 Christian Ledermann # diff --git a/pygeoif/types.py b/pygeoif/types.py index 51ef76ae..53f8e93b 100644 --- a/pygeoif/types.py +++ b/pygeoif/types.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # # Copyright (C) 2012 -2022 Christian Ledermann # From be3ced00aaa735410ee2508339514acec51b3bb2 Mon Sep 17 00:00:00 2001 From: Christian Ledermann Date: Thu, 17 Nov 2022 12:53:22 +0000 Subject: [PATCH 11/66] auto remove print statements --- .pre-commit-config.yaml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 534de782..a4482b5a 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -40,6 +40,11 @@ repos: rev: 5.10.1 hooks: - id: isort + - repo: https://github.com/dhruvmanila/remove-print-statements + rev: '' + hooks: + - id: remove-print-statements + args: ['--verbose'] # Show all the print statements to be removed - repo: https://github.com/psf/black rev: 22.10.0 hooks: From 93da7d9dcd9b7d80c88883c5e77d7c82aa5225e3 Mon Sep 17 00:00:00 2001 From: Christian Ledermann Date: Thu, 17 Nov 2022 12:55:02 +0000 Subject: [PATCH 12/66] autoupdate --- .pre-commit-config.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index a4482b5a..b6d2b80a 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -41,7 +41,7 @@ repos: hooks: - id: isort - repo: https://github.com/dhruvmanila/remove-print-statements - rev: '' + rev: 'v0.5.0' hooks: - id: remove-print-statements args: ['--verbose'] # Show all the print statements to be removed @@ -87,7 +87,7 @@ repos: - flake8-use-fstring - pep8-naming - repo: https://github.com/pre-commit/mirrors-mypy - rev: v0.990 + rev: v0.991 hooks: - id: mypy - repo: https://github.com/Lucas-C/pre-commit-hooks-markup From 1e0046696c32bc134570817853094582e1364ee6 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 21 Nov 2022 16:44:39 +0000 Subject: [PATCH 13/66] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/python-jsonschema/check-jsonschema: 0.19.1 → 0.19.2](https://github.com/python-jsonschema/check-jsonschema/compare/0.19.1...0.19.2) --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index b6d2b80a..33214eba 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -99,7 +99,7 @@ repos: hooks: - id: check-manifest - repo: https://github.com/python-jsonschema/check-jsonschema - rev: 0.19.1 + rev: 0.19.2 hooks: - id: check-github-workflows - id: check-github-actions From ad8d362a16f328e42bebe9681e4e4e0af20054f5 Mon Sep 17 00:00:00 2001 From: Sourcery AI <> Date: Tue, 22 Nov 2022 09:03:48 +0000 Subject: [PATCH 14/66] 'Refactored by Sourcery' --- pygeoif/factories.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pygeoif/factories.py b/pygeoif/factories.py index ccbc36e3..eac073d2 100644 --- a/pygeoif/factories.py +++ b/pygeoif/factories.py @@ -145,8 +145,7 @@ def shape( if not geometry: raise TypeError("Object does not implement __geo_interface__") - constructor = type_map.get(geometry["type"]) - if constructor: + if constructor := type_map.get(geometry["type"]): return constructor._from_dict( # type: ignore [attr-defined, no-any-return] geometry, ) From 99dc45a94d9a5baaaed221a29101bebeb6cc1f0a Mon Sep 17 00:00:00 2001 From: Christian Ledermann Date: Tue, 22 Nov 2022 18:29:41 +0000 Subject: [PATCH 15/66] add pre-commit badge --- README.rst | 4 ++++ test-requirements.txt | 1 + 2 files changed, 5 insertions(+) diff --git a/README.rst b/README.rst index 90b46d0f..772f0deb 100644 --- a/README.rst +++ b/README.rst @@ -49,6 +49,10 @@ It was written to provide clean and python only geometries for fastkml_ :target: https://github.com/pre-commit/pre-commit :alt: pre-commit +.. image:: https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit + :target: https://github.com/pre-commit/pre-commit + :alt: pre-commit + Example ======== diff --git a/test-requirements.txt b/test-requirements.txt index 8e3b6220..72669bcc 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -58,6 +58,7 @@ pytest-randomly radon removestar ssort +typeforce yamlfixer-opt-nc yamllint yesqa From 0fae82342f29b5533594706482009432d460ed48 Mon Sep 17 00:00:00 2001 From: Christian Ledermann Date: Tue, 22 Nov 2022 19:35:25 +0000 Subject: [PATCH 16/66] remove duplicated pre-commit badge --- README.rst | 4 ---- 1 file changed, 4 deletions(-) diff --git a/README.rst b/README.rst index 772f0deb..1885abd4 100644 --- a/README.rst +++ b/README.rst @@ -45,10 +45,6 @@ It was written to provide clean and python only geometries for fastkml_ :target: https://www.codefactor.io/repository/github/cleder/pygeoif/overview/main :alt: CodeFactor -.. image:: https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white - :target: https://github.com/pre-commit/pre-commit - :alt: pre-commit - .. image:: https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit :target: https://github.com/pre-commit/pre-commit :alt: pre-commit From dfdb3efcf1ae862612509bf1d387951b25a6719f Mon Sep 17 00:00:00 2001 From: Christian Ledermann Date: Tue, 22 Nov 2022 19:55:48 +0000 Subject: [PATCH 17/66] remove walrus, 3.7 is still a thing --- pygeoif/factories.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pygeoif/factories.py b/pygeoif/factories.py index eac073d2..ccbc36e3 100644 --- a/pygeoif/factories.py +++ b/pygeoif/factories.py @@ -145,7 +145,8 @@ def shape( if not geometry: raise TypeError("Object does not implement __geo_interface__") - if constructor := type_map.get(geometry["type"]): + constructor = type_map.get(geometry["type"]) + if constructor: return constructor._from_dict( # type: ignore [attr-defined, no-any-return] geometry, ) From a99d6437effb2bcafb455fefa598472f11a3706a Mon Sep 17 00:00:00 2001 From: Christian Ledermann Date: Tue, 22 Nov 2022 20:07:03 +0000 Subject: [PATCH 18/66] configure 3.7 as min python version for sourcery --- .sourcery.yaml | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 .sourcery.yaml diff --git a/.sourcery.yaml b/.sourcery.yaml new file mode 100644 index 00000000..f300aba4 --- /dev/null +++ b/.sourcery.yaml @@ -0,0 +1,2 @@ +refactor: + python_version: '3.7' From e80d995173873203b4496b74ba7d0e86e860cce4 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 5 Dec 2022 16:46:27 +0000 Subject: [PATCH 19/66] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/pre-commit/pre-commit-hooks: v4.3.0 → v4.4.0](https://github.com/pre-commit/pre-commit-hooks/compare/v4.3.0...v4.4.0) - https://github.com/ikamensh/flynt/: 0.76 → 0.77 - [github.com/hakancelikdev/unimport: 004b5dd0c8112330275beb52c4ccfce016a4b945 → 33ead41ee30f1d323a9c2fcfd0114297efbbc4d5](https://github.com/hakancelikdev/unimport/compare/004b5dd0c8112330275beb52c4ccfce016a4b945...33ead41ee30f1d323a9c2fcfd0114297efbbc4d5) - [github.com/PyCQA/flake8: 5.0.4 → 6.0.0](https://github.com/PyCQA/flake8/compare/5.0.4...6.0.0) - [github.com/mgedmin/check-manifest: 0.48 → 0.49](https://github.com/mgedmin/check-manifest/compare/0.48...0.49) - [github.com/regebro/pyroma: 4.0 → 4.1](https://github.com/regebro/pyroma/compare/4.0...4.1) --- .pre-commit-config.yaml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 33214eba..cacfc3b5 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -4,7 +4,7 @@ repos: hooks: - id: check-useless-excludes - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.3.0 + rev: v4.4.0 hooks: - id: check-added-large-files - id: check-docstring-first @@ -24,7 +24,7 @@ repos: - id: requirements-txt-fixer - id: trailing-whitespace - repo: https://github.com/ikamensh/flynt/ - rev: '0.76' + rev: '0.77' hooks: - id: flynt - repo: https://github.com/MarcoGorelli/absolufy-imports @@ -32,7 +32,7 @@ repos: hooks: - id: absolufy-imports - repo: https://github.com/hakancelikdev/unimport - rev: 004b5dd0c8112330275beb52c4ccfce016a4b945 + rev: 33ead41ee30f1d323a9c2fcfd0114297efbbc4d5 hooks: - id: unimport args: [--remove, --include-star-import, --ignore-init, --gitignore] @@ -50,7 +50,7 @@ repos: hooks: - id: black - repo: https://github.com/PyCQA/flake8 - rev: 5.0.4 + rev: 6.0.0 hooks: - id: flake8 additional_dependencies: @@ -95,7 +95,7 @@ repos: hooks: - id: rst-linter - repo: https://github.com/mgedmin/check-manifest - rev: "0.48" + rev: "0.49" hooks: - id: check-manifest - repo: https://github.com/python-jsonschema/check-jsonschema @@ -105,7 +105,7 @@ repos: - id: check-github-actions - id: check-readthedocs - repo: https://github.com/regebro/pyroma - rev: "4.0" + rev: "4.1" hooks: - id: pyroma ... From d8cb8e4baad1e9f51face6fd5b5201a8d8ea421a Mon Sep 17 00:00:00 2001 From: "codesee-maps[bot]" <86324825+codesee-maps[bot]@users.noreply.github.com> Date: Mon, 5 Dec 2022 22:29:40 +0000 Subject: [PATCH 20/66] Install the CodeSee workflow. Learn more at https://docs.codesee.io --- .github/workflows/codesee-arch-diagram.yml | 75 ++-------------------- 1 file changed, 7 insertions(+), 68 deletions(-) diff --git a/.github/workflows/codesee-arch-diagram.yml b/.github/workflows/codesee-arch-diagram.yml index f877b1ee..3435bcd2 100644 --- a/.github/workflows/codesee-arch-diagram.yml +++ b/.github/workflows/codesee-arch-diagram.yml @@ -5,77 +5,16 @@ on: pull_request_target: types: [opened, synchronize, reopened] -name: CodeSee Map +name: CodeSee + +permissions: read-all jobs: - test_map_action: + codesee: runs-on: ubuntu-latest continue-on-error: true - name: Run CodeSee Map Analysis + name: Analyze the repo with CodeSee steps: - - name: checkout - id: checkout - uses: actions/checkout@v3 - with: - repository: ${{ github.event.pull_request.head.repo.full_name }} - ref: ${{ github.event.pull_request.head.ref }} - fetch-depth: 0 - - # codesee-detect-languages has an output with id languages. - - name: Detect Languages - id: detect-languages - uses: Codesee-io/codesee-detect-languages-action@latest - - - name: Configure JDK 16 - uses: actions/setup-java@v3 - if: ${{ fromJSON(steps.detect-languages.outputs.languages).java }} - with: - java-version: '16' - distribution: 'zulu' - - # CodeSee Maps Go support uses a static binary so there's no setup step required. - - - name: Configure Node.js 14 - uses: actions/setup-node@v3.5.1 - if: ${{ fromJSON(steps.detect-languages.outputs.languages).javascript }} - with: - node-version: '14' - - - name: Configure Python 3.x - uses: actions/setup-python@v4 - if: ${{ fromJSON(steps.detect-languages.outputs.languages).python }} - with: - python-version: '3.10' - architecture: 'x64' - - - name: Configure Ruby '3.x' - uses: ruby/setup-ruby@v1 - if: ${{ fromJSON(steps.detect-languages.outputs.languages).ruby }} - with: - ruby-version: '3.0' - - # CodeSee Maps Rust support uses a static binary so there's no setup step required. - - - name: Generate Map - id: generate-map - uses: Codesee-io/codesee-map-action@latest - with: - step: map - github_ref: ${{ github.ref }} - languages: ${{ steps.detect-languages.outputs.languages }} - - - name: Upload Map - id: upload-map - uses: Codesee-io/codesee-map-action@latest - with: - step: mapUpload - api_token: ${{ secrets.CODESEE_ARCH_DIAG_API_TOKEN }} - github_ref: ${{ github.ref }} - - - name: Insights - id: insights - uses: Codesee-io/codesee-map-action@latest + - uses: Codesee-io/codesee-action@v2 with: - step: insights - api_token: ${{ secrets.CODESEE_ARCH_DIAG_API_TOKEN }} - github_ref: ${{ github.ref }} + codesee-token: ${{ secrets.CODESEE_ARCH_DIAG_API_TOKEN }} From f810ebc33f9210c5db3a7cfc85591235d4d1f5b5 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 12 Dec 2022 16:50:17 +0000 Subject: [PATCH 21/66] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/psf/black: 22.10.0 → 22.12.0](https://github.com/psf/black/compare/22.10.0...22.12.0) --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index cacfc3b5..f8798a6d 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -46,7 +46,7 @@ repos: - id: remove-print-statements args: ['--verbose'] # Show all the print statements to be removed - repo: https://github.com/psf/black - rev: 22.10.0 + rev: 22.12.0 hooks: - id: black - repo: https://github.com/PyCQA/flake8 From dbf71dcf424023628f76ef9147bbf82a370d922a Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 19 Dec 2022 16:49:24 +0000 Subject: [PATCH 22/66] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/pycqa/isort: 5.10.1 → v5.11.3](https://github.com/pycqa/isort/compare/5.10.1...v5.11.3) --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index f8798a6d..4a7617ec 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -37,7 +37,7 @@ repos: - id: unimport args: [--remove, --include-star-import, --ignore-init, --gitignore] - repo: https://github.com/pycqa/isort - rev: 5.10.1 + rev: v5.11.3 hooks: - id: isort - repo: https://github.com/dhruvmanila/remove-print-statements From b75be766cb58a2bb8599ef648dc0da4504271b64 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 26 Dec 2022 16:51:39 +0000 Subject: [PATCH 23/66] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/pycqa/isort: v5.11.3 → 5.11.4](https://github.com/pycqa/isort/compare/v5.11.3...5.11.4) --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 4a7617ec..c68fd189 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -37,7 +37,7 @@ repos: - id: unimport args: [--remove, --include-star-import, --ignore-init, --gitignore] - repo: https://github.com/pycqa/isort - rev: v5.11.3 + rev: 5.11.4 hooks: - id: isort - repo: https://github.com/dhruvmanila/remove-print-statements From 72a0b7ac15cfd62751f11d7c68588cdacb0d05b9 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 9 Jan 2023 16:48:27 +0000 Subject: [PATCH 24/66] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/python-jsonschema/check-jsonschema: 0.19.2 → 0.20.0](https://github.com/python-jsonschema/check-jsonschema/compare/0.19.2...0.20.0) --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index c68fd189..8bb5e21f 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -99,7 +99,7 @@ repos: hooks: - id: check-manifest - repo: https://github.com/python-jsonschema/check-jsonschema - rev: 0.19.2 + rev: 0.20.0 hooks: - id: check-github-workflows - id: check-github-actions From 53a3dab9975bf9ecbb6381a91ac864577b70cb8f Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 6 Feb 2023 17:02:20 +0000 Subject: [PATCH 25/66] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/hakancelikdev/unimport: 33ead41ee30f1d323a9c2fcfd0114297efbbc4d5 → 0.14.1](https://github.com/hakancelikdev/unimport/compare/33ead41ee30f1d323a9c2fcfd0114297efbbc4d5...0.14.1) - [github.com/pycqa/isort: 5.11.4 → 5.12.0](https://github.com/pycqa/isort/compare/5.11.4...5.12.0) - [github.com/psf/black: 22.12.0 → 23.1.0](https://github.com/psf/black/compare/22.12.0...23.1.0) - [github.com/python-jsonschema/check-jsonschema: 0.20.0 → 0.21.0](https://github.com/python-jsonschema/check-jsonschema/compare/0.20.0...0.21.0) --- .pre-commit-config.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 8bb5e21f..b58e1677 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -32,12 +32,12 @@ repos: hooks: - id: absolufy-imports - repo: https://github.com/hakancelikdev/unimport - rev: 33ead41ee30f1d323a9c2fcfd0114297efbbc4d5 + rev: 0.14.1 hooks: - id: unimport args: [--remove, --include-star-import, --ignore-init, --gitignore] - repo: https://github.com/pycqa/isort - rev: 5.11.4 + rev: 5.12.0 hooks: - id: isort - repo: https://github.com/dhruvmanila/remove-print-statements @@ -46,7 +46,7 @@ repos: - id: remove-print-statements args: ['--verbose'] # Show all the print statements to be removed - repo: https://github.com/psf/black - rev: 22.12.0 + rev: 23.1.0 hooks: - id: black - repo: https://github.com/PyCQA/flake8 @@ -99,7 +99,7 @@ repos: hooks: - id: check-manifest - repo: https://github.com/python-jsonschema/check-jsonschema - rev: 0.20.0 + rev: 0.21.0 hooks: - id: check-github-workflows - id: check-github-actions From 6b4ad11761d51b2d4cd99e9308901079cc4018e8 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 13 Feb 2023 16:56:37 +0000 Subject: [PATCH 26/66] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/pre-commit/mirrors-mypy: v0.991 → v1.0.0](https://github.com/pre-commit/mirrors-mypy/compare/v0.991...v1.0.0) --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index b58e1677..1797a0e9 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -87,7 +87,7 @@ repos: - flake8-use-fstring - pep8-naming - repo: https://github.com/pre-commit/mirrors-mypy - rev: v0.991 + rev: v1.0.0 hooks: - id: mypy - repo: https://github.com/Lucas-C/pre-commit-hooks-markup From 24178963f27c9891867fa7516aa2501d870f3336 Mon Sep 17 00:00:00 2001 From: Christian Ledermann Date: Mon, 13 Feb 2023 18:28:51 +0000 Subject: [PATCH 27/66] update precommit --- .pre-commit-config.yaml | 53 +++++++++++++++--------------- pygeoif/factories.py | 3 +- pygeoif/functions.py | 1 - pygeoif/tests/test_base.py | 8 ----- pygeoif/tests/test_factories.py | 1 - pygeoif/tests/test_functions.py | 2 -- pygeoif/tests/test_multipolygon.py | 1 - pygeoif/tests/test_point.py | 1 - test-requirements.txt | 10 +++--- 9 files changed, 32 insertions(+), 48 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 1797a0e9..3b0cc09e 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -40,11 +40,11 @@ repos: rev: 5.12.0 hooks: - id: isort - - repo: https://github.com/dhruvmanila/remove-print-statements - rev: 'v0.5.0' - hooks: - - id: remove-print-statements - args: ['--verbose'] # Show all the print statements to be removed + # - repo: https://github.com/dhruvmanila/remove-print-statements + # rev: 'v0.5.0' + # hooks: + # - id: remove-print-statements + # args: ['--verbose'] # Show all the print statements to be removed - repo: https://github.com/psf/black rev: 23.1.0 hooks: @@ -54,19 +54,18 @@ repos: hooks: - id: flake8 additional_dependencies: - - flake8 - - flake8-absolute-import - - flake8-awesome - - flake8-bandit - - flake8-blind-except + # - flake8-absolute-import + # - flake8-awesome + # - flake8-bandit + # - flake8-blind-except - flake8-bugbear # - flake8-class-attributes-order - flake8-cognitive-complexity - - flake8-commas + # - flake8-commas - flake8-comments - flake8-complex-f-strings - - flake8-continuation - - flake8-debugger + # - flake8-continuation + # - flake8-debugger - flake8-docstrings # - flake8-dunder-all - flake8-encodings @@ -84,28 +83,28 @@ repos: - flake8-string-format - flake8-super - flake8-typing-imports - - flake8-use-fstring + # - flake8-use-fstring - pep8-naming - repo: https://github.com/pre-commit/mirrors-mypy rev: v1.0.0 hooks: - id: mypy - - repo: https://github.com/Lucas-C/pre-commit-hooks-markup - rev: v1.0.1 - hooks: - - id: rst-linter - - repo: https://github.com/mgedmin/check-manifest - rev: "0.49" - hooks: - - id: check-manifest + # - repo: https://github.com/Lucas-C/pre-commit-hooks-markup + # rev: v1.0.1 + # hooks: + # - id: rst-linter + # - repo: https://github.com/mgedmin/check-manifest + # rev: "0.49" + # hooks: + # - id: check-manifest - repo: https://github.com/python-jsonschema/check-jsonschema - rev: 0.21.0 + rev: "0.21.0" hooks: - id: check-github-workflows - id: check-github-actions - id: check-readthedocs - - repo: https://github.com/regebro/pyroma - rev: "4.1" - hooks: - - id: pyroma + # - repo: https://github.com/regebro/pyroma + # rev: "4.1" + # hooks: + # - id: pyroma ... diff --git a/pygeoif/factories.py b/pygeoif/factories.py index ccbc36e3..61a47a36 100644 --- a/pygeoif/factories.py +++ b/pygeoif/factories.py @@ -268,9 +268,8 @@ def _multipolygon_from_wkt_coordinates(coordinates: str) -> MultiPolygon: def _multigeometry_from_wkt_coordinates(coordinates: str) -> GeometryCollection: gc_types = gcre.findall(coordinates) gc_coords = gcre.split(coordinates)[1:] - assert len(gc_types) == len(gc_coords) # noqa: S101 geometries: List[Geometry] = [] - for (gc_type, gc_coord) in zip(gc_types, gc_coords): + for gc_type, gc_coord in zip(gc_types, gc_coords): gc_wkt = gc_type + gc_coord[: gc_coord.rfind(")") + 1] geometries.append(cast(Geometry, from_wkt(gc_wkt))) return GeometryCollection(geometries) diff --git a/pygeoif/functions.py b/pygeoif/functions.py index a3cf0d48..b1b1c375 100644 --- a/pygeoif/functions.py +++ b/pygeoif/functions.py @@ -58,7 +58,6 @@ def centroid(coords: LineType) -> Tuple[Point2D, float]: # For all vertices for i, coord in enumerate(coords): - next_coord = coords[(i + 1) % n] # Calculate area using shoelace formula area = (coord[0] * next_coord[1]) - (next_coord[0] * coord[1]) diff --git a/pygeoif/tests/test_base.py b/pygeoif/tests/test_base.py index 48b04573..2e6f1839 100644 --- a/pygeoif/tests/test_base.py +++ b/pygeoif/tests/test_base.py @@ -18,7 +18,6 @@ def test_bounds() -> None: """Subclasses must implement bounds.""" base_geo = geometry._Geometry() with pytest.raises(NotImplementedError, match="^Must be implemented by subclass$"): - assert base_geo.bounds @@ -26,14 +25,12 @@ def test_wkt() -> None: """Implement wkt in subclasses.""" base_geo = geometry._Geometry() with pytest.raises(NotImplementedError, match="^Must be implemented by subclass$"): - assert base_geo.wkt def test_empty() -> None: base_geo = geometry._Geometry() with pytest.raises(NotImplementedError, match="^Must be implemented by subclass$"): - assert base_geo.is_empty @@ -46,21 +43,18 @@ def test_wkt_inset() -> None: def test_wkt_coordinates() -> None: base_geo = geometry._Geometry() with pytest.raises(NotImplementedError, match="^Must be implemented by subclass$"): - assert base_geo._wkt_coords def test_from_dict() -> None: base_geo = geometry._Geometry() with pytest.raises(NotImplementedError, match="^Must be implemented by subclass$"): - assert base_geo._from_dict({"type": "_Geometry"}) def test_has_z() -> None: base_geo = geometry._Geometry() with pytest.raises(NotImplementedError, match="^Must be implemented by subclass$"): - assert base_geo.has_z @@ -71,12 +65,10 @@ def test_convex_hull() -> None: NotImplementedError, match="^Must be implemented by subclass$", ): - assert base_geo.convex_hull def test_get_bounds() -> None: base_geo = geometry._Geometry() with pytest.raises(NotImplementedError, match="^Must be implemented by subclass$"): - assert base_geo._get_bounds() diff --git a/pygeoif/tests/test_factories.py b/pygeoif/tests/test_factories.py index a763c989..05cac7a7 100644 --- a/pygeoif/tests/test_factories.py +++ b/pygeoif/tests/test_factories.py @@ -95,7 +95,6 @@ def test_shell_holes_from_wkt_coords() -> None: class TestWKT: - # valid and supported WKTs wkt_ok = [ "POINT(6 10)", diff --git a/pygeoif/tests/test_functions.py b/pygeoif/tests/test_functions.py index 8abb2c20..f6583681 100644 --- a/pygeoif/tests/test_functions.py +++ b/pygeoif/tests/test_functions.py @@ -260,12 +260,10 @@ def test_random() -> None: def test_dedupe_point() -> None: - assert dedupe(((1, 2, 3),) * 10) == ((1, 2, 3),) def test_dedupe_line() -> None: - assert dedupe(((1, 2, 3), (4, 5, 6)) * 3) == ( (1, 2, 3), (4, 5, 6), diff --git a/pygeoif/tests/test_multipolygon.py b/pygeoif/tests/test_multipolygon.py index b58856c8..d4bb9f1e 100644 --- a/pygeoif/tests/test_multipolygon.py +++ b/pygeoif/tests/test_multipolygon.py @@ -275,7 +275,6 @@ def test_empty_wkt() -> None: def test_repr_empty() -> None: - polys = geometry.MultiPolygon([]) assert repr(polys) == "MultiPolygon(())" diff --git a/pygeoif/tests/test_point.py b/pygeoif/tests/test_point.py index 91db7902..3bca9685 100644 --- a/pygeoif/tests/test_point.py +++ b/pygeoif/tests/test_point.py @@ -183,7 +183,6 @@ def test_eq_floats() -> None: def test_neq_missing_interface() -> None: - point = geometry.Point(0, 1, 2) assert point != object() diff --git a/test-requirements.txt b/test-requirements.txt index 72669bcc..ac52857f 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -6,15 +6,15 @@ bandit black #cohesion flake8 -flake8-absolute-import -flake8-awesome -flake8-bandit +#flake8-absolute-import +#flake8-awesome +#flake8-bandit flake8-blind-except -flake8-broken-line +# flake8-broken-line flake8-bugbear # flake8-class-attributes-order flake8-cognitive-complexity -flake8-commas +#flake8-commas flake8-comments flake8-complex-f-strings flake8-continuation From dbf69ddeafb69a02550165c27a7c4c19600077c7 Mon Sep 17 00:00:00 2001 From: Christian Ledermann Date: Mon, 13 Feb 2023 18:33:19 +0000 Subject: [PATCH 28/66] explicit stacklevel --- pygeoif/geometry.py | 1 + 1 file changed, 1 insertion(+) diff --git a/pygeoif/geometry.py b/pygeoif/geometry.py index 064d2e90..bbf7ff13 100644 --- a/pygeoif/geometry.py +++ b/pygeoif/geometry.py @@ -101,6 +101,7 @@ def convex_hull(self) -> Optional[Union["Point", "LineString", "Polygon"]]: warnings.warn( "The convex Hull will only return the projection to" " 2 dimensions xy coordinates", + stacklevel=2, ) hull = convex_hull(self._prepare_hull()) From b89dbe3d23e891c1cb5d8bec2d084ea6f847d0a7 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 20 Feb 2023 16:57:10 +0000 Subject: [PATCH 29/66] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/pre-commit/mirrors-mypy: v1.0.0 → v1.0.1](https://github.com/pre-commit/mirrors-mypy/compare/v1.0.0...v1.0.1) --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 3b0cc09e..dea745d2 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -86,7 +86,7 @@ repos: # - flake8-use-fstring - pep8-naming - repo: https://github.com/pre-commit/mirrors-mypy - rev: v1.0.0 + rev: v1.0.1 hooks: - id: mypy # - repo: https://github.com/Lucas-C/pre-commit-hooks-markup From ffbfe775e0fad333f5a77a9a605f80c46e22bd76 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 13 Mar 2023 16:58:22 +0000 Subject: [PATCH 30/66] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/pre-commit/mirrors-mypy: v1.0.1 → v1.1.1](https://github.com/pre-commit/mirrors-mypy/compare/v1.0.1...v1.1.1) - [github.com/python-jsonschema/check-jsonschema: 0.21.0 → 0.22.0](https://github.com/python-jsonschema/check-jsonschema/compare/0.21.0...0.22.0) --- .pre-commit-config.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index dea745d2..4b9a151f 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -86,7 +86,7 @@ repos: # - flake8-use-fstring - pep8-naming - repo: https://github.com/pre-commit/mirrors-mypy - rev: v1.0.1 + rev: v1.1.1 hooks: - id: mypy # - repo: https://github.com/Lucas-C/pre-commit-hooks-markup @@ -98,7 +98,7 @@ repos: # hooks: # - id: check-manifest - repo: https://github.com/python-jsonschema/check-jsonschema - rev: "0.21.0" + rev: "0.22.0" hooks: - id: check-github-workflows - id: check-github-actions From 00dd6ead5fd162c5f1b20d1abce6ef9e29259a58 Mon Sep 17 00:00:00 2001 From: Christian Ledermann Date: Sun, 26 Mar 2023 21:33:29 +0100 Subject: [PATCH 31/66] add ruff to pre-commit, move tests --- .pre-commit-config.yaml | 4 ++ pyproject.toml | 6 ++- {pygeoif/tests => tests}/__init__.py | 0 {pygeoif/tests => tests}/test_base.py | 0 {pygeoif/tests => tests}/test_bounds.py | 0 {pygeoif/tests => tests}/test_factories.py | 0 {pygeoif/tests => tests}/test_feature.py | 0 {pygeoif/tests => tests}/test_functions.py | 0 .../test_geometrycollection.py | 0 {pygeoif/tests => tests}/test_line.py | 0 {pygeoif/tests => tests}/test_linear_ring.py | 0 {pygeoif/tests => tests}/test_multiline.py | 0 {pygeoif/tests => tests}/test_multipoint.py | 0 {pygeoif/tests => tests}/test_multipolygon.py | 0 {pygeoif/tests => tests}/test_point.py | 0 {pygeoif/tests => tests}/test_polygon.py | 0 tox.ini | 38 ++++--------------- 17 files changed, 15 insertions(+), 33 deletions(-) rename {pygeoif/tests => tests}/__init__.py (100%) rename {pygeoif/tests => tests}/test_base.py (100%) rename {pygeoif/tests => tests}/test_bounds.py (100%) rename {pygeoif/tests => tests}/test_factories.py (100%) rename {pygeoif/tests => tests}/test_feature.py (100%) rename {pygeoif/tests => tests}/test_functions.py (100%) rename {pygeoif/tests => tests}/test_geometrycollection.py (100%) rename {pygeoif/tests => tests}/test_line.py (100%) rename {pygeoif/tests => tests}/test_linear_ring.py (100%) rename {pygeoif/tests => tests}/test_multiline.py (100%) rename {pygeoif/tests => tests}/test_multipoint.py (100%) rename {pygeoif/tests => tests}/test_multipolygon.py (100%) rename {pygeoif/tests => tests}/test_point.py (100%) rename {pygeoif/tests => tests}/test_polygon.py (100%) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 4b9a151f..5a71c48a 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -49,6 +49,10 @@ repos: rev: 23.1.0 hooks: - id: black + - repo: https://github.com/charliermarsh/ruff-pre-commit + rev: 'v0.0.259' + hooks: + - id: ruff - repo: https://github.com/PyCQA/flake8 rev: 6.0.0 hooks: diff --git a/pyproject.toml b/pyproject.toml index 467593ca..28042b2c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -29,7 +29,7 @@ warn_return_any = true show_error_codes = true [[tool.mypy.overrides]] -module = "pygeoif.tests.*" +module = "tests.*" disallow_untyped_defs = false ignore_errors = true @@ -45,4 +45,6 @@ reportMissingImports = true reportMissingTypeStubs = true [tool.ruff] -line-length = 89 + +[tool.ruff.per-file-ignores] +"tests/*.py" = ["D103"] diff --git a/pygeoif/tests/__init__.py b/tests/__init__.py similarity index 100% rename from pygeoif/tests/__init__.py rename to tests/__init__.py diff --git a/pygeoif/tests/test_base.py b/tests/test_base.py similarity index 100% rename from pygeoif/tests/test_base.py rename to tests/test_base.py diff --git a/pygeoif/tests/test_bounds.py b/tests/test_bounds.py similarity index 100% rename from pygeoif/tests/test_bounds.py rename to tests/test_bounds.py diff --git a/pygeoif/tests/test_factories.py b/tests/test_factories.py similarity index 100% rename from pygeoif/tests/test_factories.py rename to tests/test_factories.py diff --git a/pygeoif/tests/test_feature.py b/tests/test_feature.py similarity index 100% rename from pygeoif/tests/test_feature.py rename to tests/test_feature.py diff --git a/pygeoif/tests/test_functions.py b/tests/test_functions.py similarity index 100% rename from pygeoif/tests/test_functions.py rename to tests/test_functions.py diff --git a/pygeoif/tests/test_geometrycollection.py b/tests/test_geometrycollection.py similarity index 100% rename from pygeoif/tests/test_geometrycollection.py rename to tests/test_geometrycollection.py diff --git a/pygeoif/tests/test_line.py b/tests/test_line.py similarity index 100% rename from pygeoif/tests/test_line.py rename to tests/test_line.py diff --git a/pygeoif/tests/test_linear_ring.py b/tests/test_linear_ring.py similarity index 100% rename from pygeoif/tests/test_linear_ring.py rename to tests/test_linear_ring.py diff --git a/pygeoif/tests/test_multiline.py b/tests/test_multiline.py similarity index 100% rename from pygeoif/tests/test_multiline.py rename to tests/test_multiline.py diff --git a/pygeoif/tests/test_multipoint.py b/tests/test_multipoint.py similarity index 100% rename from pygeoif/tests/test_multipoint.py rename to tests/test_multipoint.py diff --git a/pygeoif/tests/test_multipolygon.py b/tests/test_multipolygon.py similarity index 100% rename from pygeoif/tests/test_multipolygon.py rename to tests/test_multipolygon.py diff --git a/pygeoif/tests/test_point.py b/tests/test_point.py similarity index 100% rename from pygeoif/tests/test_point.py rename to tests/test_point.py diff --git a/pygeoif/tests/test_polygon.py b/tests/test_polygon.py similarity index 100% rename from pygeoif/tests/test_polygon.py rename to tests/test_polygon.py diff --git a/tox.ini b/tox.ini index 2d73661c..74ef1378 100644 --- a/tox.ini +++ b/tox.ini @@ -1,40 +1,16 @@ -[tox] -envlist = - py26, - py27, - py32, - py33, - py34, - pypy, - pypy3, - pep8, - -[testenv] -deps = - pytest - coverage -commands = - coverage run -a --source=pygeoif setup.py test - -[testenv:pep8] -deps = - pep8 -commands = - pep8 --exclude test_main.py pygeoif - [flake8] -min_python_version = 3.6.10 +min_python_version = 3.7 exclude = .git,__pycache__,docs/source/conf.py,old,build,dist max_line_length = 89 ignore= W503,I900,IF100 per-file-ignores = - pygeoif/tests/*:S101,D103,S307,DALL000,S311,ECE001,FKA100 - pygeoif/tests/test_geometrycollection.py: ECE001,S101,D103,S307,DALL000 - pygeoif/tests/test_factories.py: ECE001,S10,D10,S307,DALL000,PT009,T003 - pygeoif/tests/test_feature.py: ECE001,S10,D10,S307,DALL000,PT009,T003,P103 - pygeoif/feature.py: A003 - pygeoif/types.py: A003 + tests/*:S101,D103,S307,DALL000,S311,ECE001,FKA100 + tests/test_geometrycollection.py: ECE001,S101,D103,S307,DALL000 + tests/test_factories.py: ECE001,S10,D10,S307,DALL000,PT009,T003 + tests/test_feature.py: ECE001,S10,D10,S307,DALL000,PT009,T003,P103 + feature.py: A003 + types.py: A003 kwargs_ignore_function_pattern_extend = '^cast$' literal_inline_quotes = double literal_multiline_quotes = double From 9ed098893027f6b23a5b291a7f8326dea47a8b58 Mon Sep 17 00:00:00 2001 From: Christian Ledermann Date: Sun, 26 Mar 2023 21:38:10 +0100 Subject: [PATCH 32/66] reactivate check-manifest --- .github/workflows/run-all-tests.yml | 8 ++++---- .pre-commit-config.yaml | 8 ++++---- MANIFEST.in | 1 + 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/.github/workflows/run-all-tests.yml b/.github/workflows/run-all-tests.yml index 8c251927..12e195f3 100644 --- a/.github/workflows/run-all-tests.yml +++ b/.github/workflows/run-all-tests.yml @@ -23,9 +23,9 @@ jobs: pip install pytest pytest-cov typing_extensions - name: Test with pytest run: | - pytest pygeoif --cov=pygeoif --cov-fail-under=100 --cov-report=xml + pytest tests --cov=tests --cov=pygeoif --cov-fail-under=100 --cov-report=xml - name: "Upload coverage to Codecov" - if: ${{ matrix.python-version==3.9 }} + if: ${{ matrix.python-version==3.11 }} uses: codecov/codecov-action@v3 with: fail_ci_if_error: true @@ -53,7 +53,7 @@ jobs: - name: Linting run: | flake8 pygeoif - black --check pygeoif + black --check pygeoif tests yamllint .github/workflows/ - name: Check complexity run: | @@ -78,7 +78,7 @@ jobs: pip install pytest typing_extensions - name: Test with pytest run: | - pytest pygeoif + pytest tests publish: if: "github.event_name == 'push' && github.repository == 'cleder/pygeoif'" diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 5a71c48a..622cbd36 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -97,10 +97,10 @@ repos: # rev: v1.0.1 # hooks: # - id: rst-linter - # - repo: https://github.com/mgedmin/check-manifest - # rev: "0.49" - # hooks: - # - id: check-manifest + - repo: https://github.com/mgedmin/check-manifest + rev: "0.49" + hooks: + - id: check-manifest - repo: https://github.com/python-jsonschema/check-jsonschema rev: "0.22.0" hooks: diff --git a/MANIFEST.in b/MANIFEST.in index f2aaed0c..3f1f5cd2 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -4,3 +4,4 @@ recursive-exclude *.pyc *.pyo include docs/LICENSE.GPL include pygeoif/py.typed exclude pygeoif/.* +recursive-include tests *.py From 266c72d3012ed663007ad28d53d15a1585e39691 Mon Sep 17 00:00:00 2001 From: Christian Ledermann Date: Sun, 26 Mar 2023 22:01:04 +0100 Subject: [PATCH 33/66] version 1.0.1 --- pyproject.toml | 1 + setup.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 28042b2c..7d93569f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -48,3 +48,4 @@ reportMissingTypeStubs = true [tool.ruff.per-file-ignores] "tests/*.py" = ["D103"] +"setup.py" = ["E501"] diff --git a/setup.py b/setup.py index 6f8f4493..6f64f928 100644 --- a/setup.py +++ b/setup.py @@ -25,7 +25,7 @@ def run_tests(self) -> None: sys.exit(errno) -version = "1.0.0" +version = "1.0.1" with open("README.rst", encoding="utf-8") as readme: README = readme.read() From fffd9fb4e76476ac5431cc7811c30869ca17ff02 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 27 Mar 2023 16:54:35 +0000 Subject: [PATCH 34/66] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - https://github.com/ikamensh/flynt/: 0.77 → 0.78 --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 622cbd36..4f9342ac 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -24,7 +24,7 @@ repos: - id: requirements-txt-fixer - id: trailing-whitespace - repo: https://github.com/ikamensh/flynt/ - rev: '0.77' + rev: '0.78' hooks: - id: flynt - repo: https://github.com/MarcoGorelli/absolufy-imports From 916b6f5aa17b1346e2140f978d064aad3dd88fd4 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 3 Apr 2023 17:07:20 +0000 Subject: [PATCH 35/66] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/hakancelikdev/unimport: 0.14.1 → 0.15.0](https://github.com/hakancelikdev/unimport/compare/0.14.1...0.15.0) - [github.com/psf/black: 23.1.0 → 23.3.0](https://github.com/psf/black/compare/23.1.0...23.3.0) - [github.com/charliermarsh/ruff-pre-commit: v0.0.259 → v0.0.260](https://github.com/charliermarsh/ruff-pre-commit/compare/v0.0.259...v0.0.260) --- .pre-commit-config.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 4f9342ac..00aa41b3 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -32,7 +32,7 @@ repos: hooks: - id: absolufy-imports - repo: https://github.com/hakancelikdev/unimport - rev: 0.14.1 + rev: 0.15.0 hooks: - id: unimport args: [--remove, --include-star-import, --ignore-init, --gitignore] @@ -46,11 +46,11 @@ repos: # - id: remove-print-statements # args: ['--verbose'] # Show all the print statements to be removed - repo: https://github.com/psf/black - rev: 23.1.0 + rev: 23.3.0 hooks: - id: black - repo: https://github.com/charliermarsh/ruff-pre-commit - rev: 'v0.0.259' + rev: 'v0.0.260' hooks: - id: ruff - repo: https://github.com/PyCQA/flake8 From dfbe82a0642952ad73741599a0a05bec9bbf7b6a Mon Sep 17 00:00:00 2001 From: Christian Ledermann Date: Mon, 3 Apr 2023 21:59:04 +0100 Subject: [PATCH 36/66] test nested geometry collections --- tests/test_geometrycollection.py | 92 ++++++++++++++++++++++++++++++++ 1 file changed, 92 insertions(+) diff --git a/tests/test_geometrycollection.py b/tests/test_geometrycollection.py index e383a0bf..b1677708 100644 --- a/tests/test_geometrycollection.py +++ b/tests/test_geometrycollection.py @@ -264,3 +264,95 @@ def test_empty_bounds() -> None: gc = geometry.GeometryCollection([]) assert gc.bounds == () + + +def test_multipoint_wkt() -> None: + multipoint = geometry.MultiPoint([(0, 0), (1, 1), (1, 2), (2, 2)]) + gc = geometry.GeometryCollection([multipoint]) + + assert gc.wkt == "GEOMETRYCOLLECTION(MULTIPOINT(0 0, 1 1, 1 2, 2 2))" + + +def test_multipoint_repr() -> None: + multipoint = geometry.MultiPoint([(0, 0), (1, 1), (1, 2), (2, 2)]) + gc = geometry.GeometryCollection([multipoint]) + + assert ( + repr(gc) + == "GeometryCollection((MultiPoint(((0, 0), (1, 1), (1, 2), (2, 2))),))" + ) + + +def test_multipoint_geo_interface() -> None: + multipoint = geometry.MultiPoint([(0, 0), (1, 1), (1, 2), (2, 2)]) + gc = geometry.GeometryCollection([multipoint]) + + assert gc.__geo_interface__ == { + "type": "GeometryCollection", + "geometries": ( + { + "type": "MultiPoint", + "coordinates": ((0, 0), (1, 1), (1, 2), (2, 2)), + "bbox": (0, 0, 2, 2), + }, + ), + } + + +def test_nested_geometry_collection() -> None: + multipoint = geometry.MultiPoint([(0, 0), (1, 1), (1, 2), (2, 2)]) + gc1 = geometry.GeometryCollection([geometry.Point(0, 0), multipoint]) + line = geometry.LineString([(0, 0), (3, 1)]) + gc2 = geometry.GeometryCollection([gc1, line]) + poly1 = geometry.Polygon([(0, 0), (1, 1), (1, 0), (0, 0)]) + gc3 = geometry.GeometryCollection([gc2, poly1]) + + assert gc3.wkt == ( + "GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(" + "POINT (0 0), MULTIPOINT(0 0, 1 1, 1 2, 2 2)), LINESTRING (0 0, 3 1)), " + "POLYGON ((0 0, 1 1, 1 0, 0 0)))" + ) + + +def test_nested_geometry_collection_geo_interface() -> None: + multipoint = geometry.MultiPoint([(0, 0), (1, 1), (1, 2), (2, 2)]) + gc1 = geometry.GeometryCollection([geometry.Point(0, 0), multipoint]) + line = geometry.LineString([(0, 0), (3, 1)]) + gc2 = geometry.GeometryCollection([gc1, line]) + poly1 = geometry.Polygon([(0, 0), (1, 1), (1, 0), (0, 0)]) + gc3 = geometry.GeometryCollection([gc2, poly1]) + assert gc3.__geo_interface__ == { + "geometries": ( + { + "geometries": ( + { + "geometries": ( + { + "bbox": (0, 0, 0, 0), + "coordinates": (0, 0), + "type": "Point", + }, + { + "bbox": (0, 0, 2, 2), + "coordinates": ((0, 0), (1, 1), (1, 2), (2, 2)), + "type": "MultiPoint", + }, + ), + "type": "GeometryCollection", + }, + { + "bbox": (0, 0, 3, 1), + "coordinates": ((0, 0), (3, 1)), + "type": "LineString", + }, + ), + "type": "GeometryCollection", + }, + { + "bbox": (0, 0, 1, 1), + "coordinates": (((0, 0), (1, 1), (1, 0), (0, 0)),), + "type": "Polygon", + }, + ), + "type": "GeometryCollection", + } From 4edd63130d1f2ef629a418f2228f0a3ddc39759b Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 24 Apr 2023 16:58:05 +0000 Subject: [PATCH 37/66] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/hakancelikdev/unimport: 0.15.0 → 0.16.0](https://github.com/hakancelikdev/unimport/compare/0.15.0...0.16.0) - [github.com/charliermarsh/ruff-pre-commit: v0.0.260 → v0.0.262](https://github.com/charliermarsh/ruff-pre-commit/compare/v0.0.260...v0.0.262) - [github.com/pre-commit/mirrors-mypy: v1.1.1 → v1.2.0](https://github.com/pre-commit/mirrors-mypy/compare/v1.1.1...v1.2.0) --- .pre-commit-config.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 00aa41b3..a59e3131 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -32,7 +32,7 @@ repos: hooks: - id: absolufy-imports - repo: https://github.com/hakancelikdev/unimport - rev: 0.15.0 + rev: 0.16.0 hooks: - id: unimport args: [--remove, --include-star-import, --ignore-init, --gitignore] @@ -50,7 +50,7 @@ repos: hooks: - id: black - repo: https://github.com/charliermarsh/ruff-pre-commit - rev: 'v0.0.260' + rev: 'v0.0.262' hooks: - id: ruff - repo: https://github.com/PyCQA/flake8 @@ -90,7 +90,7 @@ repos: # - flake8-use-fstring - pep8-naming - repo: https://github.com/pre-commit/mirrors-mypy - rev: v1.1.1 + rev: v1.2.0 hooks: - id: mypy # - repo: https://github.com/Lucas-C/pre-commit-hooks-markup From 958a2b7adf7ff6b468c09652c03a82f6f1991cc6 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 1 May 2023 17:00:54 +0000 Subject: [PATCH 38/66] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/charliermarsh/ruff-pre-commit: v0.0.262 → v0.0.263](https://github.com/charliermarsh/ruff-pre-commit/compare/v0.0.262...v0.0.263) --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index a59e3131..ef117022 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -50,7 +50,7 @@ repos: hooks: - id: black - repo: https://github.com/charliermarsh/ruff-pre-commit - rev: 'v0.0.262' + rev: 'v0.0.263' hooks: - id: ruff - repo: https://github.com/PyCQA/flake8 From 1fec3331eb8e98455ab613c2be6a0a212433c8f3 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 8 May 2023 17:01:20 +0000 Subject: [PATCH 39/66] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/charliermarsh/ruff-pre-commit: v0.0.263 → v0.0.265](https://github.com/charliermarsh/ruff-pre-commit/compare/v0.0.263...v0.0.265) - [github.com/python-jsonschema/check-jsonschema: 0.22.0 → 0.23.0](https://github.com/python-jsonschema/check-jsonschema/compare/0.22.0...0.23.0) --- .pre-commit-config.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index ef117022..0daa6d7a 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -50,7 +50,7 @@ repos: hooks: - id: black - repo: https://github.com/charliermarsh/ruff-pre-commit - rev: 'v0.0.263' + rev: 'v0.0.265' hooks: - id: ruff - repo: https://github.com/PyCQA/flake8 @@ -102,7 +102,7 @@ repos: hooks: - id: check-manifest - repo: https://github.com/python-jsonschema/check-jsonschema - rev: "0.22.0" + rev: "0.23.0" hooks: - id: check-github-workflows - id: check-github-actions From 8dbe4eabbce251713f36e843281738259d4a09de Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 15 May 2023 16:56:25 +0000 Subject: [PATCH 40/66] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/charliermarsh/ruff-pre-commit: v0.0.265 → v0.0.267](https://github.com/charliermarsh/ruff-pre-commit/compare/v0.0.265...v0.0.267) - [github.com/pre-commit/mirrors-mypy: v1.2.0 → v1.3.0](https://github.com/pre-commit/mirrors-mypy/compare/v1.2.0...v1.3.0) --- .pre-commit-config.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 0daa6d7a..1ad2f909 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -50,7 +50,7 @@ repos: hooks: - id: black - repo: https://github.com/charliermarsh/ruff-pre-commit - rev: 'v0.0.265' + rev: 'v0.0.267' hooks: - id: ruff - repo: https://github.com/PyCQA/flake8 @@ -90,7 +90,7 @@ repos: # - flake8-use-fstring - pep8-naming - repo: https://github.com/pre-commit/mirrors-mypy - rev: v1.2.0 + rev: v1.3.0 hooks: - id: mypy # - repo: https://github.com/Lucas-C/pre-commit-hooks-markup From 87a6d0a22335a99e76b4eb1a6d4d105e53637c4f Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 22 May 2023 16:54:58 +0000 Subject: [PATCH 41/66] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/charliermarsh/ruff-pre-commit: v0.0.267 → v0.0.269](https://github.com/charliermarsh/ruff-pre-commit/compare/v0.0.267...v0.0.269) --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 1ad2f909..81a48c10 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -50,7 +50,7 @@ repos: hooks: - id: black - repo: https://github.com/charliermarsh/ruff-pre-commit - rev: 'v0.0.267' + rev: 'v0.0.269' hooks: - id: ruff - repo: https://github.com/PyCQA/flake8 From 81a4eaa3f9fe518c161e8be10090fd0f464789a7 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 29 May 2023 16:53:29 +0000 Subject: [PATCH 42/66] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/charliermarsh/ruff-pre-commit: v0.0.269 → v0.0.270](https://github.com/charliermarsh/ruff-pre-commit/compare/v0.0.269...v0.0.270) --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 81a48c10..012c92ce 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -50,7 +50,7 @@ repos: hooks: - id: black - repo: https://github.com/charliermarsh/ruff-pre-commit - rev: 'v0.0.269' + rev: 'v0.0.270' hooks: - id: ruff - repo: https://github.com/PyCQA/flake8 From ed2176c3a9bcf79dbbe858ef73c3211130907c7c Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 5 Jun 2023 16:55:51 +0000 Subject: [PATCH 43/66] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/python-jsonschema/check-jsonschema: 0.23.0 → 0.23.1](https://github.com/python-jsonschema/check-jsonschema/compare/0.23.0...0.23.1) --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 012c92ce..17e1fe79 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -102,7 +102,7 @@ repos: hooks: - id: check-manifest - repo: https://github.com/python-jsonschema/check-jsonschema - rev: "0.23.0" + rev: "0.23.1" hooks: - id: check-github-workflows - id: check-github-actions From f3d92b8b877351ff8aee16fe1d925b0c35b1eecf Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 12 Jun 2023 17:01:03 +0000 Subject: [PATCH 44/66] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/charliermarsh/ruff-pre-commit: v0.0.270 → v0.0.272](https://github.com/charliermarsh/ruff-pre-commit/compare/v0.0.270...v0.0.272) --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 17e1fe79..a1bc139b 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -50,7 +50,7 @@ repos: hooks: - id: black - repo: https://github.com/charliermarsh/ruff-pre-commit - rev: 'v0.0.270' + rev: 'v0.0.272' hooks: - id: ruff - repo: https://github.com/PyCQA/flake8 From 581215de117a62f447951b615ed685f322cc390a Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 19 Jun 2023 17:01:56 +0000 Subject: [PATCH 45/66] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/python-jsonschema/check-jsonschema: 0.23.1 → 0.23.2](https://github.com/python-jsonschema/check-jsonschema/compare/0.23.1...0.23.2) --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index a1bc139b..aebae528 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -102,7 +102,7 @@ repos: hooks: - id: check-manifest - repo: https://github.com/python-jsonschema/check-jsonschema - rev: "0.23.1" + rev: "0.23.2" hooks: - id: check-github-workflows - id: check-github-actions From ccbb59d312fcc56d87a5d5ee0da16672c3bb3267 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 26 Jun 2023 16:58:59 +0000 Subject: [PATCH 46/66] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/charliermarsh/ruff-pre-commit: v0.0.272 → v0.0.275](https://github.com/charliermarsh/ruff-pre-commit/compare/v0.0.272...v0.0.275) - [github.com/pre-commit/mirrors-mypy: v1.3.0 → v1.4.1](https://github.com/pre-commit/mirrors-mypy/compare/v1.3.0...v1.4.1) --- .pre-commit-config.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index aebae528..8bb5b5c8 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -50,7 +50,7 @@ repos: hooks: - id: black - repo: https://github.com/charliermarsh/ruff-pre-commit - rev: 'v0.0.272' + rev: 'v0.0.275' hooks: - id: ruff - repo: https://github.com/PyCQA/flake8 @@ -90,7 +90,7 @@ repos: # - flake8-use-fstring - pep8-naming - repo: https://github.com/pre-commit/mirrors-mypy - rev: v1.3.0 + rev: v1.4.1 hooks: - id: mypy # - repo: https://github.com/Lucas-C/pre-commit-hooks-markup From 95c312a9a9e6fc58b2fd8b828ee087c97821a88b Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 17 Jul 2023 17:07:34 +0000 Subject: [PATCH 47/66] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - https://github.com/ikamensh/flynt/: 0.78 → 1.0.0 - [github.com/hakancelikdev/unimport: 0.16.0 → 1.0.0](https://github.com/hakancelikdev/unimport/compare/0.16.0...1.0.0) - [github.com/psf/black: 23.3.0 → 23.7.0](https://github.com/psf/black/compare/23.3.0...23.7.0) - https://github.com/charliermarsh/ruff-pre-commit → https://github.com/astral-sh/ruff-pre-commit - [github.com/astral-sh/ruff-pre-commit: v0.0.275 → v0.0.278](https://github.com/astral-sh/ruff-pre-commit/compare/v0.0.275...v0.0.278) - [github.com/python-jsonschema/check-jsonschema: 0.23.2 → 0.23.3](https://github.com/python-jsonschema/check-jsonschema/compare/0.23.2...0.23.3) --- .pre-commit-config.yaml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 8bb5b5c8..100594ee 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -24,7 +24,7 @@ repos: - id: requirements-txt-fixer - id: trailing-whitespace - repo: https://github.com/ikamensh/flynt/ - rev: '0.78' + rev: '1.0.0' hooks: - id: flynt - repo: https://github.com/MarcoGorelli/absolufy-imports @@ -32,7 +32,7 @@ repos: hooks: - id: absolufy-imports - repo: https://github.com/hakancelikdev/unimport - rev: 0.16.0 + rev: 1.0.0 hooks: - id: unimport args: [--remove, --include-star-import, --ignore-init, --gitignore] @@ -46,11 +46,11 @@ repos: # - id: remove-print-statements # args: ['--verbose'] # Show all the print statements to be removed - repo: https://github.com/psf/black - rev: 23.3.0 + rev: 23.7.0 hooks: - id: black - - repo: https://github.com/charliermarsh/ruff-pre-commit - rev: 'v0.0.275' + - repo: https://github.com/astral-sh/ruff-pre-commit + rev: 'v0.0.278' hooks: - id: ruff - repo: https://github.com/PyCQA/flake8 @@ -102,7 +102,7 @@ repos: hooks: - id: check-manifest - repo: https://github.com/python-jsonschema/check-jsonschema - rev: "0.23.2" + rev: "0.23.3" hooks: - id: check-github-workflows - id: check-github-actions From a375076e4c5546a4596149aadbe9a6bd609b0884 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 24 Jul 2023 16:58:52 +0000 Subject: [PATCH 48/66] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/astral-sh/ruff-pre-commit: v0.0.278 → v0.0.280](https://github.com/astral-sh/ruff-pre-commit/compare/v0.0.278...v0.0.280) --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 100594ee..1b90c46d 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -50,7 +50,7 @@ repos: hooks: - id: black - repo: https://github.com/astral-sh/ruff-pre-commit - rev: 'v0.0.278' + rev: 'v0.0.280' hooks: - id: ruff - repo: https://github.com/PyCQA/flake8 From be5fcc96be786f30110d80f316f9aa21991ff24f Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 31 Jul 2023 17:08:14 +0000 Subject: [PATCH 49/66] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - https://github.com/ikamensh/flynt/: 1.0.0 → 1.0.1 - [github.com/PyCQA/flake8: 6.0.0 → 6.1.0](https://github.com/PyCQA/flake8/compare/6.0.0...6.1.0) --- .pre-commit-config.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 1b90c46d..5d34f195 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -24,7 +24,7 @@ repos: - id: requirements-txt-fixer - id: trailing-whitespace - repo: https://github.com/ikamensh/flynt/ - rev: '1.0.0' + rev: '1.0.1' hooks: - id: flynt - repo: https://github.com/MarcoGorelli/absolufy-imports @@ -54,7 +54,7 @@ repos: hooks: - id: ruff - repo: https://github.com/PyCQA/flake8 - rev: 6.0.0 + rev: 6.1.0 hooks: - id: flake8 additional_dependencies: From 0dfad1a56950dc2cc2e8b1a8731ad96f97a66317 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 7 Aug 2023 17:02:21 +0000 Subject: [PATCH 50/66] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/astral-sh/ruff-pre-commit: v0.0.280 → v0.0.282](https://github.com/astral-sh/ruff-pre-commit/compare/v0.0.280...v0.0.282) --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 5d34f195..6f291890 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -50,7 +50,7 @@ repos: hooks: - id: black - repo: https://github.com/astral-sh/ruff-pre-commit - rev: 'v0.0.280' + rev: 'v0.0.282' hooks: - id: ruff - repo: https://github.com/PyCQA/flake8 From 10f307ba7f93e555135401ea9fee95368cd075a0 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 28 Aug 2023 17:02:22 +0000 Subject: [PATCH 51/66] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/astral-sh/ruff-pre-commit: v0.0.282 → v0.0.286](https://github.com/astral-sh/ruff-pre-commit/compare/v0.0.282...v0.0.286) - [github.com/pre-commit/mirrors-mypy: v1.4.1 → v1.5.1](https://github.com/pre-commit/mirrors-mypy/compare/v1.4.1...v1.5.1) - [github.com/python-jsonschema/check-jsonschema: 0.23.3 → 0.26.3](https://github.com/python-jsonschema/check-jsonschema/compare/0.23.3...0.26.3) --- .pre-commit-config.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 6f291890..151610ed 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -50,7 +50,7 @@ repos: hooks: - id: black - repo: https://github.com/astral-sh/ruff-pre-commit - rev: 'v0.0.282' + rev: 'v0.0.286' hooks: - id: ruff - repo: https://github.com/PyCQA/flake8 @@ -90,7 +90,7 @@ repos: # - flake8-use-fstring - pep8-naming - repo: https://github.com/pre-commit/mirrors-mypy - rev: v1.4.1 + rev: v1.5.1 hooks: - id: mypy # - repo: https://github.com/Lucas-C/pre-commit-hooks-markup @@ -102,7 +102,7 @@ repos: hooks: - id: check-manifest - repo: https://github.com/python-jsonschema/check-jsonschema - rev: "0.23.3" + rev: "0.26.3" hooks: - id: check-github-workflows - id: check-github-actions From 688e3859c0669ca3e0271348f0084c57f7b9ebc0 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 4 Sep 2023 17:04:59 +0000 Subject: [PATCH 52/66] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/astral-sh/ruff-pre-commit: v0.0.286 → v0.0.287](https://github.com/astral-sh/ruff-pre-commit/compare/v0.0.286...v0.0.287) --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 151610ed..8a7dd7cf 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -50,7 +50,7 @@ repos: hooks: - id: black - repo: https://github.com/astral-sh/ruff-pre-commit - rev: 'v0.0.286' + rev: 'v0.0.287' hooks: - id: ruff - repo: https://github.com/PyCQA/flake8 From 83e5c83fb0f73c8197dc3787a266d7b6c3dc0342 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 4 Sep 2023 18:33:26 +0000 Subject: [PATCH 53/66] Bump actions/checkout from 3 to 4 Bumps [actions/checkout](https://github.com/actions/checkout) from 3 to 4. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/checkout/compare/v3...v4) --- updated-dependencies: - dependency-name: actions/checkout dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/codeql-analysis.yml | 2 +- .github/workflows/run-all-tests.yml | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index ed464619..2721ebe9 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -39,7 +39,7 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL diff --git a/.github/workflows/run-all-tests.yml b/.github/workflows/run-all-tests.yml index 12e195f3..bdb727c3 100644 --- a/.github/workflows/run-all-tests.yml +++ b/.github/workflows/run-all-tests.yml @@ -12,7 +12,7 @@ jobs: python-version: ['3.7', '3.8', '3.9', '3.10', '3.11', '3.12-dev'] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v4 with: @@ -38,7 +38,7 @@ jobs: python-version: ['3.10'] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v4 with: @@ -67,7 +67,7 @@ jobs: matrix: pypy-version: ['pypy-3.7', 'pypy-3.8', 'pypy-3.9'] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up Python ${{ matrix.pypy-version }} uses: actions/setup-python@v4 with: @@ -86,7 +86,7 @@ jobs: name: Build and publish to PyPI and TestPyPI runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up Python 3.9 uses: actions/setup-python@v4 with: From 88d785aaf89d80f41b2468180f37dfdf1aa286cc Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 11 Sep 2023 17:08:15 +0000 Subject: [PATCH 54/66] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/psf/black: 23.7.0 → 23.9.1](https://github.com/psf/black/compare/23.7.0...23.9.1) --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 8a7dd7cf..228dd4c1 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -46,7 +46,7 @@ repos: # - id: remove-print-statements # args: ['--verbose'] # Show all the print statements to be removed - repo: https://github.com/psf/black - rev: 23.7.0 + rev: 23.9.1 hooks: - id: black - repo: https://github.com/astral-sh/ruff-pre-commit From 16084c188c39649a27bb59da3ce73eaae53b443f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 14 Sep 2023 19:01:00 +0000 Subject: [PATCH 55/66] Bump codecov/codecov-action from 3 to 4 Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from 3 to 4. - [Release notes](https://github.com/codecov/codecov-action/releases) - [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md) - [Commits](https://github.com/codecov/codecov-action/compare/v3...v4) --- updated-dependencies: - dependency-name: codecov/codecov-action dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/run-all-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/run-all-tests.yml b/.github/workflows/run-all-tests.yml index bdb727c3..d0a67903 100644 --- a/.github/workflows/run-all-tests.yml +++ b/.github/workflows/run-all-tests.yml @@ -26,7 +26,7 @@ jobs: pytest tests --cov=tests --cov=pygeoif --cov-fail-under=100 --cov-report=xml - name: "Upload coverage to Codecov" if: ${{ matrix.python-version==3.11 }} - uses: codecov/codecov-action@v3 + uses: codecov/codecov-action@v4 with: fail_ci_if_error: true verbose: true From 8cd8beff34da786b27ed0c9462d2e8963fc1dc4c Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 9 Oct 2023 16:36:42 +0000 Subject: [PATCH 56/66] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/pre-commit/pre-commit-hooks: v4.4.0 → v4.5.0](https://github.com/pre-commit/pre-commit-hooks/compare/v4.4.0...v4.5.0) - [github.com/astral-sh/ruff-pre-commit: v0.0.287 → v0.0.292](https://github.com/astral-sh/ruff-pre-commit/compare/v0.0.287...v0.0.292) - [github.com/python-jsonschema/check-jsonschema: 0.26.3 → 0.27.0](https://github.com/python-jsonschema/check-jsonschema/compare/0.26.3...0.27.0) --- .pre-commit-config.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 228dd4c1..01ad2a38 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -4,7 +4,7 @@ repos: hooks: - id: check-useless-excludes - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.4.0 + rev: v4.5.0 hooks: - id: check-added-large-files - id: check-docstring-first @@ -50,7 +50,7 @@ repos: hooks: - id: black - repo: https://github.com/astral-sh/ruff-pre-commit - rev: 'v0.0.287' + rev: 'v0.0.292' hooks: - id: ruff - repo: https://github.com/PyCQA/flake8 @@ -102,7 +102,7 @@ repos: hooks: - id: check-manifest - repo: https://github.com/python-jsonschema/check-jsonschema - rev: "0.26.3" + rev: "0.27.0" hooks: - id: check-github-workflows - id: check-github-actions From 09b043532bc538cceb79b452073611c3ec9c861e Mon Sep 17 00:00:00 2001 From: Christian Ledermann Date: Thu, 12 Oct 2023 21:10:57 +0100 Subject: [PATCH 57/66] raise dimension error --- pygeoif/geometry.py | 8 +++----- tests/test_point.py | 11 ++++++++++- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/pygeoif/geometry.py b/pygeoif/geometry.py index bbf7ff13..5e238dbd 100644 --- a/pygeoif/geometry.py +++ b/pygeoif/geometry.py @@ -251,11 +251,9 @@ def y(self) -> float: @property def z(self) -> Optional[float]: """Return z coordinate.""" - return ( - self._coordinates[2] # type: ignore[misc] - if len(self._coordinates) == 3 - else None - ) + if self.has_z: + return self._coordinates[2] # type: ignore [misc] + raise DimensionError(f"The {self!r} geometry does not have z values") @property def coords(self) -> Tuple[PointType]: diff --git a/tests/test_point.py b/tests/test_point.py index 3bca9685..9a82b282 100644 --- a/tests/test_point.py +++ b/tests/test_point.py @@ -5,6 +5,7 @@ import pytest from pygeoif import geometry +from pygeoif.exceptions import DimensionError def test_empty() -> None: @@ -52,11 +53,19 @@ def test_bounds3d() -> None: def test_xy() -> None: point = geometry.Point(1.0, 0.0) - assert point.z is None assert point.x == 1 assert point.y == 0 +def test_xy_raises_error_accessing_z() -> None: + point = geometry.Point(1, 0) + + with pytest.raises( + DimensionError, match=r"^The Point\(1, 0\) geometry does not have z values$" + ): + point.z + + def test_xyz() -> None: point = geometry.Point(1.0, 0.0, 2.0) From 0b322cf0588591d63e253dc110e5546dec96c3c9 Mon Sep 17 00:00:00 2001 From: Christian Ledermann Date: Thu, 12 Oct 2023 22:25:10 +0100 Subject: [PATCH 58/66] add test for nested multigeometries --- .github/workflows/run-all-tests.yml | 4 ++-- pygeoif/geometry.py | 4 ++-- tests/test_geometrycollection.py | 15 +++++++++++++++ 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/.github/workflows/run-all-tests.yml b/.github/workflows/run-all-tests.yml index d0a67903..250d473d 100644 --- a/.github/workflows/run-all-tests.yml +++ b/.github/workflows/run-all-tests.yml @@ -9,7 +9,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: ['3.7', '3.8', '3.9', '3.10', '3.11', '3.12-dev'] + python-version: ['3.7', '3.8', '3.9', '3.10', '3.11', '3.12'] steps: - uses: actions/checkout@v4 @@ -26,7 +26,7 @@ jobs: pytest tests --cov=tests --cov=pygeoif --cov-fail-under=100 --cov-report=xml - name: "Upload coverage to Codecov" if: ${{ matrix.python-version==3.11 }} - uses: codecov/codecov-action@v4 + uses: codecov/codecov-action@v3 with: fail_ci_if_error: true verbose: true diff --git a/pygeoif/geometry.py b/pygeoif/geometry.py index 5e238dbd..a0c074b7 100644 --- a/pygeoif/geometry.py +++ b/pygeoif/geometry.py @@ -1,5 +1,5 @@ # -# Copyright (C) 2012 -2022 Christian Ledermann +# Copyright (C) 2012 -2023 Christian Ledermann # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -1042,7 +1042,7 @@ def __eq__(self, other: object) -> bool: [], ), ) - ), + ) ) def __len__(self) -> int: diff --git a/tests/test_geometrycollection.py b/tests/test_geometrycollection.py index b1677708..e5ff3cfc 100644 --- a/tests/test_geometrycollection.py +++ b/tests/test_geometrycollection.py @@ -1,4 +1,6 @@ """Test Baseclass.""" +import pytest + from pygeoif import geometry @@ -356,3 +358,16 @@ def test_nested_geometry_collection_geo_interface() -> None: ), "type": "GeometryCollection", } + + +@pytest.mark.xfail(reason="Not implemented yet") +def test_nested_geometry_collection_eq() -> None: + multipoint = geometry.MultiPoint([(0, 0), (1, 1), (1, 2), (2, 2)]) + gc1 = geometry.GeometryCollection([geometry.Point(0, 0), multipoint]) + line = geometry.LineString([(0, 0), (3, 1)]) + gc2 = geometry.GeometryCollection([gc1, line]) + poly1 = geometry.Polygon([(0, 0), (1, 1), (1, 0), (0, 0)]) + gc3 = geometry.GeometryCollection([gc2, poly1]) + gc4 = geometry.GeometryCollection([gc2, poly1]) + + assert gc3 == gc4 From c2770ac980e17fbc56d6ee680838f7a46d245b4c Mon Sep 17 00:00:00 2001 From: Christian Ledermann Date: Fri, 13 Oct 2023 00:22:34 +0100 Subject: [PATCH 59/66] Fix __eq__ for nested Geometrycollections --- pygeoif/factories.py | 2 +- pygeoif/functions.py | 27 ++++++++++++++++++++++++++- pygeoif/geometry.py | 20 +++++++------------- pygeoif/types.py | 5 +++-- tests/test_geometrycollection.py | 2 -- 5 files changed, 37 insertions(+), 19 deletions(-) diff --git a/pygeoif/factories.py b/pygeoif/factories.py index 61a47a36..582464e4 100644 --- a/pygeoif/factories.py +++ b/pygeoif/factories.py @@ -155,7 +155,7 @@ def shape( shape(fi) for fi in geometry["geometries"] # type: ignore [typeddict-item] ] return GeometryCollection(geometries) # type: ignore [arg-type] - raise NotImplementedError(f"[{geometry['type']} is nor implemented") + raise NotImplementedError(f"[{geometry['type']} is not implemented") def num(number: str) -> float: diff --git a/pygeoif/functions.py b/pygeoif/functions.py index b1b1c375..5a317380 100644 --- a/pygeoif/functions.py +++ b/pygeoif/functions.py @@ -26,6 +26,8 @@ from typing import cast from pygeoif.types import CoordinatesType +from pygeoif.types import GeoCollectionInterface +from pygeoif.types import GeoInterface from pygeoif.types import LineType from pygeoif.types import MultiCoordinatesType from pygeoif.types import Point2D @@ -74,7 +76,8 @@ def centroid(coords: LineType) -> Tuple[Point2D, float]: def _cross(o: Point2D, a: Point2D, b: Point2D) -> float: - """2D cross product of OA and OB vectors, i.e. z-component of their 3D cross product. + """ + 2D cross product of OA and OB vectors, i.e. z-component of their 3D cross product. Returns a positive value, if OAB makes a counter-clockwise turn, negative for clockwise turn, and zero if the points are collinear. @@ -157,6 +160,28 @@ def compare_coordinates( return False +def compare_geo_interface( + if1: Union[GeoInterface, GeoCollectionInterface], + if2: Union[GeoInterface, GeoCollectionInterface], +) -> bool: + """Compare two geo interfaces.""" + if if1["type"] != if2["type"]: + return False + if if1["type"] == "GeometryCollection": + return all( + compare_geo_interface(g1, g2) # type: ignore [arg-type] + for g1, g2 in zip_longest( + if1["geometries"], # type: ignore [typeddict-item] + if2["geometries"], # type: ignore [typeddict-item] + fillvalue={"type": None, "coordinates": ()}, + ) + ) + return compare_coordinates( + if1["coordinates"], # type: ignore [typeddict-item] + if2["coordinates"], # type: ignore [typeddict-item] + ) + + __all__ = [ "centroid", "compare_coordinates", diff --git a/pygeoif/geometry.py b/pygeoif/geometry.py index a0c074b7..669bac14 100644 --- a/pygeoif/geometry.py +++ b/pygeoif/geometry.py @@ -32,6 +32,7 @@ from pygeoif.exceptions import DimensionError from pygeoif.functions import centroid from pygeoif.functions import compare_coordinates +from pygeoif.functions import compare_geo_interface from pygeoif.functions import convex_hull from pygeoif.functions import dedupe from pygeoif.functions import signed_area @@ -1015,6 +1016,8 @@ def __eq__(self, other: object) -> bool: Types and coordinates from all contained geometries must be equal. """ try: + if self.is_empty: + return False if ( other.__geo_interface__.get("type") # type: ignore [attr-defined] != self.geom_type @@ -1031,18 +1034,9 @@ def __eq__(self, other: object) -> bool: return False except AttributeError: return False - return all( - ( - s["type"] == o.get("type") - and compare_coordinates(s["coordinates"], o.get("coordinates")) - for s, o in zip( - (geom.__geo_interface__ for geom in self.geoms), - other.__geo_interface__.get( # type: ignore [attr-defined] - "geometries", - [], - ), - ) - ) + return compare_geo_interface( + self.__geo_interface__, + other.__geo_interface__, # type: ignore [attr-defined] ) def __len__(self) -> int: @@ -1066,7 +1060,7 @@ def _wkt_coords(self) -> str: def __geo_interface__(self) -> GeoCollectionInterface: # type: ignore [override] """Return the geo interface of the collection.""" return { - "type": self.geom_type, + "type": "GeometryCollection", "geometries": tuple(geom.__geo_interface__ for geom in self.geoms), } diff --git a/pygeoif/types.py b/pygeoif/types.py index 53f8e93b..fd86d0ad 100644 --- a/pygeoif/types.py +++ b/pygeoif/types.py @@ -22,6 +22,7 @@ from typing import Tuple from typing import Union +from typing_extensions import Literal from typing_extensions import Protocol from typing_extensions import TypedDict @@ -63,8 +64,8 @@ class GeoInterface(GeoInterfaceBase, total=False): class GeoCollectionInterface(TypedDict): """Geometry Collection Interface.""" - type: str - geometries: Sequence[GeoInterface] + type: Literal["GeometryCollection"] + geometries: Sequence[Union[GeoInterface, "GeoCollectionInterface"]] class GeoFeatureInterfaceBase(TypedDict): diff --git a/tests/test_geometrycollection.py b/tests/test_geometrycollection.py index e5ff3cfc..7573503d 100644 --- a/tests/test_geometrycollection.py +++ b/tests/test_geometrycollection.py @@ -1,5 +1,4 @@ """Test Baseclass.""" -import pytest from pygeoif import geometry @@ -360,7 +359,6 @@ def test_nested_geometry_collection_geo_interface() -> None: } -@pytest.mark.xfail(reason="Not implemented yet") def test_nested_geometry_collection_eq() -> None: multipoint = geometry.MultiPoint([(0, 0), (1, 1), (1, 2), (2, 2)]) gc1 = geometry.GeometryCollection([geometry.Point(0, 0), multipoint]) From b2e6603274cdd64c0e2d1f236070c51cf37b7adb Mon Sep 17 00:00:00 2001 From: Christian Ledermann Date: Fri, 13 Oct 2023 00:43:12 +0100 Subject: [PATCH 60/66] add missing test --- tests/test_geometrycollection.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/test_geometrycollection.py b/tests/test_geometrycollection.py index 7573503d..3f12b0fe 100644 --- a/tests/test_geometrycollection.py +++ b/tests/test_geometrycollection.py @@ -369,3 +369,11 @@ def test_nested_geometry_collection_eq() -> None: gc4 = geometry.GeometryCollection([gc2, poly1]) assert gc3 == gc4 + + +def test_geometry_collection_neq_when_empty() -> None: + gc1 = geometry.GeometryCollection([]) + gc2 = geometry.GeometryCollection([geometry.Point(0, 0)]) + + assert gc1 != gc2 + assert gc2 != gc1 From 599b80290f18391e69a12d36fa126c360481e886 Mon Sep 17 00:00:00 2001 From: Christian Ledermann Date: Fri, 13 Oct 2023 00:48:19 +0100 Subject: [PATCH 61/66] add pypy 3.10 to test matrix --- .github/workflows/run-all-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/run-all-tests.yml b/.github/workflows/run-all-tests.yml index 250d473d..8548df44 100644 --- a/.github/workflows/run-all-tests.yml +++ b/.github/workflows/run-all-tests.yml @@ -65,7 +65,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - pypy-version: ['pypy-3.7', 'pypy-3.8', 'pypy-3.9'] + pypy-version: ['pypy-3.7', 'pypy-3.8', 'pypy-3.9', 'pypy-3.10'] steps: - uses: actions/checkout@v4 - name: Set up Python ${{ matrix.pypy-version }} From 82212136bc710b980ed92695a80c80beb0e04f8b Mon Sep 17 00:00:00 2001 From: Christian Ledermann Date: Fri, 13 Oct 2023 00:57:44 +0100 Subject: [PATCH 62/66] fix tests --- .github/workflows/codeball.yml | 12 ------------ tests/test_factories.py | 6 +++--- 2 files changed, 3 insertions(+), 15 deletions(-) delete mode 100644 .github/workflows/codeball.yml diff --git a/.github/workflows/codeball.yml b/.github/workflows/codeball.yml deleted file mode 100644 index ea0bf4a8..00000000 --- a/.github/workflows/codeball.yml +++ /dev/null @@ -1,12 +0,0 @@ -name: Codeball -on: [pull_request] - -jobs: - codeball_job: - runs-on: ubuntu-latest - name: Codeball - steps: - # Run Codeball on all new Pull Requests 🚀 - # For customizations and more documentation, see https://github.com/sturdy-dev/codeball-action - - name: Codeball - uses: sturdy-dev/codeball-action@v2 diff --git a/tests/test_factories.py b/tests/test_factories.py index 05cac7a7..d0410f93 100644 --- a/tests/test_factories.py +++ b/tests/test_factories.py @@ -8,17 +8,17 @@ def test_num_int() -> None: assert factories.num("1") == 1 - assert type(factories.num("1")) is int + assert isinstance(factories.num("1"), int) def test_num_intf() -> None: assert factories.num("1.0") == 1 - assert type(factories.num("1.0")) is int + assert isinstance(factories.num("1.0"), int) def test_num_float() -> None: assert factories.num("1.1") == 1.1 - assert type(factories.num("1.1")) is float + assert isinstance(factories.num("1.1"), float) def test_orient_true() -> None: From c49618379bc22d52bacc3ad4d2c22d7eb77d5b21 Mon Sep 17 00:00:00 2001 From: Christian Ledermann Date: Fri, 13 Oct 2023 10:17:01 +0100 Subject: [PATCH 63/66] better support for nested multi geometries --- .github/workflows/run-all-tests.yml | 2 +- pygeoif/functions.py | 36 ++++++++------ setup.py | 1 + tests/test_functions.py | 76 +++++++++++++++++++++++++++++ tests/test_geometrycollection.py | 48 ++++++++++++++++++ 5 files changed, 146 insertions(+), 17 deletions(-) diff --git a/.github/workflows/run-all-tests.yml b/.github/workflows/run-all-tests.yml index 8548df44..f16bc71e 100644 --- a/.github/workflows/run-all-tests.yml +++ b/.github/workflows/run-all-tests.yml @@ -23,7 +23,7 @@ jobs: pip install pytest pytest-cov typing_extensions - name: Test with pytest run: | - pytest tests --cov=tests --cov=pygeoif --cov-fail-under=100 --cov-report=xml + pytest tests --cov=tests --cov=pygeoif --cov-report=xml - name: "Upload coverage to Codecov" if: ${{ matrix.python-version==3.11 }} uses: codecov/codecov-action@v3 diff --git a/pygeoif/functions.py b/pygeoif/functions.py index 5a317380..1c803dc2 100644 --- a/pygeoif/functions.py +++ b/pygeoif/functions.py @@ -1,5 +1,5 @@ # -# Copyright (C) 2012 -2022 Christian Ledermann +# Copyright (C) 2012 -2023 Christian Ledermann # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -161,30 +161,34 @@ def compare_coordinates( def compare_geo_interface( - if1: Union[GeoInterface, GeoCollectionInterface], - if2: Union[GeoInterface, GeoCollectionInterface], + first: Union[GeoInterface, GeoCollectionInterface], + second: Union[GeoInterface, GeoCollectionInterface], ) -> bool: """Compare two geo interfaces.""" - if if1["type"] != if2["type"]: - return False - if if1["type"] == "GeometryCollection": - return all( - compare_geo_interface(g1, g2) # type: ignore [arg-type] - for g1, g2 in zip_longest( - if1["geometries"], # type: ignore [typeddict-item] - if2["geometries"], # type: ignore [typeddict-item] - fillvalue={"type": None, "coordinates": ()}, + try: + if first["type"] != second["type"]: + return False + if first["type"] == "GeometryCollection": + return all( + compare_geo_interface(g1, g2) # type: ignore [arg-type] + for g1, g2 in zip_longest( + first["geometries"], # type: ignore [typeddict-item] + second["geometries"], # type: ignore [typeddict-item] + fillvalue={"type": None, "coordinates": ()}, + ) ) + return compare_coordinates( + first["coordinates"], # type: ignore [typeddict-item] + second["coordinates"], # type: ignore [typeddict-item] ) - return compare_coordinates( - if1["coordinates"], # type: ignore [typeddict-item] - if2["coordinates"], # type: ignore [typeddict-item] - ) + except KeyError: + return False __all__ = [ "centroid", "compare_coordinates", + "compare_geo_interface", "convex_hull", "dedupe", "signed_area", diff --git a/setup.py b/setup.py index 6f64f928..88d53c9b 100644 --- a/setup.py +++ b/setup.py @@ -46,6 +46,7 @@ def run_tests(self) -> None: "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", "Programming Language :: Python :: Implementation :: CPython", "Programming Language :: Python :: Implementation :: PyPy", "Intended Audience :: Developers", diff --git a/tests/test_functions.py b/tests/test_functions.py index f6583681..1872d64d 100644 --- a/tests/test_functions.py +++ b/tests/test_functions.py @@ -8,6 +8,7 @@ from pygeoif.functions import centroid from pygeoif.functions import compare_coordinates +from pygeoif.functions import compare_geo_interface from pygeoif.functions import convex_hull from pygeoif.functions import dedupe from pygeoif.functions import signed_area @@ -376,3 +377,78 @@ def test_compare_lines(lines, expected: bool) -> None: def test_compare_polygons(polygons, expected: bool) -> None: """Compare nested sequences of coordinates.""" assert compare_coordinates(*polygons) is expected + + +def test_compare_eq_geo_interface() -> None: + geo_if = { + "geometries": ( + { + "geometries": ( + { + "geometries": ( + { + "bbox": (0, 0, 0, 0), + "coordinates": (0, 0), + "type": "Point", + }, + { + "bbox": (0, 0, 2, 2), + "coordinates": ((0, 0), (1, 1), (1, 2), (2, 2)), + "type": "MultiPoint", + }, + ), + "type": "GeometryCollection", + }, + { + "bbox": (0, 0, 3, 1), + "coordinates": ((0, 0), (3, 1)), + "type": "LineString", + }, + ), + "type": "GeometryCollection", + }, + {"coordinates": (((0, 0), (1, 1), (1, 0), (0, 0)),), "type": "Polygon"}, + { + "bbox": (0, 0, 2, 2), + "coordinates": ( + ((0, 0), (0, 2), (2, 2), (2, 0), (0, 0)), + ((1, 0), (0.5, 0.5), (1, 1), (1.5, 0.5), (1, 0)), + ), + "type": "Polygon", + }, + {"coordinates": (0, 0), "type": "Point"}, + {"bbox": (-1, -1, -1, -1), "coordinates": (-1, -1), "type": "Point"}, + {"coordinates": ((0, 0), (1, 1), (1, 0), (0, 0)), "type": "LinearRing"}, + { + "bbox": (0, 0, 1, 1), + "coordinates": ((0, 0), (1, 1)), + "type": "LineString", + }, + ), + "type": "GeometryCollection", + } + + assert compare_geo_interface(geo_if, geo_if) is True + + +def test_compare_neq_geo_interface() -> None: + geo_if1 = { + "type": "Point", + "bbox": (0, 1, 0, 1), + "coordinates": (0.0, 1.0, 2.0), + } + geo_if2 = { + "coordinates": (0.0, 1.0, 3.0), + } + + assert compare_geo_interface(geo_if1, geo_if2) is False + + +def test_compare_neq_empty_geo_interface() -> None: + geo_if = { + "type": "Point", + "bbox": (0, 1, 0, 1), + "coordinates": (0.0, 1.0, 2.0), + } + + assert compare_geo_interface(geo_if, {}) is False diff --git a/tests/test_geometrycollection.py b/tests/test_geometrycollection.py index 3f12b0fe..3064492d 100644 --- a/tests/test_geometrycollection.py +++ b/tests/test_geometrycollection.py @@ -371,9 +371,57 @@ def test_nested_geometry_collection_eq() -> None: assert gc3 == gc4 +def test_nested_geometry_collection_neq() -> None: + multipoint = geometry.MultiPoint([(0, 0), (1, 1), (1, 2), (2, 2)]) + gc1 = geometry.GeometryCollection([geometry.Point(0, 0), multipoint]) + gc1_1 = geometry.GeometryCollection( + [geometry.Point(0, 0), multipoint, geometry.Point(0, 0)] + ) + line = geometry.LineString([(0, 0), (3, 1)]) + gc2 = geometry.GeometryCollection([gc1, line]) + gc2_1 = geometry.GeometryCollection([gc1_1, line]) + poly1 = geometry.Polygon([(0, 0), (1, 1), (1, 0), (0, 0)]) + gc3 = geometry.GeometryCollection([gc2, poly1]) + gc4 = geometry.GeometryCollection([gc2_1, poly1]) + + assert gc3 != gc4 + + def test_geometry_collection_neq_when_empty() -> None: gc1 = geometry.GeometryCollection([]) gc2 = geometry.GeometryCollection([geometry.Point(0, 0)]) assert gc1 != gc2 assert gc2 != gc1 + + +def test_nested_geometry_collection_repr_eval() -> None: + multipoint = geometry.MultiPoint([(0, 0), (1, 1), (1, 2), (2, 2)]) + gc1 = geometry.GeometryCollection([geometry.Point(0, 0), multipoint]) + line1 = geometry.LineString([(0, 0), (3, 1)]) + gc2 = geometry.GeometryCollection([gc1, line1]) + poly1 = geometry.Polygon([(0, 0), (1, 1), (1, 0), (0, 0)]) + e = [(0, 0), (0, 2), (2, 2), (2, 0), (0, 0)] + i = [(1, 0), (0.5, 0.5), (1, 1), (1.5, 0.5), (1, 0)] + poly2 = geometry.Polygon(e, [i]) + p0 = geometry.Point(0, 0) + p1 = geometry.Point(-1, -1) + ring = geometry.LinearRing([(0, 0), (1, 1), (1, 0), (0, 0)]) + line = geometry.LineString([(0, 0), (1, 1)]) + gc = geometry.GeometryCollection([gc2, poly1, poly2, p0, p1, ring, line]) + + assert ( + eval( + repr(gc), + {}, + { + "LinearRing": geometry.LinearRing, + "Polygon": geometry.Polygon, + "Point": geometry.Point, + "LineString": geometry.LineString, + "GeometryCollection": geometry.GeometryCollection, + "MultiPoint": geometry.MultiPoint, + }, + ).__geo_interface__ + == gc.__geo_interface__ + ) From 4372e39819bc5a2f374da05c91d3047409b41aa0 Mon Sep 17 00:00:00 2001 From: Christian Ledermann Date: Fri, 13 Oct 2023 11:17:13 +0100 Subject: [PATCH 64/66] improve typing and tests --- pygeoif/factories.py | 2 +- pygeoif/geometry.py | 4 +++- tests/test_base.py | 2 +- tests/test_factories.py | 38 ++++++++++++++++++++++++++++++++++++-- tests/test_line.py | 3 +++ tests/test_linear_ring.py | 1 + tests/test_point.py | 1 + 7 files changed, 46 insertions(+), 5 deletions(-) diff --git a/pygeoif/factories.py b/pygeoif/factories.py index 582464e4..e5c2fa35 100644 --- a/pygeoif/factories.py +++ b/pygeoif/factories.py @@ -154,7 +154,7 @@ def shape( geometries = [ shape(fi) for fi in geometry["geometries"] # type: ignore [typeddict-item] ] - return GeometryCollection(geometries) # type: ignore [arg-type] + return GeometryCollection(geometries) raise NotImplementedError(f"[{geometry['type']} is not implemented") diff --git a/pygeoif/geometry.py b/pygeoif/geometry.py index 669bac14..28d2f70d 100644 --- a/pygeoif/geometry.py +++ b/pygeoif/geometry.py @@ -1000,7 +1000,9 @@ class isn't generally supported by ordinary GIS sw (viewers and so on). So {'type': 'Point', 'coordinates': (1.0, -1.0)}]} """ - def __init__(self, geometries: Iterable[Geometry]) -> None: + def __init__( + self, geometries: Iterable[Union[Geometry, "GeometryCollection"]] + ) -> None: """ Initialize the MultiGeometry with Geometries. diff --git a/tests/test_base.py b/tests/test_base.py index 2e6f1839..615a56e0 100644 --- a/tests/test_base.py +++ b/tests/test_base.py @@ -49,7 +49,7 @@ def test_wkt_coordinates() -> None: def test_from_dict() -> None: base_geo = geometry._Geometry() with pytest.raises(NotImplementedError, match="^Must be implemented by subclass$"): - assert base_geo._from_dict({"type": "_Geometry"}) + assert base_geo._from_dict({"type": "_Geometry"}) # type: ignore def test_has_z() -> None: diff --git a/tests/test_factories.py b/tests/test_factories.py index d0410f93..5c714b95 100644 --- a/tests/test_factories.py +++ b/tests/test_factories.py @@ -87,7 +87,7 @@ def test_box_cw() -> None: def test_shell_holes_from_wkt_coords() -> None: shell, holes = factories._shell_holes_from_wkt_coords( [ - ["0 0", "10 20", "30 40", "0 0"], + ["0 0", "10 20", "30 40", "0 0"], # type: ignore ], ) assert holes is None @@ -139,15 +139,17 @@ def test_linestring(self) -> None: "LINESTRING(-72.991 46.177,-73.079 46.16," "-73.146 46.124,-73.177 46.071,-73.164 46.044)", ) + + assert isinstance(line, geometry.LineString) assert ( line.wkt == "LINESTRING (-72.991 46.177, " "-73.079 46.16, -73.146 46.124, " "-73.177 46.071, -73.164 46.044)" ) - assert isinstance(line, geometry.LineString) def test_linearring(self) -> None: r = factories.from_wkt("LINEARRING (0 0,0 1,1 0,0 0)") + assert isinstance(r, geometry.LinearRing) assert r.wkt == "LINEARRING (0 0, 0 1, 1 0, 0 0)" @@ -159,12 +161,18 @@ def test_polygon(self) -> None: "-91.638 76.202,-91.647 76.211,-91.648 76.218," "-91.643 76.221,-91.636 76.222,-91.611 76.227))", ) + + assert isinstance(p, geometry.Polygon) assert p.exterior.coords[0][0] == -91.611 assert p.exterior.coords[0] == p.exterior.coords[-1] assert len(p.exterior.coords) == 14 + + def test_polygon_1(self) -> None: p = factories.from_wkt( "POLYGON((1 1,5 1,5 5,1 5,1 1),(2 2, 3 2, 3 3, 2 3,2 2))", ) + + assert isinstance(p, geometry.Polygon) assert p.exterior.coords[0] == p.exterior.coords[-1] assert p.exterior.coords[0] == (1.0, 1.0) assert len(list(p.interiors)) == 1 @@ -180,12 +188,20 @@ def test_polygon(self) -> None: "1 5, 1 1),(2 2, 3 2, " "3 3, 2 3, 2 2))" ) + + def test_polygon_2(self) -> None: p = factories.from_wkt("POLYGON ((30 10, 10 20, 20 40, 40 40, 30 10))") + + assert isinstance(p, geometry.Polygon) assert p.exterior.coords[0] == p.exterior.coords[-1] + + def test_polygon_3(self) -> None: p = factories.from_wkt( """POLYGON ((35 10, 10 20, 15 40, 45 45, 35 10), (20 30, 35 35, 30 20, 20 30))""", ) + + assert isinstance(p, geometry.Polygon) assert p.exterior.coords[0] == p.exterior.coords[-1] def test_multipoint(self) -> None: @@ -207,6 +223,8 @@ def test_multilinestring(self) -> None: p = factories.from_wkt( "MULTILINESTRING((3 4,10 50,20 25),(-5 -8,-10 -8,-15 -4))", ) + + assert isinstance(p, geometry.MultiLineString) assert list(p.geoms)[0].coords == (((3, 4), (10, 50), (20, 25))) assert list(p.geoms)[1].coords == (((-5, -8), (-10, -8), (-15, -4))) assert ( @@ -214,10 +232,14 @@ def test_multilinestring(self) -> None: "20 25),(-5 -8, " "-10 -8, -15 -4))" ) + + def test_multilinestring_1(self) -> None: p = factories.from_wkt( """MULTILINESTRING ((10 10, 20 20, 10 40), (40 40, 30 30, 40 20, 30 10))""", ) + + assert isinstance(p, geometry.MultiLineString) assert p.wkt == ( "MULTILINESTRING((10 10, 20 20, 10 40),(40 40, 30 30, 40 20, 30 10))" ) @@ -228,6 +250,8 @@ def test_multipolygon(self) -> None: "(1 1,2 2,3 3,1 1))," "((100 100,110 110,120 120,100 100)))", ) + + assert isinstance(p, geometry.MultiPolygon) # two polygons: the first one has an interior ring assert len(list(p.geoms)) == 2 assert list(p.geoms)[0].exterior.coords == ( @@ -255,15 +279,23 @@ def test_multipolygon(self) -> None: "((100 100, 110 110," " 120 120, 100 100)))" ) + + def test_multipolygon_1(self) -> None: p = factories.from_wkt( "MULTIPOLYGON(((1 1,5 1,5 5,1 5,1 1)," "(2 2, 3 2, 3 3, 2 3,2 2)),((3 3,6 2,6 4,3 3)))", ) + + assert isinstance(p, geometry.MultiPolygon) assert len(list(p.geoms)) == 2 + + def test_multipolygon_2(self) -> None: p = factories.from_wkt( "MULTIPOLYGON (((30 20, 10 40, 45 40, 30 20))," "((15 5, 40 10, 10 20, 5 10, 15 5)))", ) + + assert isinstance(p, geometry.MultiPolygon) assert p.__geo_interface__ == { "type": "MultiPolygon", "bbox": (5.0, 5.0, 45.0, 40.0), @@ -285,6 +317,8 @@ def test_geometrycollection(self) -> None: gc = factories.from_wkt( "GEOMETRYCOLLECTION(POINT(4 6), LINESTRING(4 6,7 10))", ) + + assert isinstance(gc, geometry.GeometryCollection) assert len(list(gc.geoms)) == 2 assert isinstance(list(gc.geoms)[0], geometry.Point) assert isinstance(list(gc.geoms)[1], geometry.LineString) diff --git a/tests/test_line.py b/tests/test_line.py index 089c9768..b0b4df8a 100644 --- a/tests/test_line.py +++ b/tests/test_line.py @@ -82,7 +82,10 @@ def test_from_compatible() -> None: "coordinates": ((0.0, 0.0, 1.0), (1.0, 1.0, 2.0)), }, ) + line = geometry.LineString._from_interface(not_a_geometry) + + assert isinstance(line, geometry.LineString) assert line.coords == ((0.0, 0.0, 1.0), (1.0, 1.0, 2.0)) diff --git a/tests/test_linear_ring.py b/tests/test_linear_ring.py index 5fe4cbe9..529d705c 100644 --- a/tests/test_linear_ring.py +++ b/tests/test_linear_ring.py @@ -86,6 +86,7 @@ def test_from_compatible() -> None: ring = geometry.LinearRing._from_interface(not_a_geometry) + assert isinstance(ring, geometry.LinearRing) assert ring.coords == ((0.0, 0.0, 1.0), (1.0, 1.0, 2.0), (0, 4, 3), (0, 0, 1)) diff --git a/tests/test_point.py b/tests/test_point.py index 9a82b282..96e9a709 100644 --- a/tests/test_point.py +++ b/tests/test_point.py @@ -170,6 +170,7 @@ def test_from_compatible() -> None: point = geometry.Point._from_interface(not_a_geometry) + assert isinstance(point, geometry.Point) assert point.coords == ((0, 1, 2),) From 8d433445a99380c7dd3f2a61e59647f213a580a8 Mon Sep 17 00:00:00 2001 From: Christian Ledermann Date: Fri, 13 Oct 2023 16:36:52 +0100 Subject: [PATCH 65/66] prepare release --- docs/HISTORY.txt | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/docs/HISTORY.txt b/docs/HISTORY.txt index bfb266cd..1916fb4e 100644 --- a/docs/HISTORY.txt +++ b/docs/HISTORY.txt @@ -1,10 +1,13 @@ Changelog ========= +1.1 (2023/10/13) +----------------- -1.1 (unreleased) ------------------- - +- Fix nested MultiGeometries +- Improve type annotations +- Add Python 3.12 to supported versions +- Last version to support Python 3.7 1.0 (2022/09/29) ------------------------ From 3b9c91a3c3c0288dc71627e2171738b51bcb6e5f Mon Sep 17 00:00:00 2001 From: Christian Ledermann Date: Fri, 13 Oct 2023 16:47:53 +0100 Subject: [PATCH 66/66] correct version in setup.py --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 88d53c9b..6df7a579 100644 --- a/setup.py +++ b/setup.py @@ -25,7 +25,7 @@ def run_tests(self) -> None: sys.exit(errno) -version = "1.0.1" +version = "1.1.0" with open("README.rst", encoding="utf-8") as readme: README = readme.read()