Remove duplicate conditions in if/elif chains

Proprietary

Remove elif branches whose condition is identical to an earlier branch in the same if/elif chain, since the duplicate branch is dead code that can never execute. A condition that may have side effects, such as a call, is kept, since evaluating it again can give a different result, and so is a branch whose removal would drop a comment.

org.openrewrite.python.codequality.RemoveDuplicateConditions
mod run . --recipe=org.openrewrite.python.codequality.RemoveDuplicateConditions

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