diff --git a/sphinx/builders/_epub_base.py b/sphinx/builders/_epub_base.py index 99035dc42..2f3917411 100644 --- a/sphinx/builders/_epub_base.py +++ b/sphinx/builders/_epub_base.py @@ -464,7 +464,7 @@ class EpubBuilder(StandaloneHTMLBuilder): logger.info(__('writing mimetype file...')) 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.""" logger.info(__('writing META-INF/container.xml file...')) outdir = path.join(self.outdir, 'META-INF') diff --git a/sphinx/domains/c.py b/sphinx/domains/c.py index ad5927019..f8bc2c86f 100644 --- a/sphinx/domains/c.py +++ b/sphinx/domains/c.py @@ -1959,7 +1959,7 @@ class Symbol: if Symbol.debug_lookup: Symbol.debug_print( "no match, but fill an empty declaration, candSybmol is not None?:", - candSymbol is not None) # NOQA + candSymbol is not None) Symbol.debug_indent -= 2 if candSymbol is not None: candSymbol.remove() diff --git a/sphinx/ext/graphviz.py b/sphinx/ext/graphviz.py index 0459c4a96..c950da20b 100644 --- a/sphinx/ext/graphviz.py +++ b/sphinx/ext/graphviz.py @@ -224,7 +224,7 @@ def render_dot(self: SphinxTranslator, code: str, options: Dict, format: str, return relfn, outfn 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 ensuredir(path.dirname(outfn)) diff --git a/sphinx/transforms/__init__.py b/sphinx/transforms/__init__.py index b661870bf..501b528f0 100644 --- a/sphinx/transforms/__init__.py +++ b/sphinx/transforms/__init__.py @@ -389,7 +389,7 @@ class ManpageLink(SphinxTransform): for node in self.document.findall(addnodes.manpage): manpage = ' '.join([str(x) for x in node.children if isinstance(x, nodes.Text)]) - pattern = r'^(?P(?P.+)[\(\.](?P
[1-9]\w*)?\)?)$' # noqa + pattern = r'^(?P(?P.+)[\(\.](?P
[1-9]\w*)?\)?)$' info = {'path': manpage, 'page': manpage, 'section': ''} diff --git a/sphinx/util/docutils.py b/sphinx/util/docutils.py index 88bdaf943..3ca75deea 100644 --- a/sphinx/util/docutils.py +++ b/sphinx/util/docutils.py @@ -18,7 +18,7 @@ from docutils.parsers.rst import Directive, directives, roles from docutils.parsers.rst.states import Inliner from docutils.statemachine import State, StateMachine, StringList 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.errors import SphinxError diff --git a/sphinx/writers/texinfo.py b/sphinx/writers/texinfo.py index 10d86130f..aeb8e8f63 100644 --- a/sphinx/writers/texinfo.py +++ b/sphinx/writers/texinfo.py @@ -180,7 +180,7 @@ class TexinfoTranslator(SphinxTranslator): self.escape_newlines = 0 self.escape_hyphens = 0 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_samp = 0 self.handled_abbrs: Set[str] = set() diff --git a/tests/roots/test-ext-autodoc/autodoc_dummy_module.py b/tests/roots/test-ext-autodoc/autodoc_dummy_module.py index 1e9ed19dc..c05d96e0d 100644 --- a/tests/roots/test-ext-autodoc/autodoc_dummy_module.py +++ b/tests/roots/test-ext-autodoc/autodoc_dummy_module.py @@ -1,6 +1,6 @@ -from dummy import * # NOQA +from dummy import * def test(): """Dummy function using dummy.*""" - dummy_function() # NOQA + dummy_function() diff --git a/tests/roots/test-ext-autodoc/target/__init__.py b/tests/roots/test-ext-autodoc/target/__init__.py index 54f52bbff..0d39c6672 100644 --- a/tests/roots/test-ext-autodoc/target/__init__.py +++ b/tests/roots/test-ext-autodoc/target/__init__.py @@ -1,7 +1,7 @@ import enum from io import StringIO -from sphinx.util import save_traceback # NOQA +from sphinx.util import save_traceback __all__ = ['Class'] diff --git a/tests/roots/test-ext-autodoc/target/coroutine.py b/tests/roots/test-ext-autodoc/target/coroutine.py index 156d7f961..f977b6e77 100644 --- a/tests/roots/test-ext-autodoc/target/coroutine.py +++ b/tests/roots/test-ext-autodoc/target/coroutine.py @@ -5,7 +5,7 @@ from functools import wraps class AsyncClass: async def do_coroutine(self): """A documented coroutine function""" - attr_coro_result = await _other_coro_func() # NOQA + attr_coro_result = await _other_coro_func() @classmethod async def do_coroutine2(cls): diff --git a/tests/roots/test-ext-autodoc/target/need_mocks.py b/tests/roots/test-ext-autodoc/target/need_mocks.py index 6f75dc380..45b3ade06 100644 --- a/tests/roots/test-ext-autodoc/target/need_mocks.py +++ b/tests/roots/test-ext-autodoc/target/need_mocks.py @@ -1,12 +1,12 @@ -import missing_module # NOQA -import missing_package1.missing_module1 # NOQA -from missing_module import missing_name # NOQA -from missing_package2 import missing_module2 # NOQA -from missing_package3.missing_module3 import missing_name # NOQA +import missing_module +import missing_package1.missing_module1 +from missing_module import missing_name +from missing_package2 import missing_module2 +from missing_package3.missing_module3 import missing_name -import sphinx.missing_module4 # NOQA -from sphinx.missing_module4 import missing_name2 # NOQA +import sphinx.missing_module4 +from sphinx.missing_module4 import missing_name2 @missing_name(int) diff --git a/tests/roots/test-ext-autosummary-filename-map/autosummary_dummy_module.py b/tests/roots/test-ext-autosummary-filename-map/autosummary_dummy_module.py index 1f57eeb25..0953b64b9 100644 --- a/tests/roots/test-ext-autosummary-filename-map/autosummary_dummy_module.py +++ b/tests/roots/test-ext-autosummary-filename-map/autosummary_dummy_module.py @@ -1,4 +1,4 @@ -from os import path # NOQA +from os import path from typing import Union diff --git a/tests/roots/test-ext-autosummary-recursive/package/module.py b/tests/roots/test-ext-autosummary-recursive/package/module.py index 5506d0bc9..c76e73302 100644 --- a/tests/roots/test-ext-autosummary-recursive/package/module.py +++ b/tests/roots/test-ext-autosummary-recursive/package/module.py @@ -1,4 +1,4 @@ -from os import * # NOQA +from os import * class Foo: diff --git a/tests/roots/test-ext-autosummary-recursive/package/package/module.py b/tests/roots/test-ext-autosummary-recursive/package/package/module.py index 5506d0bc9..c76e73302 100644 --- a/tests/roots/test-ext-autosummary-recursive/package/package/module.py +++ b/tests/roots/test-ext-autosummary-recursive/package/package/module.py @@ -1,4 +1,4 @@ -from os import * # NOQA +from os import * class Foo: diff --git a/tests/roots/test-ext-autosummary-recursive/package2/module.py b/tests/roots/test-ext-autosummary-recursive/package2/module.py index 5506d0bc9..c76e73302 100644 --- a/tests/roots/test-ext-autosummary-recursive/package2/module.py +++ b/tests/roots/test-ext-autosummary-recursive/package2/module.py @@ -1,4 +1,4 @@ -from os import * # NOQA +from os import * class Foo: diff --git a/tests/roots/test-ext-autosummary/autosummary_dummy_module.py b/tests/roots/test-ext-autosummary/autosummary_dummy_module.py index 9c4a0445d..2d8829a23 100644 --- a/tests/roots/test-ext-autosummary/autosummary_dummy_module.py +++ b/tests/roots/test-ext-autosummary/autosummary_dummy_module.py @@ -1,4 +1,4 @@ -from os import path # NOQA +from os import path from typing import Union from autosummary_class_module import Class diff --git a/tests/roots/test-ext-viewcode-find/not_a_package/__init__.py b/tests/roots/test-ext-viewcode-find/not_a_package/__init__.py index f79ec81f5..2382935a3 100644 --- a/tests/roots/test-ext-viewcode-find/not_a_package/__init__.py +++ b/tests/roots/test-ext-viewcode-find/not_a_package/__init__.py @@ -1 +1 @@ -from .submodule import Class1, func1 # NOQA +from .submodule import Class1, func1 diff --git a/tests/roots/test-ext-viewcode/conf.py b/tests/roots/test-ext-viewcode/conf.py index 6ec2b7742..bee063988 100644 --- a/tests/roots/test-ext-viewcode/conf.py +++ b/tests/roots/test-ext-viewcode/conf.py @@ -8,7 +8,7 @@ extensions = ['sphinx.ext.autodoc', 'sphinx.ext.viewcode'] exclude_patterns = ['_build'] -if 'test_linkcode' in tags: # NOQA +if 'test_linkcode' in tags: extensions.remove('sphinx.ext.viewcode') extensions.append('sphinx.ext.linkcode') diff --git a/tests/roots/test-ext-viewcode/spam/__init__.py b/tests/roots/test-ext-viewcode/spam/__init__.py index c438f6050..62190421f 100644 --- a/tests/roots/test-ext-viewcode/spam/__init__.py +++ b/tests/roots/test-ext-viewcode/spam/__init__.py @@ -1,2 +1,2 @@ -from .mod1 import Class1, func1 # NOQA -from .mod2 import Class2, func2 # NOQA +from .mod1 import Class1, func1 +from .mod2 import Class2, func2 diff --git a/tests/roots/test-root/conf.py b/tests/roots/test-root/conf.py index 687445a70..1065cd193 100644 --- a/tests/roots/test-root/conf.py +++ b/tests/roots/test-root/conf.py @@ -46,7 +46,7 @@ extlinks = {'issue': ('http://bugs.python.org/issue%s', 'issue %s'), 'pyurl': ('http://python.org/%s', None)} # modify tags from conf.py -tags.add('confpytag') # NOQA +tags.add('confpytag') # -- extension API diff --git a/tests/test_domain_py.py b/tests/test_domain_py.py index 9e9cd4fb3..81fa140d7 100644 --- a/tests/test_domain_py.py +++ b/tests/test_domain_py.py @@ -1342,8 +1342,8 @@ def test_module_index(app): assert index.generate() == ( [('d', [IndexEntry('docutils', 0, 'index', 'module-docutils', '', '', '')]), ('s', [IndexEntry('sphinx', 1, 'index', 'module-sphinx', '', '', ''), - IndexEntry('sphinx.builders', 2, 'index', 'module-sphinx.builders', '', '', ''), # NOQA - IndexEntry('sphinx.builders.html', 2, 'index', 'module-sphinx.builders.html', '', '', ''), # NOQA + IndexEntry('sphinx.builders', 2, 'index', 'module-sphinx.builders', '', '', ''), + IndexEntry('sphinx.builders.html', 2, 'index', 'module-sphinx.builders.html', '', '', ''), IndexEntry('sphinx.config', 2, 'index', 'module-sphinx.config', '', '', ''), IndexEntry('sphinx_intl', 0, 'index', 'module-sphinx_intl', '', '', '')])], False @@ -1386,8 +1386,8 @@ def test_modindex_common_prefix(app): restructuredtext.parse(app, text) index = PythonModuleIndex(app.env.get_domain('py')) assert index.generate() == ( - [('b', [IndexEntry('sphinx.builders', 1, 'index', 'module-sphinx.builders', '', '', ''), # NOQA - IndexEntry('sphinx.builders.html', 2, 'index', 'module-sphinx.builders.html', '', '', '')]), # NOQA + [('b', [IndexEntry('sphinx.builders', 1, 'index', 'module-sphinx.builders', '', '', ''), + IndexEntry('sphinx.builders.html', 2, 'index', 'module-sphinx.builders.html', '', '', '')]), ('c', [IndexEntry('sphinx.config', 0, 'index', 'module-sphinx.config', '', '', '')]), ('d', [IndexEntry('docutils', 0, 'index', 'module-docutils', '', '', '')]), ('s', [IndexEntry('sphinx', 0, 'index', 'module-sphinx', '', '', ''), diff --git a/tests/test_ext_autodoc.py b/tests/test_ext_autodoc.py index c1e9c148b..db57e2c1e 100644 --- a/tests/test_ext_autodoc.py +++ b/tests/test_ext_autodoc.py @@ -363,7 +363,7 @@ def test_get_doc(app): # verify that method docstrings get extracted in both normal case # and in case of bound method posing as a function - class J: # NOQA + class J: def foo(self): """Method docstring""" assert getdocl('method', J.foo) == ['Method docstring'] diff --git a/tests/test_util_inspect.py b/tests/test_util_inspect.py index 98f6f0b88..2248429ec 100644 --- a/tests/test_util_inspect.py +++ b/tests/test_util_inspect.py @@ -649,12 +649,12 @@ def test_isattributedescriptor(app): assert inspect.isattributedescriptor(Base.meth) is False # method assert inspect.isattributedescriptor(Base.staticmeth) is False # staticmethod assert inspect.isattributedescriptor(Base.classmeth) is False # classmetho - assert inspect.isattributedescriptor(Descriptor) is False # custom descriptor class # NOQA - assert inspect.isattributedescriptor(str.join) is False # MethodDescriptorType # NOQA - assert inspect.isattributedescriptor(object.__init__) is False # WrapperDescriptorType # NOQA - assert inspect.isattributedescriptor(dict.__dict__['fromkeys']) is False # ClassMethodDescriptorType # NOQA - assert inspect.isattributedescriptor(types.FrameType.f_locals) is True # GetSetDescriptorType # NOQA - assert inspect.isattributedescriptor(datetime.timedelta.days) is True # MemberDescriptorType # NOQA + assert inspect.isattributedescriptor(Descriptor) is False # custom descriptor class + assert inspect.isattributedescriptor(str.join) is False # MethodDescriptorType + assert inspect.isattributedescriptor(object.__init__) is False # WrapperDescriptorType + assert inspect.isattributedescriptor(dict.__dict__['fromkeys']) is False # ClassMethodDescriptorType + assert inspect.isattributedescriptor(types.FrameType.f_locals) is True # GetSetDescriptorType + assert inspect.isattributedescriptor(datetime.timedelta.days) is True # MemberDescriptorType try: # _testcapi module cannot be importable in some distro @@ -662,7 +662,7 @@ def test_isattributedescriptor(app): import _testcapi 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: pass diff --git a/tests/test_util_typing.py b/tests/test_util_typing.py index 5aa558c82..654610096 100644 --- a/tests/test_util_typing.py +++ b/tests/test_util_typing.py @@ -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.') def test_stringify_Annotated(): from typing import Annotated # type: ignore - assert stringify(Annotated[str, "foo", "bar"]) == "str" # NOQA - assert stringify(Annotated[str, "foo", "bar"], "smart") == "str" # NOQA + assert stringify(Annotated[str, "foo", "bar"]) == "str" + assert stringify(Annotated[str, "foo", "bar"], "smart") == "str" def test_stringify_type_hints_string(): diff --git a/utils/babel_runner.py b/utils/babel_runner.py index 514ce9eb5..32e6fe642 100644 --- a/utils/babel_runner.py +++ b/utils/babel_runner.py @@ -26,7 +26,7 @@ import sphinx 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 JavaScript files to a JavaScript file along with the .mo file.