mirror of
https://github.com/astral-sh/ruff
synced 2026-01-21 21:40:51 -05:00
## Summary Implements `Y019` from [flake8-pyi](https://github.com/PyCQA/flake8-pyi). The rule checks if - instance methods that return `self` - class methods that return an instance of `cls` - `__new__` methods Return a custom `TypeVar` instead of `typing.Self` and raises a violation if this is the case. The rule also covers [PEP-695](https://peps.python.org/pep-0695/) syntax as introduced in upstream in https://github.com/PyCQA/flake8-pyi/pull/402 ## Test Plan Added fixtures with test cases from upstream implementation (plus additional one for an excluded edge case, mentioned in upstream implementation)