diff --git a/doc/conf.py b/doc/conf.py index 3015ae23c..37f86232d 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -189,7 +189,7 @@ nitpick_ignore = { # -- Extension interface ------------------------------------------------------- -from sphinx import addnodes # noqa: E402 +from sphinx import addnodes # NoQA: E402 event_sig_re = re.compile(r'([a-zA-Z-]+)\s*\((.*)\)') diff --git a/sphinx/builders/__init__.py b/sphinx/builders/__init__.py index 805ee134f..6afb5d4cc 100644 --- a/sphinx/builders/__init__.py +++ b/sphinx/builders/__init__.py @@ -25,8 +25,8 @@ from sphinx.util.osutil import SEP, ensuredir, relative_uri, relpath from sphinx.util.parallel import ParallelTasks, SerialTasks, make_chunks, parallel_available # side effect: registers roles and directives -from sphinx import directives # noqa: F401 isort:skip -from sphinx import roles # noqa: F401 isort:skip +from sphinx import directives # NoQA: F401 isort:skip +from sphinx import roles # NoQA: F401 isort:skip if TYPE_CHECKING: from collections.abc import Iterable, Sequence diff --git a/sphinx/builders/html/__init__.py b/sphinx/builders/html/__init__.py index b65e6b914..d85539bf6 100644 --- a/sphinx/builders/html/__init__.py +++ b/sphinx/builders/html/__init__.py @@ -1338,7 +1338,7 @@ def setup(app: Sphinx) -> dict[str, Any]: app.add_config_value('html_search_scorer', '', '') app.add_config_value('html_scaled_image_link', True, 'html') app.add_config_value('html_baseurl', '', 'html') - app.add_config_value('html_codeblock_linenos_style', 'inline', 'html', # RemovedInSphinx70Warning # noqa: E501 + app.add_config_value('html_codeblock_linenos_style', 'inline', 'html', # RemovedInSphinx70Warning # NoQA: E501 ENUM('table', 'inline')) app.add_config_value('html_math_renderer', None, 'env') app.add_config_value('html4_writer', False, 'html') diff --git a/sphinx/builders/latex/__init__.py b/sphinx/builders/latex/__init__.py index 7fbc0e363..4f51bb374 100644 --- a/sphinx/builders/latex/__init__.py +++ b/sphinx/builders/latex/__init__.py @@ -9,7 +9,7 @@ from typing import TYPE_CHECKING, Any from docutils.frontend import OptionParser -import sphinx.builders.latex.nodes # noqa: F401,E501 # Workaround: import this before writer to avoid ImportError +import sphinx.builders.latex.nodes # NoQA: F401,E501 # Workaround: import this before writer to avoid ImportError from sphinx import addnodes, highlighting, package_dir from sphinx.builders import Builder from sphinx.builders.latex.constants import ADDITIONAL_SETTINGS, DEFAULT_SETTINGS, SHORTHANDOFF diff --git a/sphinx/builders/linkcheck.py b/sphinx/builders/linkcheck.py index 089bf162b..5c6876881 100644 --- a/sphinx/builders/linkcheck.py +++ b/sphinx/builders/linkcheck.py @@ -408,7 +408,7 @@ class HyperlinkAvailabilityCheckWorker(Thread): req_url = encode_uri(req_url) # Get auth info, if any - for pattern, auth_info in self.auth: # noqa: B007 (false positive) + for pattern, auth_info in self.auth: # NoQA: B007 (false positive) if pattern.match(uri): break else: diff --git a/sphinx/cmd/quickstart.py b/sphinx/cmd/quickstart.py index f56e95fb1..4de8ebaaa 100644 --- a/sphinx/cmd/quickstart.py +++ b/sphinx/cmd/quickstart.py @@ -245,9 +245,9 @@ def ask_user(d: dict[str, Any]) -> None: if 'dot' not in d: print() - print(__('Inside the root directory, two more directories will be created; "_templates"\n' # noqa: E501 - 'for custom HTML templates and "_static" for custom stylesheets and other static\n' # noqa: E501 - 'files. You can enter another prefix (such as ".") to replace the underscore.')) # noqa: E501 + print(__('Inside the root directory, two more directories will be created; "_templates"\n' # NoQA: E501 + 'for custom HTML templates and "_static" for custom stylesheets and other static\n' # NoQA: E501 + 'files. You can enter another prefix (such as ".") to replace the underscore.')) # NoQA: E501 d['dot'] = do_prompt(__('Name prefix for templates and static dir'), '_', ok) if 'project' not in d: diff --git a/sphinx/directives/other.py b/sphinx/directives/other.py index d705e0ecc..365fb2ebc 100644 --- a/sphinx/directives/other.py +++ b/sphinx/directives/other.py @@ -13,7 +13,7 @@ from docutils.parsers.rst.directives.misc import Include as BaseInclude from docutils.statemachine import StateMachine from sphinx import addnodes -from sphinx.domains.changeset import VersionChange # noqa: F401 # for compatibility +from sphinx.domains.changeset import VersionChange # NoQA: F401 # for compatibility from sphinx.domains.std import StandardDomain from sphinx.locale import _, __ from sphinx.util import docname_join, logging, url_re diff --git a/sphinx/domains/c/__init__.py b/sphinx/domains/c/__init__.py index e24402264..6ca9154d3 100644 --- a/sphinx/domains/c/__init__.py +++ b/sphinx/domains/c/__init__.py @@ -627,7 +627,7 @@ class CDomain(Domain): 'enumerator': ObjType(_('enumerator'), 'enumerator', 'identifier'), 'type': ObjType(_('type'), 'identifier', 'type'), # generated object types - 'functionParam': ObjType(_('function parameter'), 'identifier', 'var', 'member', 'data'), # noqa: E501 + 'functionParam': ObjType(_('function parameter'), 'identifier', 'var', 'member', 'data'), # NoQA: E501 } directives = { diff --git a/sphinx/domains/cpp/__init__.py b/sphinx/domains/cpp/__init__.py index 5ebab7468..542a3dd37 100644 --- a/sphinx/domains/cpp/__init__.py +++ b/sphinx/domains/cpp/__init__.py @@ -758,9 +758,9 @@ class CPPDomain(Domain): 'enum': ObjType(_('enum'), 'enum', 'identifier', 'type'), 'enumerator': ObjType(_('enumerator'), 'enumerator', 'identifier'), # generated object types - 'functionParam': ObjType(_('function parameter'), 'identifier', 'member', 'var'), # noqa: E501 + 'functionParam': ObjType(_('function parameter'), 'identifier', 'member', 'var'), # NoQA: E501 'templateParam': ObjType(_('template parameter'), - 'identifier', 'class', 'struct', 'union', 'member', 'var', 'type'), # noqa: E501 + 'identifier', 'class', 'struct', 'union', 'member', 'var', 'type'), # NoQA: E501 } directives = { diff --git a/sphinx/environment/collectors/metadata.py b/sphinx/environment/collectors/metadata.py index 0987a7390..0209fb86a 100644 --- a/sphinx/environment/collectors/metadata.py +++ b/sphinx/environment/collectors/metadata.py @@ -46,7 +46,7 @@ class MetadataCollector(EnvironmentCollector): md[field_name.astext()] = field_body.astext() elif isinstance(node, nodes.TextElement): # other children must be TextElement - # see: https://docutils.sourceforge.io/docs/ref/doctree.html#bibliographic-elements # noqa: E501 + # see: https://docutils.sourceforge.io/docs/ref/doctree.html#bibliographic-elements # NoQA: E501 md[node.__class__.__name__] = node.astext() for name, value in md.items(): diff --git a/sphinx/ext/imgmath.py b/sphinx/ext/imgmath.py index b397f0ac1..4f8d4b7a0 100644 --- a/sphinx/ext/imgmath.py +++ b/sphinx/ext/imgmath.py @@ -70,7 +70,7 @@ def read_svg_depth(filename: str) -> int | None: """Read the depth from comment at last line of SVG file """ with open(filename, encoding="utf-8") as f: - for line in f: # noqa: B007 + for line in f: # NoQA: B007 pass # Only last line is checked matched = depthsvgcomment_re.match(line) diff --git a/sphinx/ext/napoleon/docstring.py b/sphinx/ext/napoleon/docstring.py index 68d4b0538..f86b9d2c1 100644 --- a/sphinx/ext/napoleon/docstring.py +++ b/sphinx/ext/napoleon/docstring.py @@ -539,7 +539,7 @@ class GoogleDocstring: return [(' ' * n) + line for line in lines] def _is_indented(self, line: str, indent: int = 1) -> bool: - for i, s in enumerate(line): # noqa: SIM110 + for i, s in enumerate(line): # NoQA: SIM110 if i >= indent: return True elif not s.isspace(): diff --git a/sphinx/jinja2glue.py b/sphinx/jinja2glue.py index 221d1fff5..652180015 100644 --- a/sphinx/jinja2glue.py +++ b/sphinx/jinja2glue.py @@ -70,7 +70,7 @@ def _slice_index(values: list, slices: int) -> Iterator[list]: count = 0 start = offset if slices == slice_number + 1: # last column - offset = len(seq) # noqa: SIM113 + offset = len(seq) # NoQA: SIM113 else: for value in values[offset:]: count += 1 + len(value[1][1]) diff --git a/sphinx/locale/__init__.py b/sphinx/locale/__init__.py index b0d34b698..0a0ae77f6 100644 --- a/sphinx/locale/__init__.py +++ b/sphinx/locale/__init__.py @@ -200,7 +200,7 @@ def get_translation(catalog: str, namespace: str = 'general') -> Callable[[str], def gettext(message: str) -> str: if not is_translator_registered(catalog, namespace): # not initialized yet - return _TranslationProxy(catalog, namespace, message) # type: ignore[return-value] # noqa: E501 + return _TranslationProxy(catalog, namespace, message) # type: ignore[return-value] # NoQA: E501 else: translator = get_translator(catalog, namespace) return translator.gettext(message) diff --git a/sphinx/util/__init__.py b/sphinx/util/__init__.py index c627c028b..283042c02 100644 --- a/sphinx/util/__init__.py +++ b/sphinx/util/__init__.py @@ -20,8 +20,8 @@ from sphinx.util import index_entries as _index_entries from sphinx.util import logging from sphinx.util import osutil as _osutil from sphinx.util.console import strip_colors # NoQA: F401 -from sphinx.util.matching import patfilter # noqa: F401 -from sphinx.util.nodes import ( # noqa: F401 +from sphinx.util.matching import patfilter # NoQA: F401 +from sphinx.util.nodes import ( # NoQA: F401 caption_ref_re, explicit_title_re, nested_parse_with_titles, @@ -30,7 +30,7 @@ from sphinx.util.nodes import ( # noqa: F401 # import other utilities; partly for backwards compatibility, so don't # prune unused ones indiscriminately -from sphinx.util.osutil import ( # noqa: F401 +from sphinx.util.osutil import ( # NoQA: F401 SEP, copyfile, copytimes, diff --git a/sphinx/util/docutils.py b/sphinx/util/docutils.py index 165e34955..68e6d0fc7 100644 --- a/sphinx/util/docutils.py +++ b/sphinx/util/docutils.py @@ -385,7 +385,7 @@ def switch_source_input(state: State, content: StringList) -> Generator[None, No # replace it by new one state_machine = StateMachine([], None) # type: ignore[arg-type] state_machine.input_lines = content - state.memo.reporter.get_source_and_line = state_machine.get_source_and_line # type: ignore[attr-defined] # noqa: E501 + state.memo.reporter.get_source_and_line = state_machine.get_source_and_line # type: ignore[attr-defined] # NoQA: E501 yield finally: diff --git a/sphinx/util/inspect.py b/sphinx/util/inspect.py index c0166eb16..855e5d537 100644 --- a/sphinx/util/inspect.py +++ b/sphinx/util/inspect.py @@ -14,7 +14,7 @@ import typing from collections.abc import Mapping, Sequence from functools import cached_property, partial, partialmethod, singledispatchmethod from importlib import import_module -from inspect import ( # noqa: F401 +from inspect import ( # NoQA: F401 Parameter, isasyncgenfunction, isclass, diff --git a/sphinx/writers/latex.py b/sphinx/writers/latex.py index a3d694d43..1d2ed220a 100644 --- a/sphinx/writers/latex.py +++ b/sphinx/writers/latex.py @@ -2261,6 +2261,6 @@ class LaTeXTranslator(SphinxTranslator): # FIXME: Workaround to avoid circular import # refs: https://github.com/sphinx-doc/sphinx/issues/5433 -from sphinx.builders.latex.nodes import ( # noqa: E402 # isort:skip +from sphinx.builders.latex.nodes import ( # NoQA: E402 # isort:skip HYPERLINK_SUPPORT_NODES, captioned_literal_block, footnotetext, ) diff --git a/tests/roots/test-ext-imgmockconverter/mocksvgconverter.py b/tests/roots/test-ext-imgmockconverter/mocksvgconverter.py index 43368de9d..c0928605a 100644 --- a/tests/roots/test-ext-imgmockconverter/mocksvgconverter.py +++ b/tests/roots/test-ext-imgmockconverter/mocksvgconverter.py @@ -8,9 +8,9 @@ from sphinx.transforms.post_transforms.images import ImageConverter if False: # For type annotation - from typing import Any, Dict # NOQA + from typing import Any, Dict # NoQA - from sphinx.application import Sphinx # NOQA + from sphinx.application import Sphinx # NoQA class MyConverter(ImageConverter): conversion_rules = [ diff --git a/tests/test_domains/test_domain_c.py b/tests/test_domains/test_domain_c.py index fad3ac233..5839bac12 100644 --- a/tests/test_domains/test_domain_c.py +++ b/tests/test_domains/test_domain_c.py @@ -749,7 +749,7 @@ def test_domain_c_build_intersphinx(tmp_path, app, status, warning): .. c:type:: _type .. c:function:: void _functionParam(int param) -""" # noqa: F841 +""" # NoQA: F841 inv_file = tmp_path / 'inventory' inv_file.write_bytes(b'''\ # Sphinx inventory version 2 @@ -769,7 +769,7 @@ _struct c:struct 1 index.html#c.$ - _type c:type 1 index.html#c.$ - _union c:union 1 index.html#c.$ - _var c:member 1 index.html#c.$ - -''')) # noqa: W291 +''')) # NoQA: W291 app.config.intersphinx_mapping = { 'https://localhost/intersphinx/c/': str(inv_file), } diff --git a/tests/test_domains/test_domain_cpp.py b/tests/test_domains/test_domain_cpp.py index 2c5f56ce7..23a134b9d 100644 --- a/tests/test_domains/test_domain_cpp.py +++ b/tests/test_domains/test_domain_cpp.py @@ -1397,7 +1397,7 @@ def test_domain_cpp_build_intersphinx(tmp_path, app, status, warning): .. cpp:enum-class:: _enumClass .. cpp:function:: void _functionParam(int param) .. cpp:function:: template void _templateParam() -""" # noqa: F841 +""" # NoQA: F841 inv_file = tmp_path / 'inventory' inv_file.write_bytes(b'''\ # Sphinx inventory version 2 @@ -1424,7 +1424,7 @@ _templateParam::TParam cpp:templateParam 1 index.html#_CPPv4I0E14_templateParamv _type cpp:type 1 index.html#_CPPv45$ - _union cpp:union 1 index.html#_CPPv46$ - _var cpp:member 1 index.html#_CPPv44$ - -''')) # noqa: W291 +''')) # NoQA: W291 app.config.intersphinx_mapping = { 'https://localhost/intersphinx/cpp/': str(inv_file), } diff --git a/tests/test_extensions/test_ext_napoleon_docstring.py b/tests/test_extensions/test_ext_napoleon_docstring.py index a619aec91..38d6759ee 100644 --- a/tests/test_extensions/test_ext_napoleon_docstring.py +++ b/tests/test_extensions/test_ext_napoleon_docstring.py @@ -1157,7 +1157,7 @@ Methods: description -""" # noqa: W293 +""" # NoQA: W293 config = Config() actual = str(GoogleDocstring(docstring, config=config, app=None, what='module', options={'no-index': True})) diff --git a/tests/test_util/test_util_inspect.py b/tests/test_util/test_util_inspect.py index e13210292..eb83a3a54 100644 --- a/tests/test_util/test_util_inspect.py +++ b/tests/test_util/test_util_inspect.py @@ -853,7 +853,7 @@ def test_getdoc_inherited_decorated_method(): """ class Bar(Foo): - @functools.lru_cache # noqa: B019 + @functools.lru_cache # NoQA: B019 def meth(self): # inherited and decorated method pass diff --git a/tests/test_util/typing_test_data.py b/tests/test_util/typing_test_data.py index 3c615b84f..e29b60050 100644 --- a/tests/test_util/typing_test_data.py +++ b/tests/test_util/typing_test_data.py @@ -77,7 +77,7 @@ def f14() -> Any: pass -def f15(x: "Unknown", y: "int") -> Any: # noqa: F821 # type: ignore[attr-defined] +def f15(x: "Unknown", y: "int") -> Any: # NoQA: F821 # type: ignore[attr-defined] pass