Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1.0.beta.12 #109

Merged
merged 73 commits into from
Sep 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
73 commits
Select commit Hold shift + click to select a range
4f955a7
[pre-commit.ci] pre-commit autoupdate
pre-commit-ci[bot] Jan 31, 2022
ece71a5
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jan 31, 2022
28d004e
Format code with black and isort
deepsource-autofix[bot] Jan 31, 2022
b607bbe
Merge pull request #81 from cleder/pre-commit-ci-update-config
cleder Jan 31, 2022
97d68f0
Add CodeSee architecture diagram workflow to repository
Feb 5, 2022
be7e0a1
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Feb 5, 2022
c53127c
Format code with black and isort
deepsource-autofix[bot] Feb 5, 2022
1a6c0f1
Merge pull request #82 from cleder/codesee-arch-diagram-workflow-1644…
cleder Feb 5, 2022
98cf7c9
black
cleder Feb 5, 2022
e98963f
remove pybetter from requirements
cleder Feb 5, 2022
8659047
remove flake8-type-checking
cleder Feb 5, 2022
6e6227e
Bump actions/setup-node from 2 to 3.0.0
dependabot[bot] Feb 24, 2022
a68fd55
Merge pull request #84 from cleder/dependabot/github_actions/actions/…
cleder Feb 25, 2022
9947c8a
Bump actions/setup-python from 2 to 3
dependabot[bot] Feb 28, 2022
dd0e961
Merge pull request #85 from cleder/dependabot/github_actions/actions/…
cleder Mar 1, 2022
be9715f
Bump actions/checkout from 2 to 3
dependabot[bot] Mar 1, 2022
259030f
Merge pull request #86 from cleder/dependabot/github_actions/actions/…
cleder Mar 2, 2022
f64a773
[pre-commit.ci] pre-commit autoupdate
pre-commit-ci[bot] Mar 21, 2022
1a3b383
Merge pull request #87 from cleder/pre-commit-ci-update-config
cleder Mar 21, 2022
c8ca1d3
Bump actions/setup-node from 3.0.0 to 3.1.0
dependabot[bot] Apr 1, 2022
591366c
[pre-commit.ci] pre-commit autoupdate
pre-commit-ci[bot] Apr 4, 2022
062cd66
Bump codecov/codecov-action from 2 to 3
dependabot[bot] Apr 5, 2022
a51c90f
Merge pull request #90 from cleder/dependabot/github_actions/codecov/…
cleder Apr 6, 2022
c4e21c0
Merge branch 'develop' into dependabot/github_actions/actions/setup-n…
cleder Apr 6, 2022
bdb59bc
Merge pull request #89 from cleder/dependabot/github_actions/actions/…
cleder Apr 6, 2022
963acaa
Merge branch 'develop' into pre-commit-ci-update-config
cleder Apr 6, 2022
568215a
Merge pull request #88 from cleder/pre-commit-ci-update-config
cleder Apr 7, 2022
108b468
Bump actions/setup-java from 2 to 3
dependabot[bot] Apr 8, 2022
6ac56d6
Merge pull request #91 from cleder/dependabot/github_actions/actions/…
cleder Apr 9, 2022
690d4a0
[pre-commit.ci] pre-commit autoupdate
pre-commit-ci[bot] Apr 11, 2022
31b839d
Merge pull request #92 from cleder/pre-commit-ci-update-config
cleder Apr 11, 2022
ad3b02c
Bump actions/setup-node from 3.1.0 to 3.1.1
dependabot[bot] Apr 11, 2022
cb9b359
Merge pull request #93 from cleder/dependabot/github_actions/actions/…
cleder Apr 12, 2022
4c02652
Bump github/codeql-action from 1 to 2
dependabot[bot] Apr 25, 2022
290e83e
Merge pull request #94 from cleder/dependabot/github_actions/github/c…
cleder Apr 26, 2022
a7f1abb
[pre-commit.ci] pre-commit autoupdate
pre-commit-ci[bot] May 2, 2022
8baa4a4
Merge pull request #95 from cleder/pre-commit-ci-update-config
cleder May 3, 2022
e3d56e7
Bump actions/setup-node from 3.1.1 to 3.2.0
dependabot[bot] May 16, 2022
967bec5
Merge pull request #96 from cleder/dependabot/github_actions/actions/…
cleder May 17, 2022
c727ce9
[pre-commit.ci] pre-commit autoupdate
pre-commit-ci[bot] May 30, 2022
5c18253
Merge pull request #97 from cleder/pre-commit-ci-update-config
cleder May 31, 2022
5f406ec
Create codeball.yml
cleder Jun 2, 2022
81e3dd0
Bump actions/setup-node from 3.2.0 to 3.3.0
dependabot[bot] Jun 6, 2022
5a7a2eb
Merge pull request #98 from cleder/dependabot/github_actions/actions/…
cleder Jun 7, 2022
b80b1ee
Bump actions/setup-python from 3 to 4
dependabot[bot] Jun 8, 2022
6bacf1c
Merge pull request #99 from cleder/dependabot/github_actions/actions/…
cleder Jun 8, 2022
4892d1a
[pre-commit.ci] pre-commit autoupdate
pre-commit-ci[bot] Jun 13, 2022
9832e8e
Merge pull request #101 from cleder/pre-commit-ci-update-config
cleder Jun 14, 2022
decac58
test eq for floats
cleder Jun 23, 2022
ac64186
Merge branch 'develop' of github.com:cleder/pygeoif into develop
cleder Jun 23, 2022
d33b4dd
yamllint
cleder Jun 24, 2022
8fa30fb
[pre-commit.ci] pre-commit autoupdate
pre-commit-ci[bot] Jul 4, 2022
64f21a7
Merge pull request #102 from cleder/pre-commit-ci-update-config
cleder Jul 5, 2022
458e56f
Bump actions/setup-node from 3.3.0 to 3.4.0
dependabot[bot] Jul 11, 2022
624096e
Merge pull request #103 from cleder/dependabot/github_actions/actions…
cleder Jul 11, 2022
89ef65c
Bump actions/setup-node from 3.4.0 to 3.4.1
dependabot[bot] Jul 14, 2022
505ce28
Merge pull request #104 from cleder/dependabot/github_actions/actions…
cleder Jul 18, 2022
a8fbf98
[pre-commit.ci] pre-commit autoupdate
pre-commit-ci[bot] Jul 25, 2022
000971a
Merge pull request #105 from cleder/pre-commit-ci-update-config
cleder Jul 25, 2022
6543dc3
use math.isclose to compare floats
cleder Jul 31, 2022
d0900bd
Merge branch 'develop' of github.com:cleder/pygeoif into develop
cleder Jul 31, 2022
72817ae
[pre-commit.ci] pre-commit autoupdate
pre-commit-ci[bot] Aug 1, 2022
0df851a
Merge pull request #106 from cleder/pre-commit-ci-update-config
cleder Aug 2, 2022
e2a5cd4
[pre-commit.ci] pre-commit autoupdate
pre-commit-ci[bot] Aug 8, 2022
fd33dca
Merge pull request #107 from cleder/pre-commit-ci-update-config
cleder Aug 8, 2022
6778f0c
remove flake8-dunder-all until fixed
cleder Sep 1, 2022
0609367
remove some flake8 plugins until fixed
cleder Sep 1, 2022
2cafe4c
remove flake8-dunder-all until fixed
cleder Sep 1, 2022
e6fd752
remove some flake8 plugins until fixed
cleder Sep 1, 2022
cd6d7fd
Merge branch 'main' into develop
cleder Sep 1, 2022
abcccbc
flake8 plugins
cleder Sep 1, 2022
f6bc354
Merge branch 'develop' of github.com:cleder/pygeoif into develop
cleder Sep 1, 2022
3e011c2
update python versions, remove python 3.6
cleder Sep 1, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .github/workflows/codeball.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
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
8 changes: 4 additions & 4 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v3

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
Expand All @@ -54,7 +54,7 @@ jobs:
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v1
uses: github/codeql-action/autobuild@v2

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl
Expand All @@ -68,5 +68,5 @@ jobs:
# make release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
uses: github/codeql-action/analyze@v2
...
81 changes: 81 additions & 0 deletions .github/workflows/codesee-arch-diagram.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
on:
push:
branches:
- develop
pull_request_target:
types: [opened, synchronize, reopened]

