← All recipes
Moderne licensed

Drop redundant .keys() on dict iteration

Recipe IDorg.openrewrite.python.cleanup.RemoveDictKeysArtifactopenrewrite-static-analysis

Dictionaries iterate over their keys by default, making explicit .keys() calls unnecessary in for-loops and in expressions.

Single recipeProprietary

Usage

This recipe has no required configuration options. You’ll need the Moderne CLI configured before running the command below.

mod run . --recipe org.openrewrite.python.cleanup.RemoveDictKeys

If the recipe isn’t available locally, install it with:

mod config recipes pip install openrewrite-static-analysis