Skip to content

Y019 sensitive to PEP 570 syntax #455

Closed
@hauntsaninja

Description

λ cat hm.pyi
from typing import Generic, TypeVar

_KT = TypeVar("_KT")  # Key type.
_VT = TypeVar("_VT")  # Value type.

class M1(Generic[_KT, _VT]):
    def pop(self, __key: _KT, default: _VT) -> _VT: ...


class M2(Generic[_KT, _VT]):
    def pop(self, key: _KT, /, default: _VT) -> _VT: ...

λ flake8 hm.pyi
hm.pyi:11:32: Y019 Use "_typeshed.Self" instead of "_VT", e.g. "def pop(self, key: _KT, /, default: Self) -> Self: ..."

Looks like logic for determining first parameter isn't correct

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions