Prefer set literals in in membership tests

Proprietary

When a list or tuple of literals appears on the right side of an in test, convert it to a set literal for constant-time lookup. Only a test whose left operand is a literal or whose type resolves to str, bytes, int, float, bool or None is converted, since a set hashes the operand. A list or tuple holding anything but literals is left alone.

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

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