diff --git a/sphinx/io.py b/sphinx/io.py index 067aa917fab..4fdcca09a04 100644 --- a/sphinx/io.py +++ b/sphinx/io.py @@ -143,8 +143,8 @@ def setup(self, app: Sphinx) -> None: if transform in self.transforms: self.transforms.remove(transform) - def parse(self): - """Parse `self.input` into a document tree.""" + def parse(self) -> None: + """Override the BaseReader parse method to call self.parser.parse_inline().""" self.document = document = self.new_document() self.parser.parse_inline(self.input, document) document.current_source = document.current_line = None diff --git a/sphinx/parsers.py b/sphinx/parsers.py index 6c6d82b2910..09ee7e8ff28 100644 --- a/sphinx/parsers.py +++ b/sphinx/parsers.py @@ -66,7 +66,6 @@ def get_transforms(self) -> list[type[Transform]]: def parse_inline(self, inputstring: str, document: nodes.document) -> None: """Parse inline syntax from text and generate a document tree.""" - # Avoid "Literal block expected; none found." warnings. has_literal = inputstring.endswith('::') if has_literal: @@ -86,10 +85,9 @@ def parse_inline(self, inputstring: str, document: nodes.document) -> None: self.finish_parse() if has_literal: p = document[0] - assert(isinstance(p, nodes.paragraph)) + assert isinstance(p, nodes.paragraph) p += nodes.Text(':') - def parse(self, inputstring: str | StringList, document: nodes.document) -> None: """Parse text and generate a document tree.""" self.setup_parse(inputstring, document) # type: ignore[arg-type] diff --git a/sphinx/transforms/i18n.py b/sphinx/transforms/i18n.py index 70dda14cfff..1c0cf809b40 100644 --- a/sphinx/transforms/i18n.py +++ b/sphinx/transforms/i18n.py @@ -5,7 +5,6 @@ import contextlib from os import path from re import DOTALL, match -from textwrap import indent from typing import TYPE_CHECKING, Any, TypeVar from docutils import nodes