Skip to content

Commit

Permalink
Merge pull request #239 from cleder/refactor-geometry
Browse files Browse the repository at this point in the history
Refactor geometry
cleder authored Oct 14, 2023
2 parents aa54cbd + 7901627 commit f8ff74c
Showing 33 changed files with 4,508 additions and 711 deletions.
11 changes: 6 additions & 5 deletions .github/workflows/run-all-tests.yml
Original file line number Diff line number Diff line change
@@ -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
@@ -29,7 +29,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']

steps:
- uses: actions/checkout@v4
@@ -46,7 +46,7 @@ jobs:
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

@@ -73,7 +73,8 @@ jobs:
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
@@ -84,7 +85,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 }}
7 changes: 6 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -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
@@ -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
@@ -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:
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -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
@@ -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.

@@ -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
~~~~~~~~~~~

17 changes: 13 additions & 4 deletions fastkml/atom.py
Original file line number Diff line number Diff line change
@@ -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
@@ -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):
@@ -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)
Loading

0 comments on commit f8ff74c

Please sign in to comment.