Reputation: 103
I'm using Sublime for a Python project. I have a dictionary comprehension like so:
inv_map = {v:k for k, v in map.items()}
CodeIntel is marking this as an "invalid syntax" error, but this is correct and runs without trouble.
How can I tell CodeIntel to ignore this specific line?
Upvotes: 3
Views: 236
Reputation: 83758
Dictionary comprehension (feature you are using) is Python 2.7+.
inv_map = {v:k for k, v in map.items()}
Internally SublimeLinter runs Python command line programs called pep8 (pep8 is a package name for PEP-8 guideline checks and pyflakes. Due to architecture of SublimeLinter, running them is may be limited to Python 2.x targets, a Python version embedded by Sublime Text.
Relevant SublimeLinter source code here:
https://github.com/SublimeLinter/SublimeLinter/blob/master/sublimelinter/modules/python.py
The error in your question can come from pep8 or Pyflakes.
Pyflakes does not offer documentation how to make it ignore any lines. Probably not possible, as the suggestion in the answers of this question How do I get Pyflakes to ignore a statement? is not to use Pyflakes.
https://pypi.python.org/pypi/pyflakes
pep8 offers only global error and warning ignores, not on per-file or per-line basis.
http://pep8.readthedocs.org/en/latest/intro.html#configuration
Upvotes: 2