Skip to content

Fix numpy version string parsing #238

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ dist
.idea
.*cache/
_version.py
MANIFEST
MANIFEST
.venv
3 changes: 2 additions & 1 deletion quantities/dimensionality.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion quantities/quantity.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
2 changes: 1 addition & 1 deletion quantities/tests/test_umath.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
Loading