Use more precise type for gettext.find (#6980)

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
This commit is contained in:
Nikita Sobolev
2022-01-20 19:43:18 +03:00
committed by GitHub
parent 61495d80aa
commit 7dd35556c4

View File

@@ -27,6 +27,15 @@ class GNUTranslations(NullTranslations):
CONTEXT: str
VERSIONS: Sequence[int]
@overload # ignores incompatible overloads
def find( # type: ignore[misc]
domain: str, localedir: StrPath | None = ..., languages: Iterable[str] | None = ..., all: Literal[False] = ...
) -> str | None: ...
@overload
def find(
domain: str, localedir: StrPath | None = ..., languages: Iterable[str] | None = ..., all: Literal[True] = ...
) -> list[str]: ...
@overload
def find(domain: str, localedir: StrPath | None = ..., languages: Iterable[str] | None = ..., all: bool = ...) -> Any: ...
_T = TypeVar("_T")