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

single-element tuple #135

Closed
wants to merge 2 commits into from
Closed
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
3 changes: 3 additions & 0 deletions pyi.py
Original file line number Diff line number Diff line change
Expand Up @@ -559,6 +559,8 @@ def visit_Subscript(self, node: ast.Subscript) -> None:
if isinstance(node.slice, ast.Tuple):
self._visit_slice_tuple(node.slice, value_id)
else:
if value_id in ("Tuple", "tuple"):
self.error(node, Y032)
self.visit(node.slice)

def _visit_slice_tuple(self, node: ast.Tuple, parent: str | None) -> None:
Expand Down Expand Up @@ -980,3 +982,4 @@ def parse_options(cls, optmanager, options, extra_args):
Y029 = "Y029 Defining __repr__ or __str__ in a stub is almost always redundant"
Y030 = "Y030 Multiple Literal members in a union. {suggestion}"
Y031 = "Y031 Use class-based syntax for TypedDicts where possible"
Y032 = "Y032 Single-element tuple"