Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_check_is_numpy_array():
assert check_is_numpy_array(np.array([1,2,3])) is True
assert check_is_numpy_array(np.ma.array([1,2,3])) is True
assert check_is_numpy_array([1,2]) is False
def test_check_is_numpy_array():
assert check_is_numpy_array(np.array([1,2,3])) is True
assert check_is_numpy_array(np.ma.array([1,2,3])) is True
assert check_is_numpy_array([1,2]) is False
def test_check_is_numpy_array():
assert check_is_numpy_array(np.array([1,2,3])) is True
assert check_is_numpy_array(np.ma.array([1,2,3])) is True
assert check_is_numpy_array([1,2]) is False
types_dict.update(py_types_dict)
hkl_types_dict.update(py_hkl_types_dict)
# Add loaders for numpy types
from .loaders.load_numpy import types_dict as np_types_dict
from .loaders.load_numpy import hkl_types_dict as np_hkl_types_dict
from .loaders.load_numpy import check_is_numpy_array
types_dict.update(np_types_dict)
hkl_types_dict.update(np_hkl_types_dict)
#######################
## ND-ARRAY checking ##
#######################
ndarray_like_check_fns = [
check_is_numpy_array
]
def check_is_ndarray_like(py_obj):
is_ndarray_like = False
for ii, check_fn in enumerate(ndarray_like_check_fns):
is_ndarray_like = check_fn(py_obj)
if is_ndarray_like:
break
return is_ndarray_like
#######################
## loading optional ##
#######################