Skip to content

Commit

Permalink
Fix Y019 for PEP 570 syntax
Browse files Browse the repository at this point in the history
Fixes PyCQA#455
  • Loading branch information
hauntsaninja committed Jan 4, 2024
1 parent f19f5c8 commit 5cf4ee4
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
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

0 comments on commit 5cf4ee4

Please sign in to comment.