Skip to content

Commit

Permalink
glossary_v2.py: fix type and remove GlossaryExtendedType
Browse files Browse the repository at this point in the history
  • Loading branch information
ilius committed Dec 31, 2024
1 parent f2b57eb commit 19107b8
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions pyglossary/glossary_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,6 @@
from .glossary_types import (
EntryListType,
EntryType,
GlossaryExtendedType,
GlossaryType,
RawEntryType,
)
from .plugin_prop import PluginProp
Expand Down Expand Up @@ -298,7 +296,7 @@ def updateEntryFilters(self) -> None:
entryFilters = []
config = self._config

glosArg = cast("GlossaryExtendedType", self)
glosArg = self

for configParam, default, filterClass in entryFiltersRules:
args = []
Expand Down Expand Up @@ -338,8 +336,8 @@ def prepareEntryFilters(self) -> None:
def _addExtraEntryFilter(self, cls: type[EntryFilterType]) -> None:
if cls.name in self._entryFiltersName:
return
self._entryFilters.append(cls(cast("GlossaryType", self)))
self._entryFiltersExtra.append(cls(cast("GlossaryType", self)))
self._entryFilters.append(cls(self))
self._entryFiltersExtra.append(cls(self))
self._entryFiltersName.add(cls.name)

def removeHtmlTagsAll(self) -> None:
Expand All @@ -364,7 +362,7 @@ def stripFullHtml(
return
self._entryFilters.append(
StripFullHtml( # pyright: ignore[reportArgumentType]
cast("GlossaryType", self),
self,
errorHandler=errorHandler,
),
)
Expand Down Expand Up @@ -423,7 +421,7 @@ def _loadedEntryGen(self) -> Iterator[EntryType]:

filters = self._entryFiltersExtra
if self.progressbar:
filters.append(ShowProgressBar(cast("GlossaryExtendedType", self))) # pyright: ignore[reportArgumentType]
filters.append(ShowProgressBar(self)) # pyright: ignore[reportArgumentType]

self.progressInit("Writing")
for _entry in self._data:
Expand Down Expand Up @@ -894,7 +892,7 @@ def _writeEntries(
if self._config.get("save_info_json", False):
from pyglossary.info_writer import InfoWriter

infoWriter = InfoWriter(cast("GlossaryType", self))
infoWriter = InfoWriter(self)
infoWriter.setWriteOptions(options)
filenameNoExt, _, _, _ = splitFilenameExt(filename)
infoWriter.open(f"{filenameNoExt}.info")
Expand Down

0 comments on commit 19107b8

Please sign in to comment.