You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm running into issues with applying generated annotations to my Python3 snippet. I narrowed down my issue to keyword args(sep='' or end='') passed to print statements. After some debugging I learned that pyannotate is using 2to3 to refactor the code. It looks like 2to3 scans for certain python3 features and then fails to parse the entire file if it finds an instance.
Also, great tool! I'm excited to make use of this. It's worked very well on files without keyword args in print.
$ pyannotate --py3 ./example.py
Can't parse ./example.py: ParseError: bad input: type=22, value='=', context=('', (4, 24))No files need to be modified.There was 1 error:Can't parse ./example.py: ParseError: bad input: type=22, value='=', context=('', (4, 24))
NOTE: this was a dry run; use -w to write files
As a workaround, it appears that importing print_function from future helps 2to3. I'm not sure what the right fix is here though. Perhaps pyannotate can prepend python3 files with this import to bypass issues with lib2to3?
Haha, well, disregard all of this. The -p or --print-function appears to do exactly what I wanted. Maybe there could be a warning or suggestion on using the print function? It is right in the help though, so...
I'm running into issues with applying generated annotations to my Python3 snippet. I narrowed down my issue to keyword args(sep='' or end='') passed to print statements. After some debugging I learned that pyannotate is using 2to3 to refactor the code. It looks like 2to3 scans for certain python3 features and then fails to parse the entire file if it finds an instance.
Also, great tool! I'm excited to make use of this. It's worked very well on files without keyword args in print.
example.py:
Applying annotations to example.py:
Version info:
Exception stack trace (from PyCharm):
The text was updated successfully, but these errors were encountered: