Skip to content

Request: Unsafe fix for custom-type-var-return-type/PYI019 #14183

@Avasam

Description

@Avasam

https://docs.astral.sh/ruff/rules/custom-type-var-return-type/
I feel like logically a fix for this rule should be feasible without too much complexity? (at least in pyi files and maybe py files above 3.10, see #9761). Useful to migrate codebases still using the old TypeVar way of typing Self. The fix should be unsafe as there's still edge-cases where using a TypeVar is needed (typeshed has some of those). Marking it unsafe may also simplify the logic to apply the fix (if Self already exists in scope)

Metadata

Metadata

Assignees

No one assigned

    Labels

    fixesRelated to suggested fixes for violations

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions