Adding '# noqa' to the entire docstring works, but it means you lose introspection on the entire docstring, so you could miss other issues.
if you want to narrow your noqa to just the long line you can add it to the long line only, but '# noqa' shows up in the docs when built with sphinx.
In this case, you can build a custom autodoc process method. See this answer.
Here's my adapted version of that,
from sphinx.application import Sphinx
import re
def setup(app):
noqa_regex = re.compile('^(.*)\s\s#\snoqa.*$')
def trim_noqa(app, what_, name, obj, options):
for i, line in enumerate(lines):
if noqa_regex.match(line):
new_line = noqa_regex.sub(r'\1', line)
lines[i] = new_line
app.connect('autodoc-process-docstring', trim_noqa)
return app