flake8如何在多行代码中忽略?

M.R*_*.R. 6 python pyflakes

使用flake8,要在一行中禁用某个错误,请执行以下操作:

example = lambda: 'example'  # noqa: E731,E123
Run Code Online (Sandbox Code Playgroud)

但是,如果我有多行语句,则flake8无法在末尾解析noqa语句:

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   
Run Code Online (Sandbox Code Playgroud)

我想使用“ \”作为延续,所以我不想这样做(确实可行)

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          
Run Code Online (Sandbox Code Playgroud)

这里有什么帮助吗?

YCF*_*ame 6

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)
Run Code Online (Sandbox Code Playgroud)

您只需要一个noqa。Flake8将延续线视为一条。