Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Y019 for PEP 570 syntax #456

Merged
merged 1 commit into from
Jan 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pyi.py
Original file line number Diff line number Diff line change
Expand Up @@ -2020,7 +2020,7 @@ def _check_class_method_for_bad_typevars(
self._Y019_error(method, cls_typevar)

def check_self_typevars(self, node: ast.FunctionDef | ast.AsyncFunctionDef) -> None:
pos_or_keyword_args = node.args.args
pos_or_keyword_args = node.args.posonlyargs + node.args.args

if not pos_or_keyword_args:
return
Expand Down
1 change: 1 addition & 0 deletions tests/typevar.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ class GoodClass:
def __new__(cls: type[Self], *args: list[int], **kwargs: set[str]) -> Self: ...
def good_instance_method_1(self: Self, arg: bytes) -> Self: ...
def good_instance_method_2(self, arg1: _S2, arg2: _S2) -> _S2: ...
def good_instance_method_3(self, arg1: _S2, /, arg2: _S2) -> _S2: ...
@classmethod
def good_cls_method_1(cls: type[Self], arg: int) -> Self: ...
@classmethod
Expand Down