|
26 | 26 | "GlossaryExtendedType", |
27 | 27 | "GlossaryType", |
28 | 28 | "RawEntryType", |
| 29 | + "ReaderGlossaryType", |
| 30 | + "WriterGlossaryType", |
29 | 31 | ] |
30 | 32 |
|
31 | 33 | MultiStr: TypeAlias = "str | list[str]" |
@@ -249,3 +251,81 @@ def progressbar(self) -> bool: ... |
249 | 251 |
|
250 | 252 | @progressbar.setter |
251 | 253 | def progressbar(self, enabled: bool) -> None: ... |
| 254 | + |
| 255 | + |
| 256 | +class GlossaryInfoCommonType(typing.Protocol): |
| 257 | + def getInfo(self, key: str) -> str: ... |
| 258 | + |
| 259 | + def setInfo(self, key: str, value: str) -> None: ... |
| 260 | + |
| 261 | + @property |
| 262 | + def sourceLang(self) -> Lang | None: ... |
| 263 | + |
| 264 | + @property |
| 265 | + def targetLang(self) -> Lang | None: ... |
| 266 | + |
| 267 | + @property |
| 268 | + def sourceLangName(self) -> str: ... |
| 269 | + |
| 270 | + @sourceLangName.setter |
| 271 | + def sourceLangName(self, langName: str) -> None: ... |
| 272 | + |
| 273 | + @property |
| 274 | + def targetLangName(self) -> str: ... |
| 275 | + |
| 276 | + @targetLangName.setter |
| 277 | + def targetLangName(self, langName: str) -> None: ... |
| 278 | + |
| 279 | + @property |
| 280 | + def author(self) -> str: ... |
| 281 | + |
| 282 | + |
| 283 | +class ReaderGlossaryType(GlossaryInfoCommonType): |
| 284 | + def newEntry( |
| 285 | + self, |
| 286 | + word: MultiStr, |
| 287 | + defi: str, |
| 288 | + defiFormat: str = "", |
| 289 | + byteProgress: tuple[int, int] | None = None, |
| 290 | + ) -> EntryType: ... |
| 291 | + |
| 292 | + def newDataEntry(self, fname: str, data: bytes) -> EntryType: ... |
| 293 | + |
| 294 | + @property |
| 295 | + def progressbar(self) -> bool: ... |
| 296 | + |
| 297 | + def setDefaultDefiFormat(self, defiFormat: str) -> None: ... |
| 298 | + |
| 299 | + def titleTag(self, sample: str) -> str: ... |
| 300 | + |
| 301 | + |
| 302 | +class WriterGlossaryType(GlossaryInfoCommonType): |
| 303 | + def collectDefiFormat( |
| 304 | + self, |
| 305 | + maxCount: int, |
| 306 | + ) -> dict[str, float] | None: ... |
| 307 | + |
| 308 | + def iterInfo(self) -> Iterator[tuple[str, str]]: ... |
| 309 | + |
| 310 | + def getExtraInfos(self, excludeKeys: list[str]) -> dict[str, str]: ... |
| 311 | + |
| 312 | + def wordTitleStr( |
| 313 | + self, |
| 314 | + word: str, |
| 315 | + sample: str = "", |
| 316 | + class_: str = "", |
| 317 | + ) -> str: ... |
| 318 | + |
| 319 | + @property |
| 320 | + def tmpDataDir(self) -> str: ... |
| 321 | + |
| 322 | + def stripFullHtml( |
| 323 | + self, |
| 324 | + errorHandler: Callable[[EntryType, str], None] | None = None, |
| 325 | + ) -> None: ... |
| 326 | + |
| 327 | + def preventDuplicateWords(self) -> None: ... |
| 328 | + |
| 329 | + def mergeEntriesWithSameHeadwordPlaintext(self) -> None: ... |
| 330 | + |
| 331 | + def removeHtmlTagsAll(self) -> None: ... |
0 commit comments