PyCQA / flake8-pyi

A plugin for Flake8 that provides specializations for type hinting stub files
MIT License
73 stars 23 forks source link

Y019 sensitive to PEP 570 syntax #455

Closed hauntsaninja closed 10 months ago

hauntsaninja commented 10 months ago
λ 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