Open cebtenzzre opened 1 year ago
Here is a simple example:
from gi.repository import GLib parser = GLib.option.OptionParser(option_list=[ GLib.option.make_option('--flag', action='store_true', help='flag'), ]) parser.parse_args() print('flag is', parser.values.flag)
mypy complains about type errors:
$ mypy repr.py repr.py:3: error: "ellipsis" has no attribute "OptionParser" [attr-defined] repr.py:4: error: "ellipsis" has no attribute "make_option" [attr-defined] Found 2 errors in 1 file (checked 1 source file)
It looks like the placeholder for this attribute is currently a literal ellipsis: https://github.com/pygobject/pygobject-stubs/blob/97a1be6bdd843d1eb0bfe617e3f8e635592335e2/src/gi-stubs/repository/GLib.pyi#L206
I believe stubgen annotates attributes with _typeshed.Incomplete when the type cannot be determined. typing.Any would probably work as well.
_typeshed.Incomplete
typing.Any
When was this added? I find no documentation online for this.
Seems its this module here https://gitlab.gnome.org/GNOME/pygobject/-/blob/master/gi/_option.py
Here is a simple example:
mypy complains about type errors:
It looks like the placeholder for this attribute is currently a literal ellipsis: https://github.com/pygobject/pygobject-stubs/blob/97a1be6bdd843d1eb0bfe617e3f8e635592335e2/src/gi-stubs/repository/GLib.pyi#L206
I believe stubgen annotates attributes with
_typeshed.Incomplete
when the type cannot be determined.typing.Any
would probably work as well.