pybind11-stubgen
pybind11-stubgen copied to clipboard
Ignore private attributes
Attributes with a single leading underscore are considered private, not type info should be generated (by default).
Also see https://mypy.readthedocs.io/en/stable/stubgen.html#cmdoption-stubgen-include-private
The following fragment in AttributeStubsGenerator.to_lines
seems to do the job:
def to_lines(self): # type: () -> List[str]
if re.match(r"^_[^_](.*[^_])?$", self.name):
pass
...