-
Notifications
You must be signed in to change notification settings - Fork 81
Syntax error output if a field is named 'from' #73
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
Comments
from
Great bugreport! Thanks. I don't know offhand how we're supposed to type a variable with a reserved keyword name. Will look into it w/ mypy docs / folks. Thanks for reporting! |
It looks like the .py file generator sidesteps the issue by not generating Python code but some meta thing. So at runtime you'd have to write Since there can't be any code that writes |
I'd not emit them. See also https://developers.google.com/protocol-buffers/docs/reference/python-generated#keyword-conflicts |
Uh oh!
There was an error while loading. Please reload this page.
This tool generates .pyi files with syntax error when parsing a proto-file with a field named
from
. E.g.foo.proto
:Running mypy on a project with this kind of autogenerated files results in syntax error:
This is because the
foo_pb2.pyi
file has this in it:The
from = ...
is invalid syntax, and so we have a problem.Just to say I've set up my mypy to ignore these files,
mypy.ini
:But this doesn't ignore syntax errors. As per python/mypy#6897 mypy can't ignore syntax errors. It would be favorable if this project did not generate syntax-invalid output.
I'm using versions:
And here is a gist with the entire contents of the
.proto
file, the generated.py
file (which does not have syntax errors and the problematic and unexcludable.pyi
file:https://gist.github.com/gaggle/8aef6102d314936c9eb33724194682b0
The text was updated successfully, but these errors were encountered: