Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ignoring single line marked as incorrect by Sublime CodeIntel

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?

like image 473
alex-bf Avatar asked Mar 19 '26 11:03

alex-bf


1 Answers

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

like image 67
Mikko Ohtamaa Avatar answered Mar 24 '26 00:03

Mikko Ohtamaa



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!