After running ruff --fix the last line of the following script gets reformatted as np.where(mask is True) but in this context is not the same.
import numpy as np
a = np.arange(10)
mask = a > 5
np.where(mask == True) # equivalent to `mask.nonzero()
Maybe in that context one should not be using np.where(mask == True) but it's equivalent mask.nonzero() instead, at anyrate we have some old code using that pattern.
See below an interactive session showing is not the same.
In [2]: import numpy as np
In [13]: a = np.arange(10)
In [14]: mask = a > 5
In [15]: np.where(mask == True)
Out[15]: (array([6, 7, 8, 9], dtype=int64),)
In [18]: np.where(mask is True)
Out[18]: (array([], dtype=int64),)
What do you think about this corner case?