From 9c417058831a4edda8b7c2ffc653a4cd94bc5390 Mon Sep 17 00:00:00 2001 From: sneakers-the-rat Date: Fri, 17 May 2024 17:43:37 -0700 Subject: [PATCH] use np.array rather than ndarray to coerce lists --- src/numpydantic/interface/numpy.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/numpydantic/interface/numpy.py b/src/numpydantic/interface/numpy.py index f6417ca..ae29e04 100644 --- a/src/numpydantic/interface/numpy.py +++ b/src/numpydantic/interface/numpy.py @@ -8,12 +8,14 @@ from numpydantic.interface.interface import Interface try: from numpy import ndarray + import numpy as np ENABLED = True except ImportError: # pragma: no cover ENABLED = False ndarray = None + np = None class NumpyInterface(Interface): @@ -41,7 +43,7 @@ class NumpyInterface(Interface): return True else: try: - _ = ndarray(array) + _ = np.array(array) return True except TypeError: return False @@ -52,7 +54,7 @@ class NumpyInterface(Interface): in :meth:`.check` """ if not isinstance(array, ndarray): - array = ndarray(array) + array = np.array(array) return array @classmethod