🔧 Narrow typing for Builder.build method (#12357)

This commit is contained in:
Chris Sewell 2024-06-17 12:44:04 +02:00 committed by GitHub
parent 799ae16a01
commit 1e297bb8c5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 6 additions and 6 deletions

View File

@ -6,7 +6,7 @@ import codecs
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
@ -298,9 +298,9 @@ class Builder:
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`.
@ -537,7 +537,7 @@ class Builder:
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

View File

@ -7,7 +7,7 @@ import time
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
@ -261,7 +261,7 @@ class MessageCatalogBuilder(I18nBuilder):
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)