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

Bring back type annotation support of dunder methods in stub generator (fix #12717) #12828

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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion mypy/stubgenc.py
Expand Up @@ -288,7 +288,7 @@ def infer_prop_type(docstr: Optional[str]) -> Optional[str]:
return None

# Ignore special properties/attributes.
if name.startswith('__') and name.endswith('__'):
if is_skipped_attribute(name):
return

inferred = infer_prop_type(getattr(obj, '__doc__', None))
Expand Down
Expand Up @@ -5,6 +5,7 @@ PI: float

class Point:
class AngleUnit:
__members__: ClassVar[dict] = ... # read-only
__entries: ClassVar[dict] = ...
degree: ClassVar[Point.AngleUnit] = ...
radian: ClassVar[Point.AngleUnit] = ...
Expand All @@ -22,6 +23,7 @@ class Point:
def value(self) -> int: ...

class LengthUnit:
__members__: ClassVar[dict] = ... # read-only
__entries: ClassVar[dict] = ...
inch: ClassVar[Point.LengthUnit] = ...
mm: ClassVar[Point.LengthUnit] = ...
Expand Down