Skip to content

Support GLib.option (or use a better placeholder) #148

@cebtenzzre

Description

@cebtenzzre

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:

option = ... # FIXME Constant

I believe stubgen annotates attributes with _typeshed.Incomplete when the type cannot be determined. typing.Any would probably work as well.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions