massive update, probably broken
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-pyright / node_modules / pyright / dist / typeshed-fallback / stubs / polib / polib.pyi
1 import textwrap
2 from typing import IO, Any, Callable, Generic, List, Text, Type, TypeVar, overload
3 from typing_extensions import SupportsIndex
4
5 _TB = TypeVar("_TB", bound="_BaseEntry")
6 _TP = TypeVar("_TP", bound="POFile")
7 _TM = TypeVar("_TM", bound="MOFile")
8
9 default_encoding: str
10
11 # wrapwidth: int
12 # encoding: str
13 # check_for_duplicates: bool
14 @overload
15 def pofile(pofile: Text, *, klass: Type[_TP], **kwargs: Any) -> _TP: ...
16 @overload
17 def pofile(pofile: Text, **kwargs: Any) -> POFile: ...
18 @overload
19 def mofile(mofile: Text, *, klass: Type[_TM], **kwargs: Any) -> _TM: ...
20 @overload
21 def mofile(mofile: Text, **kwargs: Any) -> MOFile: ...
22 def detect_encoding(file: bytes | Text, binary_mode: bool = ...) -> str: ...
23 def escape(st: Text) -> Text: ...
24 def unescape(st: Text) -> Text: ...
25
26 class _BaseFile(List[_TB]):
27     fpath: Text
28     wrapwidth: int
29     encoding: Text
30     check_for_duplicates: bool
31     header: Text
32     metadata: dict[Text, Text]
33     metadata_is_fuzzy: bool
34     def __init__(self, *args: Any, **kwargs: Any) -> None: ...
35     def __unicode__(self) -> Text: ...
36     def __contains__(self, entry: _TB) -> bool: ...  # type: ignore # AttributeError otherwise
37     def __eq__(self, other: object) -> bool: ...
38     def append(self, entry: _TB) -> None: ...
39     def insert(self, index: SupportsIndex, entry: _TB) -> None: ...
40     def metadata_as_entry(self) -> POEntry: ...
41     def save(self, fpath: Text | None = ..., repr_method: str = ...) -> None: ...
42     def find(self, st: Text, by: str = ..., include_obsolete_entries: bool = ..., msgctxt: bool = ...) -> _TB | None: ...
43     def ordered_metadata(self) -> list[tuple[Text, Text]]: ...
44     def to_binary(self) -> bytes: ...
45
46 class POFile(_BaseFile[POEntry]):
47     def __unicode__(self) -> Text: ...
48     def save_as_mofile(self, fpath: Text) -> None: ...
49     def percent_translated(self) -> int: ...
50     def translated_entries(self) -> list[POEntry]: ...
51     def untranslated_entries(self) -> list[POEntry]: ...
52     def fuzzy_entries(self) -> list[POEntry]: ...
53     def obsolete_entries(self) -> list[POEntry]: ...
54     def merge(self, refpot: POFile) -> None: ...
55
56 class MOFile(_BaseFile[MOEntry]):
57     MAGIC: int
58     MAGIC_SWAPPED: int
59     magic_number: int | None
60     version: int
61     def __init__(self, *args: Any, **kwargs: Any) -> None: ...
62     def save_as_pofile(self, fpath: str) -> None: ...
63     def save(self, fpath: Text | None = ...) -> None: ...  # type: ignore # binary file does not allow argument repr_method
64     def percent_translated(self) -> int: ...
65     def translated_entries(self) -> list[MOEntry]: ...
66     def untranslated_entries(self) -> list[MOEntry]: ...
67     def fuzzy_entries(self) -> list[MOEntry]: ...
68     def obsolete_entries(self) -> list[MOEntry]: ...
69
70 class _BaseEntry(object):
71     msgid: Text
72     msgstr: Text
73     msgid_plural: Text
74     msgstr_plural: list[Text]
75     msgctxt: Text
76     obsolete: bool
77     encoding: str
78     def __init__(self, *args: Any, **kwargs: Any) -> None: ...
79     def __unicode__(self, wrapwidth: int = ...) -> Text: ...
80     def __eq__(self, other: object) -> bool: ...
81
82 class POEntry(_BaseEntry):
83     comment: Text
84     tcomment: Text
85     occurrences: list[tuple[str, int]]
86     flags: list[Text]
87     previous_msgctxt: Text | None
88     previous_msgid: Text | None
89     previous_msgid_plural: Text | None
90     linenum: int | None
91     def __init__(self, *args: Any, **kwargs: Any) -> None: ...
92     def __unicode__(self, wrapwidth: int = ...) -> Text: ...
93     def __cmp__(self, other: POEntry) -> int: ...
94     def __gt__(self, other: POEntry) -> bool: ...
95     def __lt__(self, other: POEntry) -> bool: ...
96     def __ge__(self, other: POEntry) -> bool: ...
97     def __le__(self, other: POEntry) -> bool: ...
98     def __eq__(self, other: Any) -> bool: ...
99     def __ne__(self, other: Any) -> bool: ...
100     def translated(self) -> bool: ...
101     def merge(self, other: POEntry) -> None: ...
102     @property
103     def fuzzy(self) -> bool: ...
104     @property
105     def msgid_with_context(self) -> Text: ...
106     def __hash__(self) -> int: ...
107
108 class MOEntry(_BaseEntry):
109     comment: Text
110     tcomment: Text
111     occurrences: list[tuple[str, int]]
112     flags: list[Text]
113     previous_msgctxt: Text | None
114     previous_msgid: Text | None
115     previous_msgid_plural: Text | None
116     def __init__(self, *args: Any, **kwargs: Any) -> None: ...
117     def __hash__(self) -> int: ...
118
119 class _POFileParser(Generic[_TP]):
120     fhandle: IO[Text]
121     instance: _TP
122     transitions: dict[tuple[str, str], tuple[Callable[[], bool], str]]
123     current_line: int
124     current_entry: POEntry
125     current_state: str
126     current_token: str | None
127     msgstr_index: int
128     entry_obsolete: int
129     def __init__(self, pofile: Text, *args: Any, **kwargs: Any) -> None: ...
130     def parse(self) -> _TP: ...
131     def add(self, symbol: str, states: list[str], next_state: str) -> None: ...
132     def process(self, symbol: str) -> None: ...
133     def handle_he(self) -> bool: ...
134     def handle_tc(self) -> bool: ...
135     def handle_gc(self) -> bool: ...
136     def handle_oc(self) -> bool: ...
137     def handle_fl(self) -> bool: ...
138     def handle_pp(self) -> bool: ...
139     def handle_pm(self) -> bool: ...
140     def handle_pc(self) -> bool: ...
141     def handle_ct(self) -> bool: ...
142     def handle_mi(self) -> bool: ...
143     def handle_mp(self) -> bool: ...
144     def handle_ms(self) -> bool: ...
145     def handle_mx(self) -> bool: ...
146     def handle_mc(self) -> bool: ...
147
148 class _MOFileParser(Generic[_TM]):
149     fhandle: IO[bytes]
150     instance: _TM
151     def __init__(self, mofile: Text, *args: Any, **kwargs: Any) -> None: ...
152     def __del__(self) -> None: ...
153     def parse(self) -> _TM: ...
154
155 class TextWrapper(textwrap.TextWrapper):
156     drop_whitespace: bool
157     def __init__(self, *args: Any, **kwargs: Any) -> None: ...