Skip to content

Commit

Permalink
Use more precise type for gettext.find (#6980)
Browse files Browse the repository at this point in the history
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
  • Loading branch information
sobolevn and AlexWaygood committed Jan 20, 2022
1 parent 61495d8 commit 7dd3555
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions stdlib/gettext.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down

0 comments on commit 7dd3555

Please sign in to comment.