Invalid syntax error in generated .pyi file
See original GitHub issueHey! I’ve started using your plugin, and it’s working to an extent that the type hints are picked up by my IDE, which is helpful.
When trying to run mypy on the command line I get this error however:
com/fish/time/time_range_pb2.pyi:45: error: invalid syntax
The relevant lines:
42 class TimeRange(google___protobuf___message___Message):
43
44 @property
45 def from(self) -> google___protobuf___timestamp_pb2___Timestamp: ...
46
I’m using this command line to check the types:
mypy --ignore-missing-imports --python-version 3.7 --namespace-packages --check-untyped-defs -p fish
where the com
and fish
directories reside inside the same directory, and fish
is importing protobufs from com
.
Before adding the --namespace-packages
mypy did finish, but it didn’t seem like it took the types of the protobufs into account.
The protobufs are generated by
python3 -m grpc_tools.protoc -I ./proto --python_out=. --mypy_out=. --grpc_python_out=. ./proto/com/fish/*/*.proto
mypy version 0.701, Python 3.7.3
Any ideas?
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Invalid syntax error in generated .pyi file · Issue #80 - GitHub
When trying to run mypy on the command line I get this error however: com/fish/time/time_range_pb2.pyi:45: error: invalid syntax.
Read more >Invalid Syntax in Python: Common Reasons for SyntaxError
This means that the Python interpreter got to the end of a line (EOL) before an open string was closed. To fix this,...
Read more >python - Why do I get the syntax error "SyntaxError: invalid ...
When an error is reported on a line that appears correct, try removing (or commenting out) the line where the error appears to...
Read more >flake8-pyi - PyPI
flake8-pyi. A plugin for Flake8 that provides specializations for type hinting stub files, especially interesting for linting typeshed.
Read more >The mypy configuration file - mypy 0.991 documentation
Suppress any error messages generated when your codebase tries importing the module somelibrary . This is useful if somelibrary is some 3rd party...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
#91 should solve it!
woops! It appears to be missing from https://github.com/dropbox/mypy-protobuf/blob/master/python/protoc-gen-mypy#L44
Comparing to https://www.programiz.com/python-programming/keyword-list - it’s the only one missing. Going to go ahead and add it and kick a version of mypy-protobuf! Thanks for the catch!