We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
It would be useful to add typings of the keys and values of the __members__ dictionary on class that represent enum in C.
__members__
enum
For example, with this pybind11 code of library named lib :
lib
py::enum_<Number>(m, "Number") .value("Zero", Number::Zero) .value("One", Number::One) .value("Tow", Number::Two);
instead of :
class Number(): .... __members__: dict # value = {'Zero': <Number.Zero: 0>, 'One': < Number.One: 1>, 'Two': <Number.Two: 2>}
to have :
class Number(): .... __members__: dict[str, lib.Number] # value = {'Zero': <Number.Zero: 0>, 'One': < Number.One: 1>, 'Two': <Number.Two: 2>}
When we import code with these kinds of stubs and use mypy to type checked the code, we have this warning.
mypy
error: Missing type parameters for generic type "dict" [type-arg]
The text was updated successfully, but these errors were encountered:
Thanks for the suggestion!
Implemented in #112
Example from tests:
pybind11-stubgen/tests/stubs/demo/_bindings/enum.pyi
Lines 39 to 41 in a1cd5fa
Sorry, something went wrong.
No branches or pull requests
It would be useful to add typings of the keys and values of the
__members__
dictionary on class that representenum
in C.For example, with this pybind11 code of library named
lib
:instead of :
to have :
When we import code with these kinds of stubs and use
mypy
to type checked the code, we have this warning.The text was updated successfully, but these errors were encountered: