Replace .find() check with in / not in
ProprietaryRewrite .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. SimplifySubstringSearchmod run . --recipe= org. openrewrite. python. cleanup. SimplifySubstringSearchInstall it once, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.