提交 2a9db42e authored 作者: Brandon T. Willard's avatar Brandon T. Willard 提交者: Brandon T. Willard

Update use of NumPy generic complex type for casting

上级 3c1a6c33
...@@ -252,8 +252,9 @@ def numpy_scalar(data): ...@@ -252,8 +252,9 @@ def numpy_scalar(data):
Raises Raises
------ ------
NotScalarConstantError NotScalarConstantError
If the numpy ndarray is not a scalar. If the numpy ndarray is not a scalar.
EmptyConstantError
""" """
...@@ -262,7 +263,7 @@ def numpy_scalar(data): ...@@ -262,7 +263,7 @@ def numpy_scalar(data):
assert np.all(np.array([]) == data) assert np.all(np.array([]) == data)
raise EmptyConstantError() raise EmptyConstantError()
try: try:
np.complex(data) # works for all numeric scalars complex(data) # works for all numeric scalars
return data return data
except Exception: except Exception:
raise NotScalarConstantError( raise NotScalarConstantError(
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论