Apply De Morgan's law to any(not ...)/all(not ...)
Recipe ID
org.openrewrite.python.cleanup.InvertAnyAllBodyArtifactopenrewrite-static-analysisWhen 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.
Single recipeProprietary
Usage
This recipe has no required configuration options. You’ll need the Moderne CLI configured before running the command below.
mod run . --recipe org.openrewrite.python.cleanup.InvertAnyAllBodyIf the recipe isn’t available locally, install it with:
mod config recipes pip install openrewrite-static-analysis