Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit a54c84d

Browse filesBrowse files
bluenote10JukkaL
authored andcommitted
Bring back type annotation support of dunder methods in stub generator (#12828)
Fixes #12717
1 parent 290f013 commit a54c84d
Copy full SHA for a54c84d

File tree

Expand file treeCollapse file tree

2 files changed

+3
-1
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+3
-1
lines changed

‎mypy/stubgenc.py

Copy file name to clipboardExpand all lines: mypy/stubgenc.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ def infer_prop_type(docstr: Optional[str]) -> Optional[str]:
288288
return None
289289

290290
# Ignore special properties/attributes.
291-
if name.startswith('__') and name.endswith('__'):
291+
if is_skipped_attribute(name):
292292
return
293293

294294
inferred = infer_prop_type(getattr(obj, '__doc__', None))

‎test-data/stubgen/pybind11_mypy_demo/basics.pyi

Copy file name to clipboardExpand all lines: test-data/stubgen/pybind11_mypy_demo/basics.pyi
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ PI: float
55

66
class Point:
77
class AngleUnit:
8+
__members__: ClassVar[dict] = ... # read-only
89
__entries: ClassVar[dict] = ...
910
degree: ClassVar[Point.AngleUnit] = ...
1011
radian: ClassVar[Point.AngleUnit] = ...
@@ -20,6 +21,7 @@ class Point:
2021
def name(self) -> str: ...
2122

2223
class LengthUnit:
24+
__members__: ClassVar[dict] = ... # read-only
2325
__entries: ClassVar[dict] = ...
2426
inch: ClassVar[Point.LengthUnit] = ...
2527
mm: ClassVar[Point.LengthUnit] = ...

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.