mirror of
https://github.com/astral-sh/ruff
synced 2026-01-11 08:34:29 -05:00
## Summary This PR fixes the autofix behavior for `PT022` to create an additional edit for the return type if it's present. The edit will update the return type from `Generator[T, ...]` to `T`. As per the [official documentation](https://docs.python.org/3/library/typing.html?highlight=typing%20generator#typing.Generator), the first position is the yield type, so we can ignore other positions. ```python typing.Generator[YieldType, SendType, ReturnType] ``` ## Test Plan Add new test cases, `cargo test` and review the snapshots. fixes: #7610