syntax error warning for type hinting annotation with pycharm
Answered
I'm writing a code for type hinting annotation with pycharm such like
def run() -> list:
In my env, this is warned for a syntax error with a comment
"illegal target for variable annotation"
However, it is able to run and the syntax seems correct.
How to suppress this warning?
My pycharm is 2017.1.
My python env is the anaconda env with python 3.6 on windows 10,
Please sign in to leave a comment.
Hello, thank you for the report.
Could you please attach a screenshot that shows the problem?
I'm seeing a similar issue.
The entire function call for setup() is highlighted with the "Illegal target for variable annotation" warning.
I'm very sorry for not responding.
However, I met this problem again.
The interpreter is Python 3.7 and turned editor>inspections>python>code compatibility inspection off.
Do you have any idea to solve it?
Hi @Yatzhash
I suggest reporting it to issue tracker (https://youtrack.jetbrains.com/issues/PY), providing the minimal code snippet to reproduce>
Disappointed with the response here unfortunately.
I came via Google with the same problem. For those who have done the same: eventually, I tracked it down to one of my plugins - not sure which one exactly, I just disabled them all and re-enabled only the plugins I actively use, which did the trick.
File -> Settings, then go to Plugins. The main suspect is "Pyxl Support" by Christoffer Klang (v1.2) but I'm not sure if that was indeed the culprit.