Collapse boolean ternary to bare condition

Proprietary

Replace True if expr else False with bool(expr) and False if expr else True with not expr, and collapse a ternary whose branches are identical. Identical branches are left alone when the condition may have side effects, and bool(expr) is not written where bool names something other than the builtin.

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

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