From 275618e38ae627d7038997916597dd13b16d21d5 Mon Sep 17 00:00:00 2001 From: Mathieu Scheltienne Date: Tue, 27 Aug 2024 14:33:22 +0200 Subject: [PATCH 1/2] fix version string parsing --- quantities/dimensionality.py | 3 ++- quantities/quantity.py | 2 +- quantities/tests/test_umath.py | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/quantities/dimensionality.py b/quantities/dimensionality.py index 22207de..d38038e 100644 --- a/quantities/dimensionality.py +++ b/quantities/dimensionality.py @@ -9,7 +9,8 @@ from .registry import unit_registry from .decorators import memoize -_np_version = tuple(map(int, np.__version__.split('.'))) +_np_version = tuple(map(int, np.__version__.split(".dev")[0].split("."))) + def assert_isinstance(obj, types): try: diff --git a/quantities/quantity.py b/quantities/quantity.py index 29b6df3..e6046fd 100644 --- a/quantities/quantity.py +++ b/quantities/quantity.py @@ -291,7 +291,7 @@ def __array_prepare__(self, obj, context=None): return res def __array_wrap__(self, obj, context=None, return_scalar=False): - _np_version = tuple(map(int, np.__version__.split('.'))) + _np_version = tuple(map(int, np.__version__.split(".dev")[0].split("."))) # For NumPy < 2.0 we do old behavior if _np_version < (2, 0, 0): if not isinstance(obj, Quantity): diff --git a/quantities/tests/test_umath.py b/quantities/tests/test_umath.py index 4c113d1..6df6490 100644 --- a/quantities/tests/test_umath.py +++ b/quantities/tests/test_umath.py @@ -3,7 +3,7 @@ from .. import units as pq from .common import TestCase, unittest -_np_version = tuple(map(int, np.__version__.split('.'))) +_np_version = tuple(map(int, np.__version__.split(".dev")[0].split("."))) class TestUmath(TestCase): From 8f99a26bed5ec93984c57c655546567e9ef4be88 Mon Sep 17 00:00:00 2001 From: Mathieu Scheltienne Date: Tue, 27 Aug 2024 14:38:02 +0200 Subject: [PATCH 2/2] add typical .venv to .gitignore --- .gitignore | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index b4d65eb..a5c99dc 100644 --- a/.gitignore +++ b/.gitignore @@ -9,4 +9,5 @@ dist .idea .*cache/ _version.py -MANIFEST \ No newline at end of file +MANIFEST +.venv