Skip to content

Commit

Permalink
Fixed type issues because we support numpy 1 and 2
Browse files Browse the repository at this point in the history
  • Loading branch information
david-zwicker committed Jun 17, 2024
1 parent 86d2dbb commit 37dba32
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions pde/tools/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -389,15 +389,15 @@ def number_array(
# dtype needs to be determined automatically
try:
# convert the result to a numpy array with the given dtype
result = np.array(data, dtype=get_common_dtype(data), copy=copy)
result = np.array(data, dtype=get_common_dtype(data), copy=copy) # type: ignore
except TypeError:
# Conversion can fail when `data` contains a complex sympy number, i.e.,
# sympy.I. In this case, we simply try to convert the expression using a
# complex dtype
result = np.array(data, dtype=np.cdouble, copy=copy)
result = np.array(data, dtype=np.cdouble, copy=copy) # type: ignore

else:
# a specific dtype is requested
result = np.array(data, dtype=np.dtype(dtype), copy=copy)
result = np.array(data, dtype=np.dtype(dtype), copy=copy) # type: ignore

return result

0 comments on commit 37dba32

Please sign in to comment.