A value is compared with None using == or !=

tx0/python:none-comparisonstrictwarningstyle

What it finds

x == None: None is a single object, and is None asks the question directly, while == asks the other operand, whose __eq__ may answer differently.

The fix writes is or is not. It is unsafe, because for some values the answers differ on purpose: arrays and data frames compare element by element.

From the rule's source, none_comparison.rs.

Example from the rule's tests
def check(value, other):    if value == None:tx0 reports: compare with None using is rather than ==        pass    if None != value:tx0 reports: compare with None using is not rather than !=        pass    if value is None or value is not None or value == other:        pass
Highlighted lines are the ones tx0 reports, with its message under each; the other lines are left alone.

Turn it on, off or suppress it

The rule runs from the strict tier up. To turn it on in a lower tier, give it a level in tx0.toml:

tx0.toml
[rules]
"tx0/python:none-comparison" = "warning"

To keep one finding, suppress it with a reason. tx0 suppress ID --reason "..." writes the comment on the line before the code:

# tx0: ignore[tx0/python:none-comparison] reason="..."

tx0 explain tx0/python:none-comparison shows the same in the terminal. Found a false positive? Report it.