Swap variables with tuple unpacking

Proprietary

Detect the three-line swap idiom (tmp = x; x = y; y = tmp) and condense it into x, y = y, x using tuple unpacking. It only fires inside a function where tmp is mentioned nowhere else, and leaves a swap with comments between its lines alone.

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

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