Skip to content

Commit

Permalink
glossary_types.py: remove GlossaryExtendedType, update `ReaderGloss…
Browse files Browse the repository at this point in the history
…aryType` and `WriterGlossaryType`
  • Loading branch information
ilius committed Dec 31, 2024
1 parent 4add7cf commit 68ae321
Showing 1 changed file with 18 additions and 117 deletions.
135 changes: 18 additions & 117 deletions pyglossary/glossary_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
"Callable",
"EntryListType",
"EntryType",
"GlossaryExtendedType",
"RawEntryType",
"ReaderGlossaryType",
"WriterGlossaryType",
Expand Down Expand Up @@ -131,122 +130,6 @@ def sort(self) -> None: ...
def close(self) -> None: ...


class GlossaryExtendedType(typing.Protocol): # noqa: PLR0904
def __iter__(self) -> Iterator[EntryType]: ...

def __len__(self) -> int: ...

def setDefaultDefiFormat(self, defiFormat: str) -> None: ...

def getDefaultDefiFormat(self) -> str: ...

def collectDefiFormat(
self,
maxCount: int,
) -> dict[str, float] | None: ...

def iterInfo(self) -> Iterator[tuple[str, str]]: ...

def getInfo(self, key: str) -> str: ...

def setInfo(self, key: str, value: str) -> None: ...

def getExtraInfos(self, excludeKeys: list[str]) -> dict[str, str]: ...

@property
def author(self) -> str: ...

@property
def alts(self) -> bool: ...

@property
def filename(self) -> str: ...

@property
def tmpDataDir(self) -> str: ...

@property
def readOptions(self) -> dict | None: ...

@property
def sqlite(self) -> bool: ...

@property
def sourceLang(self) -> Lang | None: ...

@property
def targetLang(self) -> Lang | None: ...

@property
def sourceLangName(self) -> str: ...

@sourceLangName.setter
def sourceLangName(self, langName: str) -> None: ...

@property
def targetLangName(self) -> str: ...

@targetLangName.setter
def targetLangName(self, langName: str) -> None: ...

def titleTag(self, sample: str) -> str: ...

def wordTitleStr(
self,
word: str,
sample: str = "",
class_: str = "",
) -> str: ...

def getConfig(self, name: str, default: str | None) -> str | None: ...

def addEntry(self, entry: EntryType) -> None: ...

def newEntry(
self,
word: MultiStr,
defi: str,
defiFormat: str = "",
byteProgress: tuple[int, int] | None = None,
) -> EntryType: ...

def newDataEntry(self, fname: str, data: bytes) -> EntryType: ...

def stripFullHtml(
self,
errorHandler: Callable[[EntryType, str], None] | None = None,
) -> None: ...

def preventDuplicateWords(self) -> None: ...

def mergeEntriesWithSameHeadwordPlaintext(self) -> None: ...

def removeHtmlTagsAll(self) -> None: ...

def addCleanupPath(self, path: str) -> None: ...

def progressInit(
self,
*args, # noqa: ANN002
) -> None: ...

def progress(self, pos: int, total: int, unit: str = "entries") -> None: ...

def progressEnd(self) -> None: ...

@property
def progressbar(self) -> bool: ...

@progressbar.setter
def progressbar(self, enabled: bool) -> None: ...

def directRead(
self,
filename: str,
**options,
) -> bool: ...


class GlossaryInfoCommonType(typing.Protocol):
def getInfo(self, key: str) -> str: ...

Expand Down Expand Up @@ -292,8 +175,18 @@ def setDefaultDefiFormat(self, defiFormat: str) -> None: ...

def titleTag(self, sample: str) -> str: ...

@property
def alts(self) -> bool: ...


class WriterGlossaryType(GlossaryInfoCommonType):
# def __len__(self) -> int: ...

# @property
# def filename(self) -> str: ...

def __iter__(self) -> Iterator[EntryType]: ...

def collectDefiFormat(
self,
maxCount: int,
Expand All @@ -313,6 +206,14 @@ def wordTitleStr(
@property
def tmpDataDir(self) -> str: ...

def addCleanupPath(self, path: str) -> None: ...

@property
def readOptions(self) -> dict | None: ...

@property
def sqlite(self) -> bool: ...

def stripFullHtml(
self,
errorHandler: Callable[[EntryType, str], None] | None = None,
Expand Down

0 comments on commit 68ae321

Please sign in to comment.