Simplify temp-variable swap to tuple unpacking
Recipe ID
org.openrewrite.python.cleanup.SwapVariableArtifactopenrewrite-static-analysisDetect the three-line swap idiom (tmp = x; x = y; y = tmp) and condense it into x, y = y, x using tuple unpacking.
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.SwapVariableIf the recipe isn’t available locally, install it with:
mod config recipes pip install openrewrite-static-analysis