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

Refactor geometry #239

Merged
merged 55 commits into from
Oct 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
a8bc5b7
scaffold classes
cleder Jan 14, 2023
12e400e
scaffold classes
cleder Jan 14, 2023
cd12315
use Enum for altitudeMode #194
cleder Jan 14, 2023
9e61c5a
move tests to geometry_test fix enum #194
cleder Jan 14, 2023
8cba4b0
type annotate tests with infer-types
cleder Jan 14, 2023
fc82a4c
add script to remove unused # type: ignore comments
cleder Jan 15, 2023
0bf8de5
New _Geometry class as a base
cleder Jan 15, 2023
bbb0080
Finish geometry base class
cleder Jan 15, 2023
ca70308
fix type annotation
cleder Jan 15, 2023
4de8d7e
implement Point class
cleder Jan 15, 2023
ed18e77
raise KMLParseError #32 #84
cleder Jan 15, 2023
0ed6790
raise KMLParseError #32 #84 for invalid coordinates
cleder Jan 15, 2023
389a891
Test edge cases
cleder Jan 16, 2023
4893220
test write empty point
cleder Jan 16, 2023
c898640
add verbosity and precission to etree_element and to_string #217 #67 #98
cleder Jan 16, 2023
5c45cc7
add verbosity and precission to etree_element super calls #217 #67 #98
cleder Jan 16, 2023
09433fb
improve script to remove type ignores
cleder Jan 16, 2023
e7dfcc0
add kml schema #218
cleder Jan 22, 2023
b75aa4a
add __repr__ and __eq__ methods to base
cleder Jan 22, 2023
f60fcbd
weird error appending extended data
cleder Jan 22, 2023
658f731
fix tests for extended data
cleder Jan 22, 2023
5546ac9
move data tests
cleder Jan 22, 2023
6015316
delete remove_unused_type_ignores.py
cleder Jan 22, 2023
087bb07
add strict parameter #215
cleder Jan 22, 2023
3a2ab48
add strict in Baseclass #215
cleder Jan 22, 2023
a83f27d
add pygrep to pre-commit
cleder Jan 22, 2023
ffff745
yamllint all yaml files
cleder Jan 22, 2023
50deded
add coverage hint to contributing
cleder Jan 22, 2023
9727b58
implement linestring
cleder Jan 25, 2023
91160ff
move geometry tests into directory
cleder Apr 2, 2023
286d5f5
add ruff, fix types
cleder Apr 2, 2023
5d347fc
Create Polygon
cleder Apr 3, 2023
6ef5a07
update to mypy 1.1.1
cleder Apr 3, 2023
8cc5300
update black
cleder Apr 3, 2023
8958870
remove dead code
cleder Apr 3, 2023
f3b1c4d
make extrude and tessalate optional
cleder Apr 3, 2023
b099d96
polygon from string
cleder Apr 3, 2023
16408cf
WIP: MultiGeometry
cleder Apr 3, 2023
005c4ca
back to dev, bump version to alpha 5
cleder Jan 14, 2023
f1bdf23
qualify pygeoif classes with geo. prefix
cleder Jan 14, 2023
33d821a
Merge branch 'develop' into refactor-geometry
cleder Apr 4, 2023
69f8c17
document what is t be deprecated
cleder Apr 14, 2023
42b1c1c
back to dev, bump version to alpha 5
cleder Jan 14, 2023
c84d504
qualify pygeoif classes with geo. prefix
cleder Jan 14, 2023
1ab5a2b
Merge branch 'develop' into refactor-geometry
cleder Oct 8, 2023
6795a39
remove unused ignores
cleder Oct 8, 2023
e0c071a
fix logger
cleder Oct 9, 2023
b98a081
fix multi geometry
cleder Oct 14, 2023
54325eb
back to dev, bump version to alpha 5
cleder Jan 14, 2023
64b9591
qualify pygeoif classes with geo. prefix
cleder Jan 14, 2023
100b23d
Merge branch 'develop' into refactor-geometry
cleder Oct 14, 2023
9c01d63
use the new geometries in Placemark
cleder Oct 14, 2023
e478b0a
downgrade codecov to v3
cleder Oct 14, 2023
0023501
remove duplicated get_kwargs
cleder Oct 14, 2023
7901627
add deprecation warnings
cleder Oct 14, 2023
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
11 changes: 6 additions & 5 deletions .github/workflows/run-all-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
# run tests and lint with a variety of Python versions
---
name: Tests
on: [push, pull_request]

Check warning on line 5 in .github/workflows/run-all-tests.yml

View workflow job for this annotation

GitHub Actions / static-tests (3.9)

5:1 [truthy] truthy value should be one of [false, true]

