From 119b204ed18ca3cf4892a95aabab6b3027151ab8 Mon Sep 17 00:00:00 2001 From: Peter Bierma Date: Sat, 10 Aug 2024 07:33:50 +0000 Subject: [PATCH] Fix type hint for `msgctxt` parameter in `polib` (#12506) --- stubs/polib/polib.pyi | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/stubs/polib/polib.pyi b/stubs/polib/polib.pyi index 6a8251125..0788fe8ca 100644 --- a/stubs/polib/polib.pyi +++ b/stubs/polib/polib.pyi @@ -1,5 +1,5 @@ from collections.abc import Callable -from typing import IO, Any, Generic, SupportsIndex, TypeVar, overload +from typing import IO, Any, Generic, Literal, SupportsIndex, TypeVar, overload _TB = TypeVar("_TB", bound=_BaseEntry) _TP = TypeVar("_TP", bound=POFile) @@ -38,7 +38,9 @@ class _BaseFile(list[_TB]): def insert(self, index: SupportsIndex, entry: _TB) -> None: ... def metadata_as_entry(self) -> POEntry: ... def save(self, fpath: str | None = ..., repr_method: str = ..., newline: str | None = ...) -> None: ... - def find(self, st: str, by: str = ..., include_obsolete_entries: bool = ..., msgctxt: bool = ...) -> _TB | None: ... + def find( + self, st: str, by: str = ..., include_obsolete_entries: bool = ..., msgctxt: str | Literal[False] = ... + ) -> _TB | None: ... def ordered_metadata(self) -> list[tuple[str, str]]: ... def to_binary(self) -> bytes: ...