With flake8, to disable a certain error on a line you do this:
example = lambda: 'example' # noqa: E731,E123
However, if I have multiline a statement, flake8 fails to parse the noqa statment at the end:
from detect_fixtures import expected_response_stage3_mocked, expected_response_bbox_oob,\
mock_detection, mock_detection_models, mock_detection_stage1, mock_detection_stage2,\
mock_detection_stage3_given_bbox, mock_load_image # noqa: F401
I want to use '\' for continuation, so I don't want to do this (which does work)
from detect_fixtures import (expected_response_stage3_mocked, # noqa: F401
expected_response_bbox_oob, img, mock_detection, mock_detection_models, # noqa: F401
mock_detection_stage1, mock_detection_stage2, mock_detection_stage3_given_bbox, # noqa: F401
mock_load_image) # noqa: F401
Any help here?
If we ever want to disable Flake8 respecting # noqa comments, we can can refer to flake8 --disable-noqa . Finally, if we have a particularly bad line of code, we can ignore every error using simply # noqa with nothing after it.
[flake8] per-file-ignores = # line too long path/to/file.py: E501, This may be easier than using # noqa comments.
Flake8 is a Python library that wraps PyFlakes, pycodestyle and Ned Batchelder's McCabe script. It is a great toolkit for checking your code base against coding style (PEP8), programming errors (like “library imported but unused” and “Undefined name”) and to check cyclomatic complexity.
from detect_fixtures import (expected_response_stage3_mocked, # noqa: F401
expected_response_bbox_oob, img, mock_detection, mock_detection_models,
mock_detection_stage1, mock_detection_stage2, mock_detection_stage3_given_bbox,
mock_load_image)
You only need one noqa. Flake8 views continuation lines as a single one.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With