Replace .find() check with in / not in

Proprietary

Rewrite .find() return-value checks as membership tests: text.find(sub) == -1 becomes sub not in text and text.find(sub) != -1 becomes sub in text. It only fires where the receiver's type resolves to str, bytes or bytearray (not a subclass), and declines operands with side effects, because in evaluates them in the opposite order, and a comparison holding comments.

org.openrewrite.python.cleanup.SimplifySubstringSearch
mod run . --recipe=org.openrewrite.python.cleanup.SimplifySubstringSearch

Install it once, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.