codekingpro/portable-devtools
115k
1import numpy as np
2
3# Ban setting dtype since mutating the type of the array in place
4# makes having ndarray be generic over dtype impossible. Generally
5# users should use `ndarray.view` in this situation anyway. See
6#
7# https://github.com/numpy/numpy-stubs/issues/7
8#
9# for more context.
10float_array = np.array([1.0])
11float_array.dtype = np.bool # type: ignore[assignment, misc]
12 