PEP8 E712 requires that \"comparison to True should be if cond is True: or if cond:\".
But if I follow this
That advice only applies to if statements testing for the "truthiness" of a value. numpy is a different beast.
>>> a = np.array([True, False])
>>> a == True
array([ True, False], dtype=bool)
>>> a is True
False
Note that a is True is always False because a is an array, not a boolean, and is does a simple reference equality test (so only True is True; None is not True for example).