Rewrite any(v == literal ...) as literal in collection

Proprietary

An any() generator that tests equality against a literal value is equivalent to the in membership operator, which is clearer. It only fires where any resolves to the builtin and the iterable's type resolves to list or tuple, whose in compares each element with ==, unlike a str, a set or a custom container.

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

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