Remove unneeded noqa lint suppression comments (#10772)

This commit is contained in:
danieleades 2022-08-28 20:03:17 +01:00 committed by GitHub
parent 2b02173617
commit 12bff8a273
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
24 changed files with 42 additions and 42 deletions

View File

@ -464,7 +464,7 @@ class EpubBuilder(StandaloneHTMLBuilder):
logger.info(__('writing mimetype file...')) logger.info(__('writing mimetype file...'))
copy_asset_file(path.join(self.template_dir, 'mimetype'), self.outdir) copy_asset_file(path.join(self.template_dir, 'mimetype'), self.outdir)
def build_container(self, outname: str = 'META-INF/container.xml') -> None: # NOQA def build_container(self, outname: str = 'META-INF/container.xml') -> None:
"""Write the metainfo file META-INF/container.xml.""" """Write the metainfo file META-INF/container.xml."""
logger.info(__('writing META-INF/container.xml file...')) logger.info(__('writing META-INF/container.xml file...'))
outdir = path.join(self.outdir, 'META-INF') outdir = path.join(self.outdir, 'META-INF')

View File

@ -1959,7 +1959,7 @@ class Symbol:
if Symbol.debug_lookup: if Symbol.debug_lookup:
Symbol.debug_print( Symbol.debug_print(
"no match, but fill an empty declaration, candSybmol is not None?:", "no match, but fill an empty declaration, candSybmol is not None?:",
candSymbol is not None) # NOQA candSymbol is not None)
Symbol.debug_indent -= 2 Symbol.debug_indent -= 2
if candSymbol is not None: if candSymbol is not None:
candSymbol.remove() candSymbol.remove()

View File

@ -224,7 +224,7 @@ def render_dot(self: SphinxTranslator, code: str, options: Dict, format: str,
return relfn, outfn return relfn, outfn
if (hasattr(self.builder, '_graphviz_warned_dot') and if (hasattr(self.builder, '_graphviz_warned_dot') and
self.builder._graphviz_warned_dot.get(graphviz_dot)): # type: ignore # NOQA self.builder._graphviz_warned_dot.get(graphviz_dot)): # type: ignore
return None, None return None, None
ensuredir(path.dirname(outfn)) ensuredir(path.dirname(outfn))

View File

@ -389,7 +389,7 @@ class ManpageLink(SphinxTransform):
for node in self.document.findall(addnodes.manpage): for node in self.document.findall(addnodes.manpage):
manpage = ' '.join([str(x) for x in node.children manpage = ' '.join([str(x) for x in node.children
if isinstance(x, nodes.Text)]) if isinstance(x, nodes.Text)])
pattern = r'^(?P<path>(?P<page>.+)[\(\.](?P<section>[1-9]\w*)?\)?)$' # noqa pattern = r'^(?P<path>(?P<page>.+)[\(\.](?P<section>[1-9]\w*)?\)?)$'
info = {'path': manpage, info = {'path': manpage,
'page': manpage, 'page': manpage,
'section': ''} 'section': ''}

View File

@ -18,7 +18,7 @@ from docutils.parsers.rst import Directive, directives, roles
from docutils.parsers.rst.states import Inliner from docutils.parsers.rst.states import Inliner
from docutils.statemachine import State, StateMachine, StringList from docutils.statemachine import State, StateMachine, StringList
from docutils.utils import Reporter, unescape from docutils.utils import Reporter, unescape
from docutils.writers._html_base import HTMLTranslator # NoQA from docutils.writers._html_base import HTMLTranslator
from sphinx.deprecation import RemovedInSphinx70Warning, deprecated_alias from sphinx.deprecation import RemovedInSphinx70Warning, deprecated_alias
from sphinx.errors import SphinxError from sphinx.errors import SphinxError

View File

@ -180,7 +180,7 @@ class TexinfoTranslator(SphinxTranslator):
self.escape_newlines = 0 self.escape_newlines = 0
self.escape_hyphens = 0 self.escape_hyphens = 0
self.curfilestack: List[str] = [] self.curfilestack: List[str] = []
self.footnotestack: List[Dict[str, List[Union[collected_footnote, bool]]]] = [] # NOQA self.footnotestack: List[Dict[str, List[Union[collected_footnote, bool]]]] = []
self.in_footnote = 0 self.in_footnote = 0
self.in_samp = 0 self.in_samp = 0
self.handled_abbrs: Set[str] = set() self.handled_abbrs: Set[str] = set()

View File

@ -1,6 +1,6 @@
from dummy import * # NOQA from dummy import *
def test(): def test():
"""Dummy function using dummy.*""" """Dummy function using dummy.*"""
dummy_function() # NOQA dummy_function()

View File

@ -1,7 +1,7 @@
import enum import enum
from io import StringIO from io import StringIO
from sphinx.util import save_traceback # NOQA from sphinx.util import save_traceback
__all__ = ['Class'] __all__ = ['Class']

View File

@ -5,7 +5,7 @@ from functools import wraps
class AsyncClass: class AsyncClass:
async def do_coroutine(self): async def do_coroutine(self):
"""A documented coroutine function""" """A documented coroutine function"""
attr_coro_result = await _other_coro_func() # NOQA attr_coro_result = await _other_coro_func()
@classmethod @classmethod
async def do_coroutine2(cls): async def do_coroutine2(cls):

View File

@ -1,12 +1,12 @@
import missing_module # NOQA import missing_module
import missing_package1.missing_module1 # NOQA import missing_package1.missing_module1
from missing_module import missing_name # NOQA from missing_module import missing_name
from missing_package2 import missing_module2 # NOQA from missing_package2 import missing_module2
from missing_package3.missing_module3 import missing_name # NOQA from missing_package3.missing_module3 import missing_name
import sphinx.missing_module4 # NOQA import sphinx.missing_module4
from sphinx.missing_module4 import missing_name2 # NOQA from sphinx.missing_module4 import missing_name2
@missing_name(int) @missing_name(int)

View File

@ -1,4 +1,4 @@
from os import path # NOQA from os import path
from typing import Union from typing import Union

View File

@ -1,4 +1,4 @@
from os import * # NOQA from os import *
class Foo: class Foo:

View File

@ -1,4 +1,4 @@
from os import * # NOQA from os import *
class Foo: class Foo:

View File

@ -1,4 +1,4 @@
from os import * # NOQA from os import *
class Foo: class Foo:

View File

@ -1,4 +1,4 @@
from os import path # NOQA from os import path
from typing import Union from typing import Union
from autosummary_class_module import Class from autosummary_class_module import Class

View File

@ -1 +1 @@
from .submodule import Class1, func1 # NOQA from .submodule import Class1, func1

View File

@ -8,7 +8,7 @@ extensions = ['sphinx.ext.autodoc', 'sphinx.ext.viewcode']
exclude_patterns = ['_build'] exclude_patterns = ['_build']
if 'test_linkcode' in tags: # NOQA if 'test_linkcode' in tags:
extensions.remove('sphinx.ext.viewcode') extensions.remove('sphinx.ext.viewcode')
extensions.append('sphinx.ext.linkcode') extensions.append('sphinx.ext.linkcode')

View File

@ -1,2 +1,2 @@
from .mod1 import Class1, func1 # NOQA from .mod1 import Class1, func1
from .mod2 import Class2, func2 # NOQA from .mod2 import Class2, func2

View File

@ -46,7 +46,7 @@ extlinks = {'issue': ('http://bugs.python.org/issue%s', 'issue %s'),
'pyurl': ('http://python.org/%s', None)} 'pyurl': ('http://python.org/%s', None)}
# modify tags from conf.py # modify tags from conf.py
tags.add('confpytag') # NOQA tags.add('confpytag')
# -- extension API # -- extension API

View File

@ -1342,8 +1342,8 @@ def test_module_index(app):
assert index.generate() == ( assert index.generate() == (
[('d', [IndexEntry('docutils', 0, 'index', 'module-docutils', '', '', '')]), [('d', [IndexEntry('docutils', 0, 'index', 'module-docutils', '', '', '')]),
('s', [IndexEntry('sphinx', 1, 'index', 'module-sphinx', '', '', ''), ('s', [IndexEntry('sphinx', 1, 'index', 'module-sphinx', '', '', ''),
IndexEntry('sphinx.builders', 2, 'index', 'module-sphinx.builders', '', '', ''), # NOQA IndexEntry('sphinx.builders', 2, 'index', 'module-sphinx.builders', '', '', ''),
IndexEntry('sphinx.builders.html', 2, 'index', 'module-sphinx.builders.html', '', '', ''), # NOQA IndexEntry('sphinx.builders.html', 2, 'index', 'module-sphinx.builders.html', '', '', ''),
IndexEntry('sphinx.config', 2, 'index', 'module-sphinx.config', '', '', ''), IndexEntry('sphinx.config', 2, 'index', 'module-sphinx.config', '', '', ''),
IndexEntry('sphinx_intl', 0, 'index', 'module-sphinx_intl', '', '', '')])], IndexEntry('sphinx_intl', 0, 'index', 'module-sphinx_intl', '', '', '')])],
False False
@ -1386,8 +1386,8 @@ def test_modindex_common_prefix(app):
restructuredtext.parse(app, text) restructuredtext.parse(app, text)
index = PythonModuleIndex(app.env.get_domain('py')) index = PythonModuleIndex(app.env.get_domain('py'))
assert index.generate() == ( assert index.generate() == (
[('b', [IndexEntry('sphinx.builders', 1, 'index', 'module-sphinx.builders', '', '', ''), # NOQA [('b', [IndexEntry('sphinx.builders', 1, 'index', 'module-sphinx.builders', '', '', ''),
IndexEntry('sphinx.builders.html', 2, 'index', 'module-sphinx.builders.html', '', '', '')]), # NOQA IndexEntry('sphinx.builders.html', 2, 'index', 'module-sphinx.builders.html', '', '', '')]),
('c', [IndexEntry('sphinx.config', 0, 'index', 'module-sphinx.config', '', '', '')]), ('c', [IndexEntry('sphinx.config', 0, 'index', 'module-sphinx.config', '', '', '')]),
('d', [IndexEntry('docutils', 0, 'index', 'module-docutils', '', '', '')]), ('d', [IndexEntry('docutils', 0, 'index', 'module-docutils', '', '', '')]),
('s', [IndexEntry('sphinx', 0, 'index', 'module-sphinx', '', '', ''), ('s', [IndexEntry('sphinx', 0, 'index', 'module-sphinx', '', '', ''),

View File

@ -363,7 +363,7 @@ def test_get_doc(app):
# verify that method docstrings get extracted in both normal case # verify that method docstrings get extracted in both normal case
# and in case of bound method posing as a function # and in case of bound method posing as a function
class J: # NOQA class J:
def foo(self): def foo(self):
"""Method docstring""" """Method docstring"""
assert getdocl('method', J.foo) == ['Method docstring'] assert getdocl('method', J.foo) == ['Method docstring']

View File

@ -649,12 +649,12 @@ def test_isattributedescriptor(app):
assert inspect.isattributedescriptor(Base.meth) is False # method assert inspect.isattributedescriptor(Base.meth) is False # method
assert inspect.isattributedescriptor(Base.staticmeth) is False # staticmethod assert inspect.isattributedescriptor(Base.staticmeth) is False # staticmethod
assert inspect.isattributedescriptor(Base.classmeth) is False # classmetho assert inspect.isattributedescriptor(Base.classmeth) is False # classmetho
assert inspect.isattributedescriptor(Descriptor) is False # custom descriptor class # NOQA assert inspect.isattributedescriptor(Descriptor) is False # custom descriptor class
assert inspect.isattributedescriptor(str.join) is False # MethodDescriptorType # NOQA assert inspect.isattributedescriptor(str.join) is False # MethodDescriptorType
assert inspect.isattributedescriptor(object.__init__) is False # WrapperDescriptorType # NOQA assert inspect.isattributedescriptor(object.__init__) is False # WrapperDescriptorType
assert inspect.isattributedescriptor(dict.__dict__['fromkeys']) is False # ClassMethodDescriptorType # NOQA assert inspect.isattributedescriptor(dict.__dict__['fromkeys']) is False # ClassMethodDescriptorType
assert inspect.isattributedescriptor(types.FrameType.f_locals) is True # GetSetDescriptorType # NOQA assert inspect.isattributedescriptor(types.FrameType.f_locals) is True # GetSetDescriptorType
assert inspect.isattributedescriptor(datetime.timedelta.days) is True # MemberDescriptorType # NOQA assert inspect.isattributedescriptor(datetime.timedelta.days) is True # MemberDescriptorType
try: try:
# _testcapi module cannot be importable in some distro # _testcapi module cannot be importable in some distro
@ -662,7 +662,7 @@ def test_isattributedescriptor(app):
import _testcapi import _testcapi
testinstancemethod = _testcapi.instancemethod(str.__repr__) testinstancemethod = _testcapi.instancemethod(str.__repr__)
assert inspect.isattributedescriptor(testinstancemethod) is False # instancemethod (C-API) # NOQA assert inspect.isattributedescriptor(testinstancemethod) is False # instancemethod (C-API)
except ImportError: except ImportError:
pass pass

View File

@ -320,8 +320,8 @@ def test_stringify_type_hints_pep_585():
@pytest.mark.skipif(sys.version_info < (3, 9), reason='python 3.9+ is required.') @pytest.mark.skipif(sys.version_info < (3, 9), reason='python 3.9+ is required.')
def test_stringify_Annotated(): def test_stringify_Annotated():
from typing import Annotated # type: ignore from typing import Annotated # type: ignore
assert stringify(Annotated[str, "foo", "bar"]) == "str" # NOQA assert stringify(Annotated[str, "foo", "bar"]) == "str"
assert stringify(Annotated[str, "foo", "bar"], "smart") == "str" # NOQA assert stringify(Annotated[str, "foo", "bar"], "smart") == "str"
def test_stringify_type_hints_string(): def test_stringify_type_hints_string():

View File

@ -26,7 +26,7 @@ import sphinx
ROOT = os.path.realpath(os.path.join(os.path.abspath(__file__), "..", "..")) ROOT = os.path.realpath(os.path.join(os.path.abspath(__file__), "..", ".."))
class compile_catalog_plusjs(compile_catalog): # NoQA class compile_catalog_plusjs(compile_catalog):
""" """
An extended command that writes all message strings that occur in An extended command that writes all message strings that occur in
JavaScript files to a JavaScript file along with the .mo file. JavaScript files to a JavaScript file along with the .mo file.