diff --git a/stubs/polib/METADATA.toml b/stubs/polib/METADATA.toml index c0a0050d4..c9f594bd7 100644 --- a/stubs/polib/METADATA.toml +++ b/stubs/polib/METADATA.toml @@ -1,2 +1 @@ version = "1.1.*" -python2 = true diff --git a/stubs/polib/polib.pyi b/stubs/polib/polib.pyi index 932b8282a..034db5849 100644 --- a/stubs/polib/polib.pyi +++ b/stubs/polib/polib.pyi @@ -1,5 +1,6 @@ import textwrap -from typing import IO, Any, Callable, Generic, Text, TypeVar, overload +from collections.abc import Callable +from typing import IO, Any, Generic, TypeVar, overload from typing_extensions import SupportsIndex _TB = TypeVar("_TB", bound=_BaseEntry) @@ -12,40 +13,40 @@ default_encoding: str # encoding: str # check_for_duplicates: bool @overload -def pofile(pofile: Text, *, klass: type[_TP], **kwargs: Any) -> _TP: ... +def pofile(pofile: str, *, klass: type[_TP], **kwargs: Any) -> _TP: ... @overload -def pofile(pofile: Text, **kwargs: Any) -> POFile: ... +def pofile(pofile: str, **kwargs: Any) -> POFile: ... @overload -def mofile(mofile: Text, *, klass: type[_TM], **kwargs: Any) -> _TM: ... +def mofile(mofile: str, *, klass: type[_TM], **kwargs: Any) -> _TM: ... @overload -def mofile(mofile: Text, **kwargs: Any) -> MOFile: ... -def detect_encoding(file: bytes | Text, binary_mode: bool = ...) -> str: ... -def escape(st: Text) -> Text: ... -def unescape(st: Text) -> Text: ... +def mofile(mofile: str, **kwargs: Any) -> MOFile: ... +def detect_encoding(file: bytes | str, binary_mode: bool = ...) -> str: ... +def escape(st: str) -> str: ... +def unescape(st: str) -> str: ... class _BaseFile(list[_TB]): - fpath: Text + fpath: str wrapwidth: int - encoding: Text + encoding: str check_for_duplicates: bool - header: Text - metadata: dict[Text, Text] + header: str + metadata: dict[str, str] metadata_is_fuzzy: bool def __init__(self, *args: Any, **kwargs: Any) -> None: ... - def __unicode__(self) -> Text: ... + def __unicode__(self) -> str: ... def __contains__(self, entry: _TB) -> bool: ... # type: ignore[override] # AttributeError otherwise def __eq__(self, other: object) -> bool: ... def append(self, entry: _TB) -> None: ... def insert(self, index: SupportsIndex, entry: _TB) -> None: ... def metadata_as_entry(self) -> POEntry: ... - def save(self, fpath: Text | None = ..., repr_method: str = ...) -> None: ... - def find(self, st: Text, by: str = ..., include_obsolete_entries: bool = ..., msgctxt: bool = ...) -> _TB | None: ... - def ordered_metadata(self) -> list[tuple[Text, Text]]: ... + def save(self, fpath: str | None = ..., repr_method: str = ...) -> None: ... + def find(self, st: str, by: str = ..., include_obsolete_entries: bool = ..., msgctxt: bool = ...) -> _TB | None: ... + def ordered_metadata(self) -> list[tuple[str, str]]: ... def to_binary(self) -> bytes: ... class POFile(_BaseFile[POEntry]): - def __unicode__(self) -> Text: ... - def save_as_mofile(self, fpath: Text) -> None: ... + def __unicode__(self) -> str: ... + def save_as_mofile(self, fpath: str) -> None: ... def percent_translated(self) -> int: ... def translated_entries(self) -> list[POEntry]: ... def untranslated_entries(self) -> list[POEntry]: ... @@ -60,36 +61,36 @@ class MOFile(_BaseFile[MOEntry]): version: int def __init__(self, *args: Any, **kwargs: Any) -> None: ... def save_as_pofile(self, fpath: str) -> None: ... - def save(self, fpath: Text | None = ...) -> None: ... # type: ignore[override] # binary file does not allow argument repr_method + def save(self, fpath: str | None = ...) -> None: ... # type: ignore[override] # binary file does not allow argument repr_method def percent_translated(self) -> int: ... def translated_entries(self) -> list[MOEntry]: ... def untranslated_entries(self) -> list[MOEntry]: ... def fuzzy_entries(self) -> list[MOEntry]: ... def obsolete_entries(self) -> list[MOEntry]: ... -class _BaseEntry(object): - msgid: Text - msgstr: Text - msgid_plural: Text - msgstr_plural: list[Text] - msgctxt: Text +class _BaseEntry: + msgid: str + msgstr: str + msgid_plural: str + msgstr_plural: list[str] + msgctxt: str obsolete: bool encoding: str def __init__(self, *args: Any, **kwargs: Any) -> None: ... - def __unicode__(self, wrapwidth: int = ...) -> Text: ... + def __unicode__(self, wrapwidth: int = ...) -> str: ... def __eq__(self, other: object) -> bool: ... class POEntry(_BaseEntry): - comment: Text - tcomment: Text + comment: str + tcomment: str occurrences: list[tuple[str, int]] - flags: list[Text] - previous_msgctxt: Text | None - previous_msgid: Text | None - previous_msgid_plural: Text | None + flags: list[str] + previous_msgctxt: str | None + previous_msgid: str | None + previous_msgid_plural: str | None linenum: int | None def __init__(self, *args: Any, **kwargs: Any) -> None: ... - def __unicode__(self, wrapwidth: int = ...) -> Text: ... + def __unicode__(self, wrapwidth: int = ...) -> str: ... def __cmp__(self, other: POEntry) -> int: ... def __gt__(self, other: POEntry) -> bool: ... def __lt__(self, other: POEntry) -> bool: ... @@ -102,22 +103,22 @@ class POEntry(_BaseEntry): @property def fuzzy(self) -> bool: ... @property - def msgid_with_context(self) -> Text: ... + def msgid_with_context(self) -> str: ... def __hash__(self) -> int: ... class MOEntry(_BaseEntry): - comment: Text - tcomment: Text + comment: str + tcomment: str occurrences: list[tuple[str, int]] - flags: list[Text] - previous_msgctxt: Text | None - previous_msgid: Text | None - previous_msgid_plural: Text | None + flags: list[str] + previous_msgctxt: str | None + previous_msgid: str | None + previous_msgid_plural: str | None def __init__(self, *args: Any, **kwargs: Any) -> None: ... def __hash__(self) -> int: ... class _POFileParser(Generic[_TP]): - fhandle: IO[Text] + fhandle: IO[str] instance: _TP transitions: dict[tuple[str, str], tuple[Callable[[], bool], str]] current_line: int @@ -126,7 +127,7 @@ class _POFileParser(Generic[_TP]): current_token: str | None msgstr_index: int entry_obsolete: int - def __init__(self, pofile: Text, *args: Any, **kwargs: Any) -> None: ... + def __init__(self, pofile: str, *args: Any, **kwargs: Any) -> None: ... def parse(self) -> _TP: ... def add(self, symbol: str, states: list[str], next_state: str) -> None: ... def process(self, symbol: str) -> None: ... @@ -148,7 +149,7 @@ class _POFileParser(Generic[_TP]): class _MOFileParser(Generic[_TM]): fhandle: IO[bytes] instance: _TM - def __init__(self, mofile: Text, *args: Any, **kwargs: Any) -> None: ... + def __init__(self, mofile: str, *args: Any, **kwargs: Any) -> None: ... def __del__(self) -> None: ... def parse(self) -> _TM: ...