[Git][debian-gis-team/python-affine][upstream] New upstream version 2.3.0
Bas Couwenberg
gitlab at salsa.debian.org
Thu Sep 5 05:36:30 BST 2019
Bas Couwenberg pushed to branch upstream at Debian GIS Project / python-affine
Commits:
f476055d by Bas Couwenberg at 2019-09-05T04:18:17Z
New upstream version 2.3.0
- - - - -
6 changed files:
- .travis.yml
- AUTHORS.txt
- CHANGES.txt
- affine/__init__.py
- affine/tests/test_transform.py
- tox.ini
Changes:
=====================================
.travis.yml
=====================================
@@ -1,9 +1,10 @@
-sudo: false
+dist: xenial
language: python
cache: pip
python:
- 2.7
- 3.6
+ - 3.7
install:
- pip install -r requirements.txt
- pip install .[test]
@@ -17,4 +18,4 @@ deploy:
tags: true
provider: pypi
distributions: "sdist bdist_wheel"
- user: seang
+ user: __token__
=====================================
AUTHORS.txt
=====================================
@@ -3,7 +3,7 @@ Authors
- Sean Gillies <sean at mapbox.com>
- Steven Ring <smr at southsky.com.au>
-- Mike Toews <mwtoews at gmail.com>
+- Mike Taves <mwtoews at gmail.com>
- Kevin Wurster <wursterk at gmail.com>
- Todd Small <todd_small at icloud.com>
- Juan Luis Cano RodrÃguez <juanlu at satellogic.com>
=====================================
CHANGES.txt
=====================================
@@ -1,6 +1,19 @@
CHANGES
=======
+2.3.0 (2019-09-04)
+------------------
+
+Deprecations:
+
+- Right multiplication like vector * matrix is deprecated and will raise
+ AffineError in version 3.0.0.
+
+Bug fixes:
+
+- Change signature of Affine constructor to help users of PyCharm (#45).
+- The Affine class docstring has been improved.
+
2.2.2 (2018-12-20)
------------------
- Affine.itransform computed the wrong results for arrays with rotation or
=====================================
affine/__init__.py
=====================================
@@ -1,12 +1,5 @@
"""Affine transformation matrices
-The 3x3 augmented affine transformation matrix for transformations in two
-dimensions is illustrated below.
-
- | x' | | a b c | | x |
- | y' | = | d e f | | y |
- | 1 | | 0 0 1 | | 1 |
-
The Affine package is derived from Casey Duncan's Planar package. See the
copyright statement below.
"""
@@ -43,11 +36,12 @@ from __future__ import division
from collections import namedtuple
import math
+import warnings
__all__ = ['Affine']
__author__ = "Sean Gillies"
-__version__ = "2.2.2"
+__version__ = "2.3.0"
EPSILON = 1e-5
@@ -123,10 +117,36 @@ class Affine(
namedtuple('Affine', ('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i'))):
"""Two dimensional affine transform for 2D linear mapping.
- Parallel lines are preserved by these transforms. Affine transforms
- can perform any combination of translations, scales/flips, shears,
- and rotations. Class methods are provided to conveniently compose
- transforms from these operations.
+ Parameters
+ ----------
+ a, b, c, d, e, f : float
+ Coefficients of an augmented affine transformation matrix
+
+ | x' | | a b c | | x |
+ | y' | = | d e f | | y |
+ | 1 | | 0 0 1 | | 1 |
+
+ `a`, `b`, and `c` are the elements of the first row of the
+ matrix. `d`, `e`, and `f` are the elements of the second row.
+
+ Attributes
+ ----------
+ a, b, c, d, e, f, g, h, i : float
+ The coefficients of the 3x3 augumented affine transformation
+ matrix
+
+ | x' | | a b c | | x |
+ | y' | = | d e f | | y |
+ | 1 | | g h i | | 1 |
+
+ `g`, `h`, and `i` are always 0, 0, and 1.
+
+ The Affine package is derived from Casey Duncan's Planar package.
+ See the copyright statement below. Parallel lines are preserved by
+ these transforms. Affine transforms can perform any combination of
+ translations, scales/flips, shears, and rotations. Class methods
+ are provided to conveniently compose transforms from these
+ operations.
Internally the transform is stored as a 3x3 transformation matrix.
The transform may be constructed directly by specifying the first
@@ -140,25 +160,19 @@ class Affine(
matrices and vectors in general, but provides a convenience for
users of this class.
- :param members: 6 floats for the first two matrix rows.
- :type members: float
"""
precision = EPSILON
- def __new__(cls, *members):
+ def __new__(cls, a, b, c, d, e, f):
"""Create a new object
Parameters
----------
- members : list of float
- Affine matrix members a, b, c, d, e, f
+ a, b, c, d, e, f : float
+ Elements of an augmented affine transformation matrix.
"""
- if len(members) == 6:
- mat3x3 = [x * 1.0 for x in members] + [0.0, 0.0, 1.0]
- return tuple.__new__(cls, mat3x3)
- else:
- raise TypeError(
- "Expected 6 coefficients, found %d" % len(members))
+ mat3x3 = [x * 1.0 for x in [a, b, c, d, e, f]] + [0.0, 0.0, 1.0]
+ return tuple.__new__(cls, mat3x3)
@classmethod
def from_gdal(cls, c, a, b, f, d, e):
@@ -265,7 +279,10 @@ class Affine(
@classmethod
def permutation(cls, *scaling):
- """Create the permutation transform. For 2x2 matrices, there is only one permutation matrix that is not the identity.
+ """Create the permutation transform
+
+ For 2x2 matrices, there is only one permutation matrix that is
+ not the identity.
:rtype: Affine
"""
@@ -491,12 +508,17 @@ class Affine(
def __rmul__(self, other):
"""Right hand multiplication
+ .. deprecated:: 2.3.0
+ Right multiplication will be prohibited in version 3.0. This method
+ will raise AffineError.
+
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.
"""
+ warnings.warn("Right multiplication will be prohibited in version 3.0", DeprecationWarning, stacklevel=2)
assert not isinstance(other, Affine)
return self.__mul__(other)
=====================================
affine/tests/test_transform.py
=====================================
@@ -499,8 +499,9 @@ def test_mul_tuple():
def test_rmul_tuple():
- t = Affine(1, 2, 3, 4, 5, 6)
- (2.0, 2.0) * t
+ with pytest.warns(DeprecationWarning):
+ t = Affine(1, 2, 3, 4, 5, 6)
+ (2.0, 2.0) * t
def test_transform_precision():
=====================================
tox.ini
=====================================
@@ -1,6 +1,6 @@
[tox]
envlist =
- py27,py36
+ py27,py36,py37
[testenv]
usedevelop = true
View it on GitLab: https://salsa.debian.org/debian-gis-team/python-affine/commit/f476055da79eebc02b2531328f7fb19419b6998b
--
View it on GitLab: https://salsa.debian.org/debian-gis-team/python-affine/commit/f476055da79eebc02b2531328f7fb19419b6998b
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/20190905/bd490b4d/attachment-0001.html>
More information about the Pkg-grass-devel
mailing list