Search code examples
pythonpep8

How to disable a pep8 error in a specific file?


I tried with

#:PEP8 -E223

or

# pep8: disable=E223

I thought the second would work but doesn't seems to work.

Do you have an idea how I can handle this ?


Solution

  • As far as I know, you can't. You can disable errors or warnings user wide, or per project. See the documentation.

    Instead, you can use the # noqa comment at the end of a line, to skip that particular line (see patch 136). Of course, that would skip all PEP8 errors.

    The main author argues against source file noise, so they suggested # pep8 comments don't get included.


    Note that there is also nopep8, which is the equivalent. noqa (which stands for No Quality Assurance was added in version 1.4.1 to support people running pyflakes next to pep8.