mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
🔧 Narrow typing for Builder.build
method (#12357)
This commit is contained in:
parent
799ae16a01
commit
1e297bb8c5
@ -6,7 +6,7 @@ import codecs
|
|||||||
import pickle
|
import pickle
|
||||||
import time
|
import time
|
||||||
from os import path
|
from os import path
|
||||||
from typing import TYPE_CHECKING, Any
|
from typing import TYPE_CHECKING, Any, Literal
|
||||||
|
|
||||||
from docutils import nodes
|
from docutils import nodes
|
||||||
from docutils.utils import DependencyList
|
from docutils.utils import DependencyList
|
||||||
@ -298,9 +298,9 @@ class Builder:
|
|||||||
self,
|
self,
|
||||||
docnames: Iterable[str] | None,
|
docnames: Iterable[str] | None,
|
||||||
summary: str | None = None,
|
summary: str | None = None,
|
||||||
method: str = 'update',
|
method: Literal['all', 'specific', 'update'] = 'update',
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Main build method.
|
"""Main build method, usually called by a specific ``build_*`` method.
|
||||||
|
|
||||||
First updates the environment, and then calls
|
First updates the environment, and then calls
|
||||||
:meth:`!write`.
|
:meth:`!write`.
|
||||||
@ -537,7 +537,7 @@ class Builder:
|
|||||||
self,
|
self,
|
||||||
build_docnames: Iterable[str] | None,
|
build_docnames: Iterable[str] | None,
|
||||||
updated_docnames: Sequence[str],
|
updated_docnames: Sequence[str],
|
||||||
method: str = 'update',
|
method: Literal['all', 'specific', 'update'] = 'update',
|
||||||
) -> None:
|
) -> None:
|
||||||
if build_docnames is None or build_docnames == ['__all__']:
|
if build_docnames is None or build_docnames == ['__all__']:
|
||||||
# build_all
|
# build_all
|
||||||
|
@ -7,7 +7,7 @@ import time
|
|||||||
from codecs import open
|
from codecs import open
|
||||||
from collections import defaultdict
|
from collections import defaultdict
|
||||||
from os import getenv, path, walk
|
from os import getenv, path, walk
|
||||||
from typing import TYPE_CHECKING, Any
|
from typing import TYPE_CHECKING, Any, Literal
|
||||||
from uuid import uuid4
|
from uuid import uuid4
|
||||||
|
|
||||||
from docutils import nodes
|
from docutils import nodes
|
||||||
@ -261,7 +261,7 @@ class MessageCatalogBuilder(I18nBuilder):
|
|||||||
self,
|
self,
|
||||||
docnames: Iterable[str] | None,
|
docnames: Iterable[str] | None,
|
||||||
summary: str | None = None,
|
summary: str | None = None,
|
||||||
method: str = 'update',
|
method: Literal['all', 'specific', 'update'] = 'update',
|
||||||
) -> None:
|
) -> None:
|
||||||
self._extract_from_template()
|
self._extract_from_template()
|
||||||
super().build(docnames, summary, method)
|
super().build(docnames, summary, method)
|
||||||
|
Loading…
Reference in New Issue
Block a user