Given a class with a docstring similar to "ClassName(initparam: str)" or "ClassName(initparam: str) -> ClassName" or "(initparam: str)" or "__init__(initparam: str) -> None" the stub generation via runtime introspection will not digest this information.
This is relevant, because the CPython API doesn't allow setting the __init__ method's docstring, like other members' or type objects', making automatic annotation of constructors impossible.
To Reproduce
You have to build a C extension, but I can provide modules if needed for testing.
Bug Report
Given a class with a docstring similar to
"ClassName(initparam: str)"
or"ClassName(initparam: str) -> ClassName"
or"(initparam: str)"
or"__init__(initparam: str) -> None"
the stub generation via runtime introspection will not digest this information.This is relevant, because the CPython API doesn't allow setting the
__init__
method's docstring, like other members' or type objects', making automatic annotation of constructors impossible.To Reproduce
You have to build a C extension, but I can provide modules if needed for testing.
Expected Behavior
Stubgen should generate the lines in .pyi:
Actual Behavior
Stubgen instead generates:
Your Environment
mypy.ini
(and other config files): Defaults/None