Prefer startswith/endswith over slice comparison

Proprietary

Rewrite s[:N] == "lit" as s.startswith("lit") and s[-N:] == "lit" as s.endswith("lit") when the slice length equals the non-zero literal length. It only fires where the type of s resolves to str, and leaves a slice with a step alone.

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

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