8000 stubtest: relax async checking for abstract methods by AlexWaygood · Pull Request #12343 · python/mypy · GitHub
[go: up one dir, main page]

Skip to content

stubtest: relax async checking for abstract methods #12343

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

Closed
wants to merge 15 commits into from
Closed
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Merge remote-tracking branch 'origin/master' into async
  • Loading branch information
AlexWaygood committed Jul 27, 2022
commit c79ad7f681244a5d3340b4b355fe1d6b252aa82a
15 changes: 15 additions & 0 deletions mypy/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -1318,6 +1318,21 @@ def has_readable_member(self, name: str) -> bool:
def is_awaitable(self) -> bool:
return self.type.get("__await__") is not None

def is_singleton_type(self) -> bool:
# TODO:
# Also make this return True if the type corresponds to NotImplemented?
return (
self.type.is_enum
and len(self.get_enum_values()) == 1
or self.type.fullname == "builtins.ellipsis"
)

def get_enum_values(self) -> List[str]:
"""Return the list of values for an Enum."""
return [
name for name, sym in self.type.names.items() if isinstance(sym.node, mypy.nodes.Var)
]


class FunctionLike(ProperType):
"""Abstract base class for function types."""
Expand Down
You are viewing a condensed version of this merge commit. You can view the full changes here.
0