name: CodeSee Map

jobs:
test_map_action:
runs-on: ubuntu-latest
continue-on-error: true
name: Run CodeSee Map Analysis
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.4.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
with:
step: insights
api_token: ${{ secrets.CODESEE_ARCH_DIAG_API_TOKEN }}
github_ref: ${{ github.ref }}
22 changes: 11 additions & 11 deletions .github/workflows/run-all-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.6', '3.7', '3.8', '3.9', '3.10']
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11-dev']

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
Expand All @@ -26,7 +26,7 @@ jobs:
pytest pygeoif --cov=pygeoif --cov-fail-under=100 --cov-report=xml
- name: "Upload coverage to Codecov"
if: ${{ matrix.python-version==3.9 }}
uses: codecov/codecov-action@v2
uses: codecov/codecov-action@v3
with:
fail_ci_if_error: true
verbose: true
Expand All @@ -38,9 +38,9 @@ jobs:
python-version: ['3.9']

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
Expand All @@ -65,11 +65,11 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
pypy-version: ['pypy-3.6', 'pypy-3.7', 'pypy-3.8']
pypy-version: ['pypy-3.7', 'pypy-3.8', 'pypy-3.9']
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.pypy-version }}
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.pypy-version }}
- name: Install dependencies
Expand All @@ -86,9 +86,9 @@ jobs:
name: Build and publish to PyPI and TestPyPI
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- uses: actions/checkout@v3
- name: Set up Python 3.9
uses: actions/setup-python@v1
uses: actions/setup-python@v4
with:
python-version: 3.9
- name: Install pypa/build
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ dist/
venv/
coverage.xml
.mutmut-cache
html/
26 changes: 15 additions & 11 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
---
repos:
- repo: meta
hooks:
- id: check-useless-excludes
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.1.0
rev: v4.3.0
hooks:
- id: check-added-large-files
- id: check-docstring-first
Expand All @@ -21,39 +24,40 @@ repos:
- id: requirements-txt-fixer
- id: trailing-whitespace
- repo: https://github.com/psf/black
rev: 21.12b0
rev: 22.6.0
hooks:
- id: black
- repo: https://github.com/PyCQA/flake8
rev: 4.0.1
rev: 5.0.4
hooks:
- id: flake8
additional_dependencies:
- flake8
- flake8-absolute-import
- flake8-awesome
- flake8-bandit
- flake8-blind-except
- flake8-bugbear
- flake8-class-attributes-order
# - flake8-class-attributes-order
- flake8-cognitive-complexity
- flake8-commas
- flake8-comments
- flake8-complex-f-strings
- flake8-continuation
- flake8-debugger
- flake8-docstrings
- flake8-dunder-all
# - flake8-dunder-all
- flake8-encodings
- flake8-expression-complexity
- flake8-function-order
# - flake8-function-order
- flake8-implicit-str-concat
- flake8-noqa
- flake8-pep3101
- flake8-print
- flake8-raise
- flake8-rst-docstrings
- flake8-simplify
- flake8-slots
# - flake8-slots
- flake8-string-format
- flake8-super
- flake8-typing-imports
Expand All @@ -64,15 +68,15 @@ repos:
hooks:
- id: isort
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v0.931
rev: v0.971
hooks:
- id: mypy
- repo: https://github.com/Lucas-C/pre-commit-hooks-markup
rev: v1.0.1
hooks:
- id: rst-linter
- id: rst-linter
- repo: https://github.com/mgedmin/check-manifest
rev: "0.47"
rev: "0.48"
hooks:
- id: check-manifest
- id: check-manifest
...
4 changes: 4 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ 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

