Convert one-item dict.update() to bracket assignment
ProprietaryWhen .update() receives a dictionary literal containing exactly one key, rewrite it as a direct key assignment for clarity and efficiency. Only a call standing as a statement on a receiver whose type resolves to dict is rewritten, and only where the receiver, key and value are names, literals or attribute reads, since an assignment evaluates its value first. A call inside a with block whose context manager's name contains raises is left alone, since []= may raise a different exception.
org. openrewrite. python. cleanup. SimplifyDictionaryUpdatemod run . --recipe= org. openrewrite. python. cleanup. SimplifyDictionaryUpdateInstall it once, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.