Skip to content

Commit

Permalink
Bring back type annotation support of dunder methods in stub generator (
Browse files Browse the repository at this point in the history
#12828)

Fixes #12717
  • Loading branch information
bluenote10 authored May 21, 2022
1 parent 927a9ba commit f19a711
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion mypy/stubgenc.py
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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

0 comments on commit f19a711

Please sign in to comment.