Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
cebtenzzre opened this issue Jun 13, 2023 · 2 comments
Open

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

cebtenzzre opened this issue Jun 13, 2023 · 2 comments

Comments

@cebtenzzre
Copy link

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.

@lovetox
Copy link
Collaborator

lovetox commented Jun 13, 2023

When was this added? I find no documentation online for this.

@lovetox
Copy link
Collaborator

lovetox commented Jun 13, 2023

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants