Skip to content

Commit

Permalink
Fix ruff lints + more useful comment
Browse files Browse the repository at this point in the history
  • Loading branch information
n-peugnet committed Apr 7, 2024
1 parent 66b14d3 commit 5994ca5
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 6 deletions.
4 changes: 2 additions & 2 deletions sphinx/io.py
Expand Up @@ -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
Expand Down
4 changes: 1 addition & 3 deletions sphinx/parsers.py
Expand Up @@ -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:
Expand All @@ -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]
Expand Down
1 change: 0 additions & 1 deletion sphinx/transforms/i18n.py
Expand Up @@ -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
Expand Down

0 comments on commit 5994ca5

Please sign in to comment.