Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update MyPy for types-docutils 0.21.0.20240708 #12522

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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