Check warning on line 5 in .github/workflows/run-all-tests.yml

View workflow job for this annotation

GitHub Actions / static-tests (3.9)

5:1 [truthy] truthy value should be one of [false, true]

jobs:
cpython:
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
Expand All @@ -29,7 +29,7 @@
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']

steps:
- uses: actions/checkout@v4
Expand All @@ -46,7 +46,7 @@
run: |
pytest tests --cov=fastkml --cov=tests --cov-fail-under=88 --cov-report=xml
- name: "Upload coverage to Codecov"
uses: codecov/codecov-action@v4
uses: codecov/codecov-action@v3
with:
fail_ci_if_error: true

Expand All @@ -73,7 +73,8 @@
run: |
flake8 fastkml examples docs
black --check fastkml examples docs
yamllint .github/workflows/
yamllint .github/
yamllint .*.y*ml
- name: Check complexity
run: |
radon cc --min B fastkml
Expand All @@ -84,7 +85,7 @@
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 }}
Expand Down
7 changes: 6 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,13 @@ setup.cfg
# Installer logs
pip-log.txt

# Unit test / coverage reports
# Unit/static test / coverage reports
.coverage
.tox
.pytest_cache/
nosetests.xml
.ruff_cache/
monkeytype.sqlite3

# Translations
*.mo
Expand All @@ -51,6 +54,8 @@ venv
.mypy_cache/
.pyre/
.watchmanconfig
.pytype/


# misc
.dccache
24 changes: 22 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
repos:
- 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
Expand Down Expand Up @@ -50,10 +50,30 @@ repos:
rev: 5.12.0
hooks:
- id: isort
- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: 'v0.0.292'
hooks:
- id: ruff
- repo: https://github.com/PyCQA/flake8
rev: 6.1.0
hooks:
- id: flake8
- repo: https://github.com/pre-commit/pygrep-hooks
rev: v1.10.0 # Use the ref you want to point at
hooks:
- id: python-use-type-annotations
- id: python-check-blanket-type-ignore
- id: python-check-mock-methods
- id: python-no-log-warn
- id: python-use-type-annotations
- id: rst-backticks
- id: rst-directive-colons
- id: rst-inline-touching-normal
- id: text-unicode-replacement-char
- repo: https://github.com/mgedmin/check-manifest
rev: "0.49"
hooks:
- id: check-manifest
- id: check-manifest
# - repo: https://github.com/Lucas-C/pre-commit-hooks-markup
# rev: v1.0.1
# hooks:
Expand Down
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ recursive-include docs *.py
recursive-include docs *.rst
recursive-include docs Makefile
recursive-include tests *.py
recursive-include schema *.xsd
11 changes: 10 additions & 1 deletion docs/contributing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ especially in the following ways:
Pull Requests
-------------

Start by submitting a pull request on GitHub against the `develop` branch of the
Start by submitting a pull request on GitHub against the ``develop`` branch of the
repository. Your pull request should provide a good description of the change
you are making, and/or the bug that you are fixing.

Expand Down Expand Up @@ -64,6 +64,15 @@ available.

.. _tox: https://pypi.python.org/pypi/tox

coverage
~~~~~~~~

You can also run the tests with coverage_ to see which lines are covered by the
tests. This is useful for writing new tests to cover any uncovered lines::

pytest tests --cov=fastkml --cov=tests --cov-report=xml


pre-commit
~~~~~~~~~~~

Expand Down
17 changes: 13 additions & 4 deletions fastkml/atom.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@

from fastkml.base import _XMLObject
from fastkml.config import ATOMNS as NS
from fastkml.enums import Verbosity
from fastkml.helpers import o_from_attr
from fastkml.helpers import o_from_subelement_text
from fastkml.helpers import o_int_from_attr
Expand Down Expand Up @@ -167,8 +168,12 @@ def __init__(
def from_element(self, element: Element) -> None:
super().from_element(element)

def etree_element(self) -> Element:
return super().etree_element()
def etree_element(
self,
precision: Optional[int] = None,
verbosity: Verbosity = Verbosity.normal,
) -> Element:
return super().etree_element(precision=precision, verbosity=verbosity)


class _Person(_XMLObject):
Expand Down Expand Up @@ -227,8 +232,12 @@ def __init__(
self.uri = uri
self.email = email

def etree_element(self) -> Element:
return super().etree_element()
def etree_element(
self,
precision: Optional[int] = None,
verbosity: Verbosity = Verbosity.normal,
) -> Element:
return super().etree_element(precision=precision, verbosity=verbosity)

def from_element(self, element: Element) -> None:
super().from_element(element)
Expand Down
Loading
Loading