-
Notifications
You must be signed in to change notification settings - Fork 79
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
Add metaclass=GeneratedProtocolMessageType to protobuf message class #581
Comments
Well, I realize it's hard to determine the type of return value in this func. I decide to write typing like this:
|
This seems like the way to go. You may be able to restrict the TypeVar to a |
you are right. I added bound=Message to it:
But I still think it's okay to add metaclass typing to proto message classes. Sorry if my idea is stupid. |
I'm working on our codebase to apply mypy-protobuf to generate pyi code. However, we have codes like:
This func accepts protobuf message class as parameters, and parse proto into json. We add GeneratedProtocolMessageType as its type. and mypy would report this error since GeneratedProtocolMessageType does not exist in generated pyi files:
I add metaclass=metaclass=GeneratedProtocolMessageType to pyi files and pass mypy check:
Can mypy-protobuf support this?
The text was updated successfully, but these errors were encountered: