[Git][debian-gis-team/python-affine][upstream] New upstream version 2.2.1
Bas Couwenberg
gitlab at salsa.debian.org
Tue Jun 5 06:32:01 BST 2018
Bas Couwenberg pushed to branch upstream at Debian GIS Project / python-affine
Commits:
647b3793 by Bas Couwenberg at 2018-06-05T07:14:04+02:00
New upstream version 2.2.1
- - - - -
8 changed files:
- .gitignore
- .travis.yml
- CHANGES.txt
- affine/__init__.py
- affine/tests/__init__.py
- + requirements.txt
- setup.cfg
- setup.py
Changes:
=====================================
.gitignore
=====================================
--- a/.gitignore
+++ b/.gitignore
@@ -55,3 +55,5 @@ coverage.xml
# Sphinx documentation
docs/_build/
+__pycache__
+*.swp
=====================================
.travis.yml
=====================================
--- a/.travis.yml
+++ b/.travis.yml
@@ -5,12 +5,12 @@ python:
- 2.7
- 3.6
install:
- - pip install wheel --upgrade
+ - pip install -r requirements.txt
- pip install .[test]
script:
- - pytest --cov affine --cov-report term-missing
+ - python -m pytest --cov affine --cov-report term-missing
+ - python -m pydocstyle affine
after_success:
- - pip install coveralls
- coveralls
deploy:
on:
=====================================
CHANGES.txt
=====================================
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,6 +1,10 @@
CHANGES
=======
+2.2.1 (2018-06-04)
+------------------
+- Docstring improvements (#37).
+
2.2.0 (2018-03-20)
------------------
- Addition of permutation matrix (#35).
=====================================
affine/__init__.py
=====================================
--- a/affine/__init__.py
+++ b/affine/__init__.py
@@ -47,7 +47,7 @@ import math
__all__ = ['Affine']
__author__ = "Sean Gillies"
-__version__ = "2.2.0"
+__version__ = "2.2.1"
EPSILON = 1e-5
@@ -146,6 +146,13 @@ class Affine(
precision = EPSILON
def __new__(cls, *members):
+ """Create a new object
+
+ Parameters
+ ----------
+ members : list of float
+ Affine matrix members a, b, c, d, e, f
+ """
if len(members) == 6:
mat3x3 = [x * 1.0 for x in members] + [0.0, 0.0, 1.0]
return tuple.__new__(cls, mat3x3)
@@ -255,20 +262,20 @@ class Affine(
(ca, -sa, px - px * ca + py * sa,
sa, ca, py - px * sa - py * ca,
0.0, 0.0, 1.0))
-
+
@classmethod
def permutation(cls, *scaling):
"""Create the permutation transform. For 2x2 matrices, there is only one permutation matrix that is not the identity.
-
+
:rtype: Affine
"""
-
+
return tuple.__new__(
cls,
(0.0, 1.0, 0.0,
1.0, 0.0, 0.0,
0.0, 0.0, 1.0))
-
+
def __str__(self):
"""Concise string representation."""
return ("|% .2f,% .2f,% .2f|\n"
@@ -375,8 +382,8 @@ class Affine(
limits, after applying the transform.
"""
a, b, c, d, e, f, g, h, i = self
- return ((abs(a) < self.precision and abs(e) < self.precision)
- or (abs(d) < self.precision and abs(b) < self.precision))
+ return ((abs(a) < self.precision and abs(e) < self.precision) or
+ (abs(d) < self.precision and abs(b) < self.precision))
@property
def is_conformal(self):
@@ -400,9 +407,9 @@ class Affine(
always results in a congruent shape.
"""
a, b, c, d, e, f, g, h, i = self
- return (self.is_conformal
- and abs(1.0 - (a * a + d * d)) < self.precision
- and abs(1.0 - (b * b + e * e)) < self.precision)
+ return (self.is_conformal and
+ abs(1.0 - (a * a + d * d)) < self.precision and
+ abs(1.0 - (b * b + e * e)) < self.precision)
@cached_property
def is_degenerate(self):
@@ -455,9 +462,11 @@ class Affine(
__iadd__ = __add__
def __mul__(self, other):
- """Apply the transform using matrix multiplication, creating a
- resulting object of the same type. A transform may be applied to
- another transform, a vector, vector array, or shape.
+ """Multiplication
+
+ Apply the transform using matrix multiplication, creating
+ a resulting object of the same type. A transform may be applied
+ to another transform, a vector, vector array, or shape.
:param other: The object to transform.
:type other: Affine, :class:`~planar.Vec2`,
@@ -480,9 +489,14 @@ class Affine(
return (vx * sa + vy * sb + sc, vx * sd + vy * se + sf)
def __rmul__(self, other):
- # We should not be called if other is an affine instance
- # This is just a guarantee, since we would potentially
- # return the wrong answer in that case.
+ """Right hand multiplication
+
+ Notes
+ -----
+ We should not be called if other is an affine instance This is
+ just a guarantee, since we would potentially return the wrong
+ answer in that case.
+ """
assert not isinstance(other, Affine)
return self.__mul__(other)
@@ -528,10 +542,14 @@ class Affine(
__hash__ = tuple.__hash__ # hash is not inherited in Py 3
def __getnewargs__(self):
- # Required for unpickling.
- # Normal unpickling creates a situation where __new__ receives all 9
- # elements rather than the 6 that are required for the constructor.
- # This method ensures that only the 6 are provided.
+ """Pickle protocol support
+
+ Notes
+ -----
+ Normal unpickling creates a situation where __new__ receives all
+ 9 elements rather than the 6 that are required for the
+ constructor. This method ensures that only the 6 are provided.
+ """
return self.a, self.b, self.c, self.d, self.e, self.f
=====================================
affine/tests/__init__.py
=====================================
--- a/affine/tests/__init__.py
+++ b/affine/tests/__init__.py
@@ -0,0 +1 @@
+"""Affine tests package"""
=====================================
requirements.txt
=====================================
--- /dev/null
+++ b/requirements.txt
@@ -0,0 +1 @@
+pydocstyle==2.1.1
=====================================
setup.cfg
=====================================
--- a/setup.cfg
+++ b/setup.cfg
@@ -3,3 +3,7 @@ universal: 1
[tool:pytest]
testpaths: affine/tests
+
+[pydocstyle]
+select: D1
+add-ignore: D105
=====================================
setup.py
=====================================
--- a/setup.py
+++ b/setup.py
@@ -5,29 +5,30 @@ from setuptools import find_packages, setup
# Parse the version from the affine module.
-with codecs.open(os.path.join('affine', '__init__.py')) as f:
+with codecs.open(os.path.join("affine", "__init__.py")) as f:
for line in f:
if "__version__" in line:
version = line.split("=")[1].strip()
version = version.strip('"').strip("'")
break
-with codecs.open('README.rst', encoding='utf-8') as f:
+with codecs.open("README.rst", encoding="utf-8") as f:
readme = f.read()
-setup(name='affine',
- version=version,
- description="Matrices describing affine transformation of the plane.",
- long_description=readme,
- classifiers=[],
- keywords='affine transformation matrix',
- author='Sean Gillies',
- author_email='sean at mapbox.com',
- url='https://github.com/sgillies/affine',
- license='BSD',
- packages=find_packages(exclude=['ez_setup', 'examples', 'tests']),
- include_package_data=True,
- zip_safe=True,
- extras_require={'test': ['pytest>=3.0', 'pytest-cov']}
- )
+setup(
+ name="affine",
+ version=version,
+ description="Matrices describing affine transformation of the plane.",
+ long_description=readme,
+ classifiers=[],
+ keywords="affine transformation matrix",
+ author="Sean Gillies",
+ author_email="sean at mapbox.com",
+ url="https://github.com/sgillies/affine",
+ license="BSD",
+ packages=find_packages(exclude=["ez_setup", "examples", "tests"]),
+ include_package_data=True,
+ zip_safe=True,
+ extras_require={"test": ["pytest>=3.0", "pytest-cov", "pydocstyle", "coveralls"]},
+)
View it on GitLab: https://salsa.debian.org/debian-gis-team/python-affine/commit/647b379396484d82c829910f1dd424d73491e220
--
View it on GitLab: https://salsa.debian.org/debian-gis-team/python-affine/commit/647b379396484d82c829910f1dd424d73491e220
You're receiving this email because of your account on salsa.debian.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-grass-devel/attachments/20180605/b0ae44e4/attachment-0001.html>
More information about the Pkg-grass-devel
mailing list