Use generator expression instead of list comprehension in iterable-accepting calls

Proprietary

Functions that consume iterables lazily (e.g. any, sum, sorted) do not need a list comprehension -- a generator expression suffices. It only fires where the function resolves to the builtin and the comprehension does not await. For any and all, which stop early, it also needs builtin collections as the iterables and every element's evaluation to be free of side effects.

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

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