17

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?

Stuart Berg
  • 17,026
  • 12
  • 67
  • 99
M.R.
  • 1,053
  • 2
  • 13
  • 30

1 Answers1

24
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.

YCFlame
  • 1,251
  • 1
  • 15
  • 24