Apply De Morgan's law to any(not ...)/all(not ...)

Proprietary

When the generator body just negates the loop variable, De Morgan's law lets us eliminate the generator entirely: any(not v for v in seq) becomes not all(seq), and the reverse. It only fires where any and all resolve to the builtins.

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

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