Replace self-referencing ternary with or

Proprietary

When a conditional expression's condition and true branch are the same name, rewrite val if val else fallback as val or fallback. Any other condition, and a conditional with comments inside, are left alone.

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

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