mirror of
https://github.com/gentoo-mirror/gentoo.git
synced 2026-08-25 07:08:13 -07:00
dev-python/quantities: Backport numpy 1.24 fix
Also update archive since upstream fixed release tag. Closes: https://bugs.gentoo.org/888243 Signed-off-by: Michał Górny <mgorny@gentoo.org>
This commit is contained in:
@@ -1 +1 @@
|
||||
DIST python-quantities-0.13.0.tar.gz 107187 BLAKE2B ead5c223892f65c68ced2265356f8c1e5374f80a1507ec561370e56e28e8965217a7b99f5c46cb83a5f6a1b1f12eb9f501844650488871d48794f13a4383df38 SHA512 ec0a61d8df8e48e7ee08cab5c899a8c8ad96b964ee0132ab130f272f062436d91e6370aac9d85453eeb3d95e17e79e8dfb80412397eada1f0a4310c0494fa217
|
||||
DIST python-quantities-0.13.0.gh.tar.gz 107178 BLAKE2B f5fe69ed1d82bc90620a1cabf4c68f676330a2b09e8590bedf48ee8c46e3176d57e0dc6374d1112377056cd1138553d92f0bcaf0a68e2600e3631226e2262afc SHA512 d108b0f5bd834aeb7443693175d54b2b01fa9110cc57f0356681374ce95b5f57e39253d9c8166365aabc379f2f26bba3a827689ceb6c45595345e140b4cd7ad3
|
||||
|
||||
68
dev-python/quantities/files/quantities-0.13.0-numpy.patch
Normal file
68
dev-python/quantities/files/quantities-0.13.0-numpy.patch
Normal file
@@ -0,0 +1,68 @@
|
||||
From 29852b895d5d39006d1f129397cffae3578a694e Mon Sep 17 00:00:00 2001
|
||||
From: Andrew Davison <andrew.davison@cnrs.fr>
|
||||
Date: Thu, 7 Jul 2022 10:03:32 +0200
|
||||
Subject: [PATCH] fix failure to handle units with floordiv
|
||||
|
||||
fixes #205
|
||||
---
|
||||
quantities/dimensionality.py | 2 +-
|
||||
quantities/tests/test_arithmetic.py | 16 +++++++++++++++-
|
||||
2 files changed, 16 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/quantities/dimensionality.py b/quantities/dimensionality.py
|
||||
index cea68ca..d54f96f 100644
|
||||
--- a/quantities/dimensionality.py
|
||||
+++ b/quantities/dimensionality.py
|
||||
@@ -238,6 +238,7 @@ def _d_divide(q1, q2, out=None):
|
||||
return q2.dimensionality**-1
|
||||
p_dict[np.divide] = _d_divide
|
||||
p_dict[np.true_divide] = _d_divide
|
||||
+p_dict[np.floor_divide] = _d_divide
|
||||
|
||||
def _d_check_uniform(q1, q2, out=None):
|
||||
try:
|
||||
@@ -273,7 +274,6 @@ p_dict[np.subtract] = _d_check_uniform
|
||||
p_dict[np.mod] = _d_check_uniform
|
||||
p_dict[np.fmod] = _d_check_uniform
|
||||
p_dict[np.remainder] = _d_check_uniform
|
||||
-p_dict[np.floor_divide] = _d_check_uniform
|
||||
p_dict[np.hypot] = _d_check_uniform
|
||||
p_dict[np.equal] = _d_check_uniform
|
||||
p_dict[np.not_equal] = _d_check_uniform
|
||||
diff --git a/quantities/tests/test_arithmetic.py b/quantities/tests/test_arithmetic.py
|
||||
index fe5670e..534702c 100644
|
||||
--- a/quantities/tests/test_arithmetic.py
|
||||
+++ b/quantities/tests/test_arithmetic.py
|
||||
@@ -52,7 +52,7 @@ class iter_dtypes:
|
||||
|
||||
def __init__(self):
|
||||
self._i = 1
|
||||
- self._typeDict = np.typeDict.copy()
|
||||
+ self._typeDict = np.sctypeDict.copy()
|
||||
self._typeDict[17] = int
|
||||
self._typeDict[18] = long
|
||||
self._typeDict[19] = float
|
||||
@@ -132,6 +132,20 @@ class TestDTypes(TestCase):
|
||||
self.check_rmul(x, y)
|
||||
dtypes.pop(0)
|
||||
|
||||
+ def test_truediv(self):
|
||||
+ q = Quantity([44, 40, 36, 32], units=pq.ms)
|
||||
+ self.assertQuantityEqual(
|
||||
+ q/(4 * pq.ms),
|
||||
+ Quantity([11, 10, 9, 8], units=pq.dimensionless)
|
||||
+ )
|
||||
+
|
||||
+ def test_floordiv(self):
|
||||
+ q = Quantity([45, 43, 39, 32], units=pq.ms)
|
||||
+ self.assertQuantityEqual(
|
||||
+ q//(4 * pq.ms),
|
||||
+ Quantity([11, 10, 9, 8], units=pq.dimensionless)
|
||||
+ )
|
||||
+
|
||||
def test_mixed_addition(self):
|
||||
self.assertQuantityEqual(1*pq.ft + 1*pq.m, 4.280839895 * pq.ft)
|
||||
self.assertQuantityEqual(1*pq.ft + pq.m, 4.280839895 * pq.ft)
|
||||
--
|
||||
2.39.0
|
||||
|
||||
@@ -10,10 +10,14 @@ inherit distutils-r1
|
||||
|
||||
MY_P="python-quantities-${PV}"
|
||||
DESCRIPTION="Support for physical quantities with units, based on numpy"
|
||||
HOMEPAGE="https://github.com/python-quantities/python-quantities"
|
||||
HOMEPAGE="
|
||||
https://github.com/python-quantities/python-quantities/
|
||||
https://pypi.org/project/quantities/
|
||||
"
|
||||
SRC_URI="
|
||||
https://github.com/python-quantities/python-quantities/archive/v${PV}.tar.gz
|
||||
-> ${MY_P}.tar.gz"
|
||||
-> ${MY_P}.gh.tar.gz
|
||||
"
|
||||
S=${WORKDIR}/${MY_P}
|
||||
|
||||
LICENSE="BSD"
|
||||
@@ -25,3 +29,7 @@ RDEPEND="
|
||||
"
|
||||
|
||||
distutils_enable_tests pytest
|
||||
|
||||
PATCHES=(
|
||||
"${FILESDIR}"/${P}-numpy.patch
|
||||
)
|
||||
Reference in New Issue
Block a user