Remove unconditional value overwrites

Proprietary

Remove a constant written to a dict key when the next statement overwrites the same key. Only a dict the enclosing function built with {...} or dict() and has not yet passed on qualifies, and only for constant keys outside try and with blocks. Writes to attributes, parameters and globals are left alone, because another thread, an alias or a setter can observe them.

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

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