Skip to content

Commit

Permalink
Update MyPy for types-docutils 0.21.0.20240708 (#12522)
Browse files Browse the repository at this point in the history
  • Loading branch information
jayaddison authored Jul 9, 2024
1 parent 7eb77f2 commit c67ef51
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 9 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ lint = [
"ruff==0.5.0",
"mypy==1.10.1",
"sphinx-lint",
"types-docutils==0.21.0.20240704",
"types-docutils==0.21.0.20240708",
"types-requests",
"importlib_metadata", # for mypy (Python<=3.9)
"tomli", # for mypy (Python<=3.10)
Expand Down
2 changes: 1 addition & 1 deletion sphinx/ext/autodoc/directive.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@

if TYPE_CHECKING:
from docutils.nodes import Node
from docutils.parsers.rst.states import RSTState

from sphinx.config import Config
from sphinx.environment import BuildEnvironment
from sphinx.util.typing import _RSTState as RSTState

logger = logging.getLogger(__name__)

Expand Down
3 changes: 1 addition & 2 deletions sphinx/util/nodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,12 @@

from docutils.nodes import Element
from docutils.parsers.rst import Directive
from docutils.parsers.rst.states import Inliner
from docutils.parsers.rst.states import Inliner, RSTState
from docutils.statemachine import StringList

from sphinx.builders import Builder
from sphinx.environment import BuildEnvironment
from sphinx.util.tags import Tags
from sphinx.util.typing import _RSTState as RSTState

logger = logging.getLogger(__name__)

Expand Down
2 changes: 1 addition & 1 deletion sphinx/util/parsing.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
if TYPE_CHECKING:
from collections.abc import Iterator

from sphinx.util.typing import _RSTState as RSTState
from docutils.parsers.rst.states import RSTState


def nested_parse_to_nodes(
Expand Down
2 changes: 0 additions & 2 deletions sphinx/util/typing.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,10 @@
from collections.abc import Mapping
from typing import Final, Literal, Protocol

from docutils.parsers.rst.states import RSTState as _RSTStateGeneric
from typing_extensions import TypeAlias, TypeIs

from sphinx.application import Sphinx

_RSTState: TypeAlias = _RSTStateGeneric[list[str]]
_RestifyMode: TypeAlias = Literal[
'fully-qualified-except-typing',
'smart',
Expand Down
4 changes: 2 additions & 2 deletions tests/test_util/test_util_docutils_sphinx_directive.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ def make_directive(*, env: SimpleNamespace, input_lines: StringList | None = Non
return directive


def make_directive_and_state(*, env: SimpleNamespace, input_lines: StringList | None = None) -> tuple[RSTState[list[str]], SphinxDirective]:
def make_directive_and_state(*, env: SimpleNamespace, input_lines: StringList | None = None) -> tuple[RSTState, SphinxDirective]:
sm = RSTStateMachine(state_classes, initial_state='Body')
sm.reporter = object()
if input_lines is not None:
sm.input_lines = input_lines
state: RSTState[list[str]] = RSTState(sm)
state = RSTState(sm)
state.document = new_document('<tests>')
state.document.settings.env = env
state.document.settings.tab_width = 4
Expand Down

0 comments on commit c67ef51

Please sign in to comment.