Example
========

Expand Down
8 changes: 7 additions & 1 deletion docs/HISTORY.txt
Original file line number Diff line number Diff line change
@@ -1,18 +1,24 @@
Changelog
=========

1.0.beta.1 (2021-09-20)
1.0 (unreleased)
------------------------

- Add type annotations
- refactor
- changes to keep functionality and interface close to ``shapely``
- remove support for python 2
- minimum python version is 3.6
- rename as_shape to shape
- add box factory
- format with black
- reconstruct objects from their representation
- Parse WKT that is not in upper case.
- Centroid for LinearRings
- Convex Hull
- implement equality ``__eq__`` operator (``==``)
- ``is_empty`` and ``bool``
- drop duplicate points when creating LineStrings

0.7 (2017/05/04)
-----------------
Expand Down
2 changes: 1 addition & 1 deletion pygeoif/factories.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def orient(polygon: Polygon, ccw: bool = True) -> Polygon:
and the interiors will be in clockwise orientation, or
the other way round when ccw is False.
"""
s = -1.0 if not ccw else 1.0
s = 1.0 if ccw else -1.0
rings = []
ring = polygon.exterior
if signed_area(ring.coords) / s >= 0.0:
Expand Down
29 changes: 29 additions & 0 deletions pygeoif/functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,18 @@
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
#
"""Functions for geometries."""
import math
from itertools import groupby
from itertools import zip_longest
from typing import Iterable
from typing import List
from typing import Tuple
from typing import Union
from typing import cast

from pygeoif.types import CoordinatesType
from pygeoif.types import LineType
from pygeoif.types import MultiCoordinatesType
from pygeoif.types import Point2D


Expand Down Expand Up @@ -133,4 +138,28 @@ def dedupe(coords: LineType) -> LineType:
return tuple(coord for coord, _count in groupby(coords))


def compare_coordinates(
coords: Union[float, CoordinatesType, MultiCoordinatesType],
other: Union[float, CoordinatesType, MultiCoordinatesType],
) -> bool:
"""Compare two coordinate sequences."""
try:
return all(
compare_coordinates(c, o)
for c, o in zip_longest(
coords, # type: ignore [arg-type]
other, # type: ignore [arg-type]
fillvalue=math.nan,
)
)
except TypeError:
try:
# assert only used to make mypy happy
assert isinstance(coords, float) # noqa: S101
assert isinstance(other, float) # noqa: S101
return math.isclose(coords, other)
except (TypeError, AssertionError):
return coords == other


__all__ = ["centroid", "convex_hull", "dedupe", "signed_area"]
Loading