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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

馃敡 Narrow typing for Builder.build method #12357

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 4 additions & 4 deletions sphinx/builders/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import pickle
import time
from os import path
from typing import TYPE_CHECKING, Any
from typing import TYPE_CHECKING, Any, Literal

from docutils import nodes
from docutils.utils import DependencyList
Expand Down Expand Up @@ -298,9 +298,9 @@ def build(
self,
docnames: Iterable[str] | None,
summary: str | None = None,
method: str = 'update',
method: Literal['all', 'specific', 'update'] = 'update',
) -> None:
"""Main build method.
"""Main build method, usually called by a specific ``build_*`` method.

First updates the environment, and then calls
:meth:`!write`.
Expand Down Expand Up @@ -536,7 +536,7 @@ def write(
self,
build_docnames: Iterable[str] | None,
updated_docnames: Sequence[str],
method: str = 'update',
method: Literal['all', 'specific', 'update'] = 'update',
) -> None:
if build_docnames is None or build_docnames == ['__all__']:
# build_all
Expand Down
4 changes: 2 additions & 2 deletions sphinx/builders/gettext.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from codecs import open
from collections import defaultdict
from os import getenv, path, walk
from typing import TYPE_CHECKING, Any
from typing import TYPE_CHECKING, Any, Literal
from uuid import uuid4

from docutils import nodes
Expand Down Expand Up @@ -261,7 +261,7 @@ def build(
self,
docnames: Iterable[str] | None,
summary: str | None = None,
method: str = 'update',
method: Literal['all', 'specific', 'update'] = 'update',
) -> None:
self._extract_from_template()
super().build(docnames, summary, method)
Expand Down