From a9b03832078380fa82b78fca397ad00f912e7e5c Mon Sep 17 00:00:00 2001 From: Saeed Rasooli Date: Tue, 31 Dec 2024 21:35:12 +0330 Subject: [PATCH] plugins: replace Glossary type annotation with new limited types --- pyglossary/plugins/aard2_slob/reader.py | 4 ++-- pyglossary/plugins/aard2_slob/writer.py | 4 ++-- pyglossary/plugins/almaany/reader.py | 4 ++-- pyglossary/plugins/appledict/writer.py | 4 ++-- pyglossary/plugins/appledict_bin/reader.py | 6 +++--- pyglossary/plugins/ayandict_sqlite/reader.py | 4 ++-- pyglossary/plugins/ayandict_sqlite/writer.py | 4 ++-- pyglossary/plugins/babylon_bgl/bgl_reader.py | 4 ++-- pyglossary/plugins/cc_kedict/reader.py | 6 +++--- pyglossary/plugins/crawler_dir/reader.py | 4 ++-- pyglossary/plugins/crawler_dir/writer.py | 4 ++-- pyglossary/plugins/csv_plugin/reader.py | 4 ++-- pyglossary/plugins/csv_plugin/writer.py | 4 ++-- pyglossary/plugins/dicformids/reader.py | 4 ++-- pyglossary/plugins/dicformids/writer.py | 4 ++-- pyglossary/plugins/dict_cc/reader.py | 4 ++-- pyglossary/plugins/dict_cc_split/reader.py | 4 ++-- pyglossary/plugins/dict_org/reader.py | 4 ++-- pyglossary/plugins/dict_org/writer.py | 4 ++-- pyglossary/plugins/dict_org_source/writer.py | 4 ++-- pyglossary/plugins/digitalnk/reader.py | 4 ++-- pyglossary/plugins/dikt_json/writer.py | 4 ++-- pyglossary/plugins/dsl/reader.py | 4 ++-- pyglossary/plugins/ebook_epub2/writer.py | 4 ++-- pyglossary/plugins/ebook_kobo/writer.py | 4 ++-- pyglossary/plugins/ebook_kobo_dictfile/reader.py | 4 ++-- pyglossary/plugins/ebook_kobo_dictfile/writer.py | 4 ++-- pyglossary/plugins/ebook_mobi/writer.py | 4 ++-- pyglossary/plugins/edict2/reader.py | 4 ++-- pyglossary/plugins/edlin/reader.py | 4 ++-- pyglossary/plugins/edlin/writer.py | 4 ++-- pyglossary/plugins/formats_common/__init__.py | 5 +++-- pyglossary/plugins/freedict/reader.py | 4 ++-- pyglossary/plugins/gettext_po/reader.py | 4 ++-- pyglossary/plugins/gettext_po/writer.py | 4 ++-- pyglossary/plugins/html_dir/writer.py | 4 ++-- pyglossary/plugins/info_plugin/reader.py | 4 ++-- pyglossary/plugins/jmdict/reader.py | 4 ++-- pyglossary/plugins/jmnedict/reader.py | 4 ++-- pyglossary/plugins/json_plugin/writer.py | 4 ++-- pyglossary/plugins/lingoes_ldf/writer.py | 4 ++-- pyglossary/plugins/makindo_medical/reader.py | 4 ++-- pyglossary/plugins/octopus_mdict_new/reader.py | 4 ++-- pyglossary/plugins/quickdic6/reader.py | 4 ++-- pyglossary/plugins/quickdic6/writer.py | 4 ++-- pyglossary/plugins/sql/writer.py | 4 ++-- pyglossary/plugins/stardict/reader.py | 4 ++-- pyglossary/plugins/stardict/writer.py | 4 ++-- pyglossary/plugins/stardict_textual/reader.py | 4 ++-- pyglossary/plugins/stardict_textual/writer.py | 4 ++-- pyglossary/plugins/tabfile/writer.py | 4 ++-- pyglossary/plugins/testformat/reader.py | 4 ++-- pyglossary/plugins/testformat/writer.py | 4 ++-- pyglossary/plugins/wiktextract/reader.py | 4 ++-- pyglossary/plugins/wordnet/reader.py | 4 ++-- pyglossary/plugins/wordset/reader.py | 4 ++-- pyglossary/plugins/xdxf/reader.py | 4 ++-- pyglossary/plugins/xdxf_css/reader.py | 4 ++-- pyglossary/plugins/xdxf_lax/reader.py | 4 ++-- pyglossary/plugins/yomichan/writer.py | 4 ++-- pyglossary/plugins/zimfile/reader.py | 4 ++-- 61 files changed, 125 insertions(+), 124 deletions(-) diff --git a/pyglossary/plugins/aard2_slob/reader.py b/pyglossary/plugins/aard2_slob/reader.py index c80fdffb8..db0952cb9 100644 --- a/pyglossary/plugins/aard2_slob/reader.py +++ b/pyglossary/plugins/aard2_slob/reader.py @@ -8,7 +8,7 @@ from collections.abc import Iterator from pyglossary import slob - from pyglossary.glossary_types import EntryType, GlossaryType + from pyglossary.glossary_types import EntryType, ReaderGlossaryType from pyglossary.core import exc_note, log, pip from pyglossary.plugins.aard2_slob.tags import ( @@ -29,7 +29,7 @@ class Reader: "icu": "PyICU", # >=1.5 } - def __init__(self, glos: GlossaryType) -> None: + def __init__(self, glos: ReaderGlossaryType) -> None: self._glos = glos self._clear() self._re_bword = re.compile( diff --git a/pyglossary/plugins/aard2_slob/writer.py b/pyglossary/plugins/aard2_slob/writer.py index c8519f987..5ce9bc014 100644 --- a/pyglossary/plugins/aard2_slob/writer.py +++ b/pyglossary/plugins/aard2_slob/writer.py @@ -11,7 +11,7 @@ from collections.abc import Generator from pyglossary import slob - from pyglossary.glossary_types import EntryType, GlossaryType + from pyglossary.glossary_types import EntryType, WriterGlossaryType from pyglossary.core import cacheDir, exc_note, log, pip from pyglossary.plugins.aard2_slob.tags import ( @@ -65,7 +65,7 @@ class Writer: "mp4": "video/mp4", } - def __init__(self, glos: GlossaryType) -> None: + def __init__(self, glos: WriterGlossaryType) -> None: self._glos = glos self._filename = "" self._resPrefix = "" diff --git a/pyglossary/plugins/almaany/reader.py b/pyglossary/plugins/almaany/reader.py index 3447c1010..c423c4572 100644 --- a/pyglossary/plugins/almaany/reader.py +++ b/pyglossary/plugins/almaany/reader.py @@ -8,11 +8,11 @@ import sqlite3 from collections.abc import Iterator - from pyglossary.glossary_types import EntryType, GlossaryType + from pyglossary.glossary_types import EntryType, ReaderGlossaryType class Reader: - def __init__(self, glos: GlossaryType) -> None: + def __init__(self, glos: ReaderGlossaryType) -> None: self._glos = glos self._clear() diff --git a/pyglossary/plugins/appledict/writer.py b/pyglossary/plugins/appledict/writer.py index f6bdb14f0..42d6c2c50 100644 --- a/pyglossary/plugins/appledict/writer.py +++ b/pyglossary/plugins/appledict/writer.py @@ -42,7 +42,7 @@ import io from collections.abc import Generator - from pyglossary.glossary_types import EntryType, GlossaryType + from pyglossary.glossary_types import EntryType, WriterGlossaryType sys.setrecursionlimit(10000) @@ -182,7 +182,7 @@ class Writer: _jing: bool = False _indexes: str = "" # FIXME: rename to indexes_lang? - def __init__(self, glos: GlossaryType) -> None: + def __init__(self, glos: WriterGlossaryType) -> None: self._glos = glos self._dirname = "" diff --git a/pyglossary/plugins/appledict_bin/reader.py b/pyglossary/plugins/appledict_bin/reader.py index 4bcd46c16..cece08834 100644 --- a/pyglossary/plugins/appledict_bin/reader.py +++ b/pyglossary/plugins/appledict_bin/reader.py @@ -51,7 +51,7 @@ HtmlProcessingInstruction, ) - from pyglossary.glossary_types import EntryType, GlossaryType + from pyglossary.glossary_types import EntryType, ReaderGlossaryType from pyglossary.lxml_types import Element from .appledict_properties import AppleDictProperties @@ -82,8 +82,8 @@ class Reader: ".strings", } - def __init__(self, glos: GlossaryType) -> None: - self._glos: GlossaryType = glos + def __init__(self, glos: ReaderGlossaryType) -> None: + self._glos: ReaderGlossaryType = glos self._dictDirPath = "" self._contentsPath = "" self._file: io.BufferedIOBase = nullBinaryIO diff --git a/pyglossary/plugins/ayandict_sqlite/reader.py b/pyglossary/plugins/ayandict_sqlite/reader.py index b1ed0b6eb..5b6bdbd65 100644 --- a/pyglossary/plugins/ayandict_sqlite/reader.py +++ b/pyglossary/plugins/ayandict_sqlite/reader.py @@ -9,11 +9,11 @@ import sqlite3 from collections.abc import Iterator - from pyglossary.glossary_types import EntryType, GlossaryType + from pyglossary.glossary_types import EntryType, ReaderGlossaryType class Reader: - def __init__(self, glos: GlossaryType) -> None: + def __init__(self, glos: ReaderGlossaryType) -> None: self._glos = glos self._clear() diff --git a/pyglossary/plugins/ayandict_sqlite/writer.py b/pyglossary/plugins/ayandict_sqlite/writer.py index 810631c71..4cb2a288e 100644 --- a/pyglossary/plugins/ayandict_sqlite/writer.py +++ b/pyglossary/plugins/ayandict_sqlite/writer.py @@ -9,7 +9,7 @@ import sqlite3 from collections.abc import Generator - from pyglossary.glossary_types import EntryType, GlossaryType + from pyglossary.glossary_types import EntryType, WriterGlossaryType from pyglossary.xdxf.transform import XdxfTransformer from pyglossary.core import log @@ -18,7 +18,7 @@ class Writer: _fuzzy: int = True - def __init__(self, glos: GlossaryType) -> None: + def __init__(self, glos: WriterGlossaryType) -> None: self._glos = glos self._clear() diff --git a/pyglossary/plugins/babylon_bgl/bgl_reader.py b/pyglossary/plugins/babylon_bgl/bgl_reader.py index faea1ffa5..d15a267d2 100644 --- a/pyglossary/plugins/babylon_bgl/bgl_reader.py +++ b/pyglossary/plugins/babylon_bgl/bgl_reader.py @@ -63,7 +63,7 @@ if TYPE_CHECKING: from collections.abc import Iterator - from pyglossary.glossary_types import EntryType, GlossaryType + from pyglossary.glossary_types import EntryType, ReaderGlossaryType __all__ = ["BGLGzipFile", "BglReader", "Block", "FileOffS", "optionsProp", "tmpDir"] @@ -342,7 +342,7 @@ class BglReader: selected encoding, so the user may fix the encoding if needed. """ - def __init__(self, glos: GlossaryType) -> None: # no more arguments + def __init__(self, glos: ReaderGlossaryType) -> None: # no more arguments self._glos = glos self._filename = "" self.info = {} diff --git a/pyglossary/plugins/cc_kedict/reader.py b/pyglossary/plugins/cc_kedict/reader.py index 1a9efcb4f..dd3212064 100644 --- a/pyglossary/plugins/cc_kedict/reader.py +++ b/pyglossary/plugins/cc_kedict/reader.py @@ -11,7 +11,7 @@ import lxml - from pyglossary.glossary_types import EntryType, GlossaryType + from pyglossary.glossary_types import EntryType, ReaderGlossaryType from pyglossary.core import exc_note, log, pip from pyglossary.text_reader import TextGlossaryReader @@ -29,7 +29,7 @@ class YamlReader(TextGlossaryReader): def __init__( # noqa: PLR0913 self, - glos: GlossaryType, + glos: ReaderGlossaryType, spellKey: str = "", posKey: str = "", synsKey: str = "", @@ -272,7 +272,7 @@ class Reader: "lxml": "lxml", } - def __init__(self, glos: GlossaryType) -> None: + def __init__(self, glos: ReaderGlossaryType) -> None: self._glos = glos self._yaml = YamlReader( glos, diff --git a/pyglossary/plugins/crawler_dir/reader.py b/pyglossary/plugins/crawler_dir/reader.py index 9bb6b0369..bfee7d2c6 100644 --- a/pyglossary/plugins/crawler_dir/reader.py +++ b/pyglossary/plugins/crawler_dir/reader.py @@ -16,11 +16,11 @@ if TYPE_CHECKING: from collections.abc import Generator, Iterator - from pyglossary.glossary_types import EntryType, GlossaryType + from pyglossary.glossary_types import EntryType, ReaderGlossaryType class Reader: - def __init__(self, glos: GlossaryType) -> None: + def __init__(self, glos: ReaderGlossaryType) -> None: self._glos = glos self._filename = None self._wordCount = 0 diff --git a/pyglossary/plugins/crawler_dir/writer.py b/pyglossary/plugins/crawler_dir/writer.py index 6171a341e..5210b5bc4 100644 --- a/pyglossary/plugins/crawler_dir/writer.py +++ b/pyglossary/plugins/crawler_dir/writer.py @@ -15,13 +15,13 @@ ) if TYPE_CHECKING: - from pyglossary.glossary_types import GlossaryType + from pyglossary.glossary_types import WriterGlossaryType class Writer: _compression: str = "" - def __init__(self, glos: GlossaryType) -> None: + def __init__(self, glos: WriterGlossaryType) -> None: self._glos = glos self._filename = None diff --git a/pyglossary/plugins/csv_plugin/reader.py b/pyglossary/plugins/csv_plugin/reader.py index 8087e9e92..a06e55104 100644 --- a/pyglossary/plugins/csv_plugin/reader.py +++ b/pyglossary/plugins/csv_plugin/reader.py @@ -35,7 +35,7 @@ import io from collections.abc import Iterable, Iterator - from pyglossary.glossary_types import EntryType, GlossaryType + from pyglossary.glossary_types import EntryType, ReaderGlossaryType class Reader: @@ -45,7 +45,7 @@ class Reader: _newline: str = "\n" _delimiter: str = "," - def __init__(self, glos: GlossaryType) -> None: + def __init__(self, glos: ReaderGlossaryType) -> None: self._glos = glos self.clear() diff --git a/pyglossary/plugins/csv_plugin/writer.py b/pyglossary/plugins/csv_plugin/writer.py index ff1c42920..e9b3f7f29 100644 --- a/pyglossary/plugins/csv_plugin/writer.py +++ b/pyglossary/plugins/csv_plugin/writer.py @@ -34,7 +34,7 @@ import io from collections.abc import Generator - from pyglossary.glossary_types import EntryType, GlossaryType + from pyglossary.glossary_types import EntryType, WriterGlossaryType class Writer: @@ -48,7 +48,7 @@ class Writer: _enable_info: bool = True _word_title: bool = False - def __init__(self, glos: GlossaryType) -> None: + def __init__(self, glos: WriterGlossaryType) -> None: self._glos = glos self._file: io.TextIOBase = nullTextIO diff --git a/pyglossary/plugins/dicformids/reader.py b/pyglossary/plugins/dicformids/reader.py index 9ae2bd1a8..f05a6a441 100644 --- a/pyglossary/plugins/dicformids/reader.py +++ b/pyglossary/plugins/dicformids/reader.py @@ -13,13 +13,13 @@ if TYPE_CHECKING: from collections.abc import Iterator - from pyglossary.glossary_types import EntryType, GlossaryType + from pyglossary.glossary_types import EntryType, ReaderGlossaryType class Reader: re_number = re.compile(r"\d+") - def __init__(self, glos: GlossaryType) -> None: + def __init__(self, glos: ReaderGlossaryType) -> None: self._glos = glos self._tabFileNames: list[str] = [] self._tabFileReader = None diff --git a/pyglossary/plugins/dicformids/writer.py b/pyglossary/plugins/dicformids/writer.py index 44dc07ebd..338906bda 100644 --- a/pyglossary/plugins/dicformids/writer.py +++ b/pyglossary/plugins/dicformids/writer.py @@ -12,7 +12,7 @@ if TYPE_CHECKING: from collections.abc import Generator - from pyglossary.glossary_types import EntryType, GlossaryType + from pyglossary.glossary_types import EntryType, WriterGlossaryType PROP_TEMPLATE = """#DictionaryForMIDs property file @@ -49,7 +49,7 @@ class Writer: - def __init__(self, glos: GlossaryType) -> None: + def __init__(self, glos: WriterGlossaryType) -> None: self._glos = glos self.linesPerDirectoryFile = 500 # 200 self.indexFileMaxSize = 32722 # 30000 diff --git a/pyglossary/plugins/dict_cc/reader.py b/pyglossary/plugins/dict_cc/reader.py index e6615604a..927a310e1 100644 --- a/pyglossary/plugins/dict_cc/reader.py +++ b/pyglossary/plugins/dict_cc/reader.py @@ -9,7 +9,7 @@ import sqlite3 from collections.abc import Callable, Iterator - from pyglossary.glossary_types import EntryType, GlossaryType + from pyglossary.glossary_types import EntryType, ReaderGlossaryType from pyglossary.lxml_types import Element, T_htmlfile @@ -17,7 +17,7 @@ class Reader: - def __init__(self, glos: GlossaryType) -> None: + def __init__(self, glos: ReaderGlossaryType) -> None: self._glos = glos self._clear() diff --git a/pyglossary/plugins/dict_cc_split/reader.py b/pyglossary/plugins/dict_cc_split/reader.py index 1e5205f28..a1acbe6b7 100644 --- a/pyglossary/plugins/dict_cc_split/reader.py +++ b/pyglossary/plugins/dict_cc_split/reader.py @@ -8,13 +8,13 @@ import sqlite3 from collections.abc import Iterator - from pyglossary.glossary_types import EntryType, GlossaryType + from pyglossary.glossary_types import EntryType, ReaderGlossaryType from pyglossary.core import log class Reader: - def __init__(self, glos: GlossaryType) -> None: + def __init__(self, glos: ReaderGlossaryType) -> None: self._glos = glos self._clear() diff --git a/pyglossary/plugins/dict_org/reader.py b/pyglossary/plugins/dict_org/reader.py index 71a47fc13..dd502dcbb 100644 --- a/pyglossary/plugins/dict_org/reader.py +++ b/pyglossary/plugins/dict_org/reader.py @@ -11,11 +11,11 @@ if TYPE_CHECKING: from collections.abc import Iterator - from pyglossary.glossary_types import EntryType, GlossaryType + from pyglossary.glossary_types import EntryType, ReaderGlossaryType class Reader: - def __init__(self, glos: GlossaryType) -> None: + def __init__(self, glos: ReaderGlossaryType) -> None: self._glos = glos self._filename = "" self._dictdb: DictDB | None = None diff --git a/pyglossary/plugins/dict_org/writer.py b/pyglossary/plugins/dict_org/writer.py index 5cc2762e7..dfdb38db7 100644 --- a/pyglossary/plugins/dict_org/writer.py +++ b/pyglossary/plugins/dict_org/writer.py @@ -11,7 +11,7 @@ if TYPE_CHECKING: from collections.abc import Generator - from pyglossary.glossary_types import EntryType, GlossaryType + from pyglossary.glossary_types import EntryType, WriterGlossaryType def installToDictd(filename: str, dictzip: bool) -> None: @@ -56,7 +56,7 @@ class Writer: _dictzip: bool = False _install: bool = True - def __init__(self, glos: GlossaryType) -> None: + def __init__(self, glos: WriterGlossaryType) -> None: self._glos = glos self._filename = "" self._dictdb: DictDB | None = None diff --git a/pyglossary/plugins/dict_org_source/writer.py b/pyglossary/plugins/dict_org_source/writer.py index 1548f5975..447955540 100644 --- a/pyglossary/plugins/dict_org_source/writer.py +++ b/pyglossary/plugins/dict_org_source/writer.py @@ -6,13 +6,13 @@ if TYPE_CHECKING: from collections.abc import Generator - from pyglossary.glossary_types import EntryType, GlossaryType + from pyglossary.glossary_types import EntryType, WriterGlossaryType class Writer: _remove_html_all: bool = True - def __init__(self, glos: GlossaryType) -> None: + def __init__(self, glos: WriterGlossaryType) -> None: self._glos = glos self._filename = "" diff --git a/pyglossary/plugins/digitalnk/reader.py b/pyglossary/plugins/digitalnk/reader.py index 5eb2ba373..c0cab20d9 100644 --- a/pyglossary/plugins/digitalnk/reader.py +++ b/pyglossary/plugins/digitalnk/reader.py @@ -8,11 +8,11 @@ import sqlite3 from collections.abc import Iterator - from pyglossary.glossary_types import EntryType, GlossaryType + from pyglossary.glossary_types import EntryType, ReaderGlossaryType class Reader: - def __init__(self, glos: GlossaryType) -> None: + def __init__(self, glos: ReaderGlossaryType) -> None: self._glos = glos self._clear() diff --git a/pyglossary/plugins/dikt_json/writer.py b/pyglossary/plugins/dikt_json/writer.py index e7827ae4b..5c027eee4 100644 --- a/pyglossary/plugins/dikt_json/writer.py +++ b/pyglossary/plugins/dikt_json/writer.py @@ -15,7 +15,7 @@ if TYPE_CHECKING: from collections.abc import Generator - from pyglossary.glossary_types import EntryType, GlossaryType + from pyglossary.glossary_types import EntryType, WriterGlossaryType class Writer: @@ -26,7 +26,7 @@ class Writer: compressions = stdCompressions - def __init__(self, glos: GlossaryType) -> None: + def __init__(self, glos: WriterGlossaryType) -> None: self._glos = glos self._filename = None glos.preventDuplicateWords() diff --git a/pyglossary/plugins/dsl/reader.py b/pyglossary/plugins/dsl/reader.py index 558d73e6e..3cce9b708 100644 --- a/pyglossary/plugins/dsl/reader.py +++ b/pyglossary/plugins/dsl/reader.py @@ -42,7 +42,7 @@ import io from collections.abc import Iterator - from pyglossary.glossary_types import EntryType, GlossaryType + from pyglossary.glossary_types import EntryType, ReaderGlossaryType htmlEntityPattern = re.compile(r"&#?\w+;") @@ -92,7 +92,7 @@ class Reader: _example_color: str = "steelblue" _abbrev: str = "hover" - def __init__(self, glos: GlossaryType) -> None: + def __init__(self, glos: ReaderGlossaryType) -> None: self._glos = glos self._filename = "" self._dirPath = "" diff --git a/pyglossary/plugins/ebook_epub2/writer.py b/pyglossary/plugins/ebook_epub2/writer.py index eba888c33..e143e5919 100644 --- a/pyglossary/plugins/ebook_epub2/writer.py +++ b/pyglossary/plugins/ebook_epub2/writer.py @@ -24,7 +24,7 @@ from pyglossary.ebook_base import EbookWriter if TYPE_CHECKING: - from pyglossary.glossary_types import GlossaryType + from pyglossary.glossary_types import WriterGlossaryType class Writer(EbookWriter): @@ -160,7 +160,7 @@ class Writer(EbookWriter): COVER_TEMPLATE = '' - def __init__(self, glos: GlossaryType) -> None: + def __init__(self, glos: WriterGlossaryType) -> None: import uuid EbookWriter.__init__( diff --git a/pyglossary/plugins/ebook_kobo/writer.py b/pyglossary/plugins/ebook_kobo/writer.py index 5b26aff01..d9edc2417 100644 --- a/pyglossary/plugins/ebook_kobo/writer.py +++ b/pyglossary/plugins/ebook_kobo/writer.py @@ -34,7 +34,7 @@ if TYPE_CHECKING: from collections.abc import Generator - from pyglossary.glossary_types import EntryType, GlossaryType + from pyglossary.glossary_types import EntryType, WriterGlossaryType def is_cyrillic_char(c: str) -> bool: @@ -75,7 +75,7 @@ class Writer: def stripFullHtmlError(entry: EntryType, error: str) -> None: log.error(f"error in stripFullHtml: {error}, words={entry.l_word!r}") - def __init__(self, glos: GlossaryType) -> None: + def __init__(self, glos: WriterGlossaryType) -> None: self._glos = glos self._filename = "" self._words: list[str] = [] diff --git a/pyglossary/plugins/ebook_kobo_dictfile/reader.py b/pyglossary/plugins/ebook_kobo_dictfile/reader.py index 131ab6190..6efba514f 100644 --- a/pyglossary/plugins/ebook_kobo_dictfile/reader.py +++ b/pyglossary/plugins/ebook_kobo_dictfile/reader.py @@ -25,7 +25,7 @@ from pyglossary.text_reader import TextGlossaryReader if TYPE_CHECKING: - from pyglossary.glossary_types import GlossaryType + from pyglossary.glossary_types import ReaderGlossaryType class Reader(TextGlossaryReader): @@ -35,7 +35,7 @@ class Reader(TextGlossaryReader): _extract_inline_images: bool = True - def __init__(self, glos: GlossaryType) -> None: + def __init__(self, glos: ReaderGlossaryType) -> None: TextGlossaryReader.__init__(self, glos, hasInfo=False) def open(self, filename: str) -> None: diff --git a/pyglossary/plugins/ebook_kobo_dictfile/writer.py b/pyglossary/plugins/ebook_kobo_dictfile/writer.py index 60c9c9651..6d0a12514 100644 --- a/pyglossary/plugins/ebook_kobo_dictfile/writer.py +++ b/pyglossary/plugins/ebook_kobo_dictfile/writer.py @@ -29,7 +29,7 @@ import io from collections.abc import Generator - from pyglossary.glossary_types import EntryType, GlossaryType + from pyglossary.glossary_types import EntryType, WriterGlossaryType def fixWord(word: str) -> str: @@ -47,7 +47,7 @@ class Writer: def stripFullHtmlError(entry: EntryType, error: str) -> None: log.error(f"error in stripFullHtml: {error}, words={entry.l_word!r}") - def __init__(self, glos: GlossaryType) -> None: + def __init__(self, glos: WriterGlossaryType) -> None: self._glos = glos self._file: io.TextIOBase = nullTextIO glos.stripFullHtml(errorHandler=self.stripFullHtmlError) diff --git a/pyglossary/plugins/ebook_mobi/writer.py b/pyglossary/plugins/ebook_mobi/writer.py index 36484ff8e..d5b5d1832 100644 --- a/pyglossary/plugins/ebook_mobi/writer.py +++ b/pyglossary/plugins/ebook_mobi/writer.py @@ -31,7 +31,7 @@ if TYPE_CHECKING: from collections.abc import Generator - from pyglossary.glossary_types import EntryType, GlossaryType + from pyglossary.glossary_types import EntryType, WriterGlossaryType class GroupStateBySize: @@ -139,7 +139,7 @@ class Writer(EbookWriter): """ - def __init__(self, glos: GlossaryType) -> None: + def __init__(self, glos: WriterGlossaryType) -> None: import uuid EbookWriter.__init__( diff --git a/pyglossary/plugins/edict2/reader.py b/pyglossary/plugins/edict2/reader.py index 378cc0251..685d1e2e3 100644 --- a/pyglossary/plugins/edict2/reader.py +++ b/pyglossary/plugins/edict2/reader.py @@ -11,7 +11,7 @@ import io from collections.abc import Iterator - from pyglossary.glossary_types import EntryType, GlossaryType + from pyglossary.glossary_types import EntryType, ReaderGlossaryType class Reader: @@ -23,7 +23,7 @@ class Reader: _traditional_title: bool = False _colorize_tones: bool = True - def __init__(self, glos: GlossaryType) -> None: + def __init__(self, glos: ReaderGlossaryType) -> None: self._glos = glos self.file: io.TextIOBase = nullTextIO self._fileSize = 0 diff --git a/pyglossary/plugins/edlin/reader.py b/pyglossary/plugins/edlin/reader.py index 8fcdf4007..26dc7d54c 100644 --- a/pyglossary/plugins/edlin/reader.py +++ b/pyglossary/plugins/edlin/reader.py @@ -15,13 +15,13 @@ if TYPE_CHECKING: from collections.abc import Iterator - from pyglossary.glossary_types import EntryType, GlossaryType + from pyglossary.glossary_types import EntryType, ReaderGlossaryType class Reader: _encoding: str = "utf-8" - def __init__(self, glos: GlossaryType) -> None: + def __init__(self, glos: ReaderGlossaryType) -> None: self._glos = glos self._clear() diff --git a/pyglossary/plugins/edlin/writer.py b/pyglossary/plugins/edlin/writer.py index 10b77b85a..25d0928f2 100644 --- a/pyglossary/plugins/edlin/writer.py +++ b/pyglossary/plugins/edlin/writer.py @@ -13,7 +13,7 @@ if TYPE_CHECKING: from collections.abc import Generator - from pyglossary.glossary_types import EntryType, GlossaryType + from pyglossary.glossary_types import EntryType, WriterGlossaryType def makeDir(direc: str) -> None: @@ -25,7 +25,7 @@ class Writer: _encoding: str = "utf-8" _prev_link: bool = True - def __init__(self, glos: GlossaryType) -> None: + def __init__(self, glos: WriterGlossaryType) -> None: self._glos = glos self._clear() diff --git a/pyglossary/plugins/formats_common/__init__.py b/pyglossary/plugins/formats_common/__init__.py index 1bba7b1f6..629ac1c99 100644 --- a/pyglossary/plugins/formats_common/__init__.py +++ b/pyglossary/plugins/formats_common/__init__.py @@ -31,7 +31,7 @@ NEVER, YesNoAlwaysNever, ) -from pyglossary.glossary_types import EntryType, GlossaryType +from pyglossary.glossary_types import EntryType, ReaderGlossaryType, WriterGlossaryType from pyglossary.option import ( BoolOption, DictOption, @@ -77,12 +77,13 @@ "EntryType", "FileSizeOption", "FloatOption", - "GlossaryType", "HtmlColorOption", "IntOption", "ListOption", "NewlineOption", + "ReaderGlossaryType", "StrOption", + "WriterGlossaryType", "YesNoAlwaysNever", "cacheDir", "compressionOpen", diff --git a/pyglossary/plugins/freedict/reader.py b/pyglossary/plugins/freedict/reader.py index 3d148c9b7..3dd0806df 100644 --- a/pyglossary/plugins/freedict/reader.py +++ b/pyglossary/plugins/freedict/reader.py @@ -10,7 +10,7 @@ if TYPE_CHECKING: from collections.abc import Iterator - from pyglossary.glossary_types import EntryType, GlossaryType + from pyglossary.glossary_types import EntryType, ReaderGlossaryType from pyglossary.lxml_types import Element, T_htmlfile @@ -783,7 +783,7 @@ def setMetadata(self, header: Element) -> None: self.setCreationTime(header) self.setDescription(header) - def __init__(self, glos: GlossaryType) -> None: + def __init__(self, glos: ReaderGlossaryType) -> None: self._glos = glos self._filename = "" self._dirname = "" diff --git a/pyglossary/plugins/gettext_po/reader.py b/pyglossary/plugins/gettext_po/reader.py index 126288488..713a3d585 100644 --- a/pyglossary/plugins/gettext_po/reader.py +++ b/pyglossary/plugins/gettext_po/reader.py @@ -14,7 +14,7 @@ import io from collections.abc import Iterator - from pyglossary.glossary_types import EntryType, GlossaryType + from pyglossary.glossary_types import EntryType, ReaderGlossaryType class Reader: @@ -22,7 +22,7 @@ class Reader: "polib": "polib", } - def __init__(self, glos: GlossaryType) -> None: + def __init__(self, glos: ReaderGlossaryType) -> None: self._glos = glos self._alts = glos.alts self.clear() diff --git a/pyglossary/plugins/gettext_po/writer.py b/pyglossary/plugins/gettext_po/writer.py index 685a447ee..8483cb49b 100644 --- a/pyglossary/plugins/gettext_po/writer.py +++ b/pyglossary/plugins/gettext_po/writer.py @@ -11,7 +11,7 @@ import io from collections.abc import Generator - from pyglossary.glossary_types import EntryType, GlossaryType + from pyglossary.glossary_types import EntryType, WriterGlossaryType class Writer: @@ -21,7 +21,7 @@ class Writer: _resources: bool = True - def __init__(self, glos: GlossaryType) -> None: + def __init__(self, glos: WriterGlossaryType) -> None: self._glos = glos self._filename = "" self._file: io.TextIOBase = nullTextIO diff --git a/pyglossary/plugins/html_dir/writer.py b/pyglossary/plugins/html_dir/writer.py index 6451f09ce..a186513bb 100644 --- a/pyglossary/plugins/html_dir/writer.py +++ b/pyglossary/plugins/html_dir/writer.py @@ -15,7 +15,7 @@ from pyglossary.glossary_types import ( EntryType, - GlossaryType, + WriterGlossaryType, ) from pyglossary.core import log @@ -59,7 +59,7 @@ class Writer: def stripFullHtmlError(entry: EntryType, error: str) -> None: log.error(f"error in stripFullHtml: {error}, words={entry.l_word!r}") - def __init__(self, glos: GlossaryType) -> None: + def __init__(self, glos: WriterGlossaryType) -> None: self._glos = glos self._filename = "" self._fileObj: io.IOBase | None = None diff --git a/pyglossary/plugins/info_plugin/reader.py b/pyglossary/plugins/info_plugin/reader.py index f8c212230..24112fc96 100644 --- a/pyglossary/plugins/info_plugin/reader.py +++ b/pyglossary/plugins/info_plugin/reader.py @@ -9,12 +9,12 @@ from pyglossary.glossary_types import ( EntryType, - GlossaryType, + ReaderGlossaryType, ) class Reader: - def __init__(self, glos: GlossaryType) -> None: + def __init__(self, glos: ReaderGlossaryType) -> None: self._glos = glos def close(self) -> None: diff --git a/pyglossary/plugins/jmdict/reader.py b/pyglossary/plugins/jmdict/reader.py index 16de72ffc..e5e901937 100644 --- a/pyglossary/plugins/jmdict/reader.py +++ b/pyglossary/plugins/jmdict/reader.py @@ -13,7 +13,7 @@ from pyglossary.glossary_types import ( EntryType, - GlossaryType, + ReaderGlossaryType, ) from pyglossary.lxml_types import Element, T_htmlfile @@ -350,7 +350,7 @@ def setMetadata(self, header: str) -> None: # TODO: self.set_info("edition", ...) self.setCreationTime(header) - def __init__(self, glos: GlossaryType) -> None: + def __init__(self, glos: ReaderGlossaryType) -> None: self._glos = glos self._wordCount = 0 self._filename = "" diff --git a/pyglossary/plugins/jmnedict/reader.py b/pyglossary/plugins/jmnedict/reader.py index 8d25b8ce1..c01ae0228 100644 --- a/pyglossary/plugins/jmnedict/reader.py +++ b/pyglossary/plugins/jmnedict/reader.py @@ -12,7 +12,7 @@ from pyglossary.glossary_types import ( EntryType, - GlossaryType, + ReaderGlossaryType, ) from pyglossary.lxml_types import Element, T_htmlfile @@ -231,7 +231,7 @@ def setMetadata(self, header: str) -> None: # TODO: self.set_info("edition", ...) self.setCreationTime(header) - def __init__(self, glos: GlossaryType) -> None: + def __init__(self, glos: ReaderGlossaryType) -> None: self._glos = glos self._wordCount = 0 self._filename = "" diff --git a/pyglossary/plugins/json_plugin/writer.py b/pyglossary/plugins/json_plugin/writer.py index f43b88a7e..b10505417 100644 --- a/pyglossary/plugins/json_plugin/writer.py +++ b/pyglossary/plugins/json_plugin/writer.py @@ -14,7 +14,7 @@ from pyglossary.glossary_types import ( EntryType, - GlossaryType, + WriterGlossaryType, ) @@ -26,7 +26,7 @@ class Writer: compressions = stdCompressions - def __init__(self, glos: GlossaryType) -> None: + def __init__(self, glos: WriterGlossaryType) -> None: self._glos = glos self._filename = "" glos.preventDuplicateWords() diff --git a/pyglossary/plugins/lingoes_ldf/writer.py b/pyglossary/plugins/lingoes_ldf/writer.py index 93004246f..fb4b6d5e9 100644 --- a/pyglossary/plugins/lingoes_ldf/writer.py +++ b/pyglossary/plugins/lingoes_ldf/writer.py @@ -11,7 +11,7 @@ if TYPE_CHECKING: from collections.abc import Generator - from pyglossary.glossary_types import EntryType, GlossaryType + from pyglossary.glossary_types import EntryType, WriterGlossaryType class Writer: @@ -20,7 +20,7 @@ class Writer: _newline: str = "\n" _resources: bool = True - def __init__(self, glos: GlossaryType) -> None: + def __init__(self, glos: WriterGlossaryType) -> None: self._glos = glos self._filename = "" diff --git a/pyglossary/plugins/makindo_medical/reader.py b/pyglossary/plugins/makindo_medical/reader.py index 14bb29cd2..f42be20f3 100644 --- a/pyglossary/plugins/makindo_medical/reader.py +++ b/pyglossary/plugins/makindo_medical/reader.py @@ -8,11 +8,11 @@ import sqlite3 from collections.abc import Iterator - from pyglossary.glossary_types import EntryType, GlossaryType + from pyglossary.glossary_types import EntryType, ReaderGlossaryType class Reader: - def __init__(self, glos: GlossaryType) -> None: + def __init__(self, glos: ReaderGlossaryType) -> None: self._glos = glos self._clear() diff --git a/pyglossary/plugins/octopus_mdict_new/reader.py b/pyglossary/plugins/octopus_mdict_new/reader.py index f154200dc..7807c2418 100644 --- a/pyglossary/plugins/octopus_mdict_new/reader.py +++ b/pyglossary/plugins/octopus_mdict_new/reader.py @@ -27,7 +27,7 @@ if TYPE_CHECKING: from collections.abc import Iterator - from pyglossary.glossary_types import EntryType, GlossaryType + from pyglossary.glossary_types import EntryType, ReaderGlossaryType from pyglossary.plugin_lib.readmdict import MDD, MDX @@ -41,7 +41,7 @@ class Reader: _same_dir_data_files: bool = False _audio: bool = False - def __init__(self, glos: GlossaryType) -> None: + def __init__(self, glos: ReaderGlossaryType) -> None: self._glos = glos self.clear() self._re_internal_link = re.compile("href=([\"'])(entry://|[dx]:)") diff --git a/pyglossary/plugins/quickdic6/reader.py b/pyglossary/plugins/quickdic6/reader.py index cbd932b41..d92cb8e6f 100644 --- a/pyglossary/plugins/quickdic6/reader.py +++ b/pyglossary/plugins/quickdic6/reader.py @@ -8,7 +8,7 @@ from typing import IO, TYPE_CHECKING if TYPE_CHECKING: - from pyglossary.glossary_types import EntryType, GlossaryType + from pyglossary.glossary_types import EntryType, ReaderGlossaryType from .commons import EntryIndexTuple @@ -35,7 +35,7 @@ class Reader: "icu": "PyICU", } - def __init__(self, glos: GlossaryType) -> None: + def __init__(self, glos: ReaderGlossaryType) -> None: self._glos = glos self._dic: QuickDic | None = None diff --git a/pyglossary/plugins/quickdic6/writer.py b/pyglossary/plugins/quickdic6/writer.py index 7fbb47b18..aea660043 100644 --- a/pyglossary/plugins/quickdic6/writer.py +++ b/pyglossary/plugins/quickdic6/writer.py @@ -7,7 +7,7 @@ from typing import TYPE_CHECKING if TYPE_CHECKING: - from pyglossary.glossary_types import EntryType, GlossaryType + from pyglossary.glossary_types import EntryType, WriterGlossaryType from pyglossary.core import log @@ -41,7 +41,7 @@ class Writer: _normalizer_rules = "" - def __init__(self, glos: GlossaryType) -> None: + def __init__(self, glos: WriterGlossaryType) -> None: self._glos = glos self._filename = "" self._dic = None diff --git a/pyglossary/plugins/sql/writer.py b/pyglossary/plugins/sql/writer.py index 64350fc5a..b1ea75d11 100644 --- a/pyglossary/plugins/sql/writer.py +++ b/pyglossary/plugins/sql/writer.py @@ -7,7 +7,7 @@ import io from collections.abc import Generator - from pyglossary.glossary_types import EntryType, GlossaryType + from pyglossary.glossary_types import EntryType, WriterGlossaryType class Writer: @@ -17,7 +17,7 @@ class Writer: _newline: str = "
" _transaction: bool = False - def __init__(self, glos: GlossaryType) -> None: + def __init__(self, glos: WriterGlossaryType) -> None: self._glos = glos self._filename = "" self._file: io.IOBase | None = None diff --git a/pyglossary/plugins/stardict/reader.py b/pyglossary/plugins/stardict/reader.py index 2a9f21190..6c34abd31 100644 --- a/pyglossary/plugins/stardict/reader.py +++ b/pyglossary/plugins/stardict/reader.py @@ -20,7 +20,7 @@ import io from collections.abc import Iterator - from pyglossary.glossary_types import EntryType, GlossaryType + from pyglossary.glossary_types import EntryType, ReaderGlossaryType from pyglossary.core import log @@ -50,7 +50,7 @@ class Reader: _xsl: bool = False _unicode_errors: str = "strict" - def __init__(self, glos: GlossaryType) -> None: + def __init__(self, glos: ReaderGlossaryType) -> None: self._glos = glos self.clear() diff --git a/pyglossary/plugins/stardict/writer.py b/pyglossary/plugins/stardict/writer.py index acd9a9b19..7fe14cbd2 100644 --- a/pyglossary/plugins/stardict/writer.py +++ b/pyglossary/plugins/stardict/writer.py @@ -21,7 +21,7 @@ if TYPE_CHECKING: from collections.abc import Callable, Generator - from pyglossary.glossary_types import EntryType, GlossaryType + from pyglossary.glossary_types import EntryType, WriterGlossaryType from pyglossary.langs import Lang from pyglossary.plugins.stardict.sd_types import T_SdList @@ -67,7 +67,7 @@ class Writer: dictzipSynFile = True - def __init__(self, glos: GlossaryType) -> None: + def __init__(self, glos: WriterGlossaryType) -> None: self._glos = glos self._filename = "" self._resDir = "" diff --git a/pyglossary/plugins/stardict_textual/reader.py b/pyglossary/plugins/stardict_textual/reader.py index 91fea26c8..885c530da 100644 --- a/pyglossary/plugins/stardict_textual/reader.py +++ b/pyglossary/plugins/stardict_textual/reader.py @@ -7,7 +7,7 @@ import io from collections.abc import Iterator - from pyglossary.glossary_types import EntryType, GlossaryType + from pyglossary.glossary_types import EntryType, ReaderGlossaryType from pyglossary.lxml_types import Element from pyglossary.xdxf.transform import XdxfTransformer @@ -30,7 +30,7 @@ class Reader: "lxml": "lxml", } - def __init__(self, glos: GlossaryType) -> None: + def __init__(self, glos: ReaderGlossaryType) -> None: self._glos = glos self._filename = "" self._file: io.IOBase = nullBinaryIO diff --git a/pyglossary/plugins/stardict_textual/writer.py b/pyglossary/plugins/stardict_textual/writer.py index c7681d839..04153b22f 100644 --- a/pyglossary/plugins/stardict_textual/writer.py +++ b/pyglossary/plugins/stardict_textual/writer.py @@ -10,7 +10,7 @@ from lxml import builder - from pyglossary.glossary_types import EntryType, GlossaryType + from pyglossary.glossary_types import EntryType, WriterGlossaryType from pyglossary.compression import ( @@ -27,7 +27,7 @@ class Writer: "lxml": "lxml", } - def __init__(self, glos: GlossaryType) -> None: + def __init__(self, glos: WriterGlossaryType) -> None: self._glos = glos self._filename = "" self._resDir = "" diff --git a/pyglossary/plugins/tabfile/writer.py b/pyglossary/plugins/tabfile/writer.py index cbdf42fe8..a0612bd4e 100644 --- a/pyglossary/plugins/tabfile/writer.py +++ b/pyglossary/plugins/tabfile/writer.py @@ -9,7 +9,7 @@ if TYPE_CHECKING: from collections.abc import Generator - from pyglossary.glossary_types import EntryType, GlossaryType + from pyglossary.glossary_types import EntryType, WriterGlossaryType class Writer: @@ -21,7 +21,7 @@ class Writer: compressions = stdCompressions - def __init__(self, glos: GlossaryType) -> None: + def __init__(self, glos: WriterGlossaryType) -> None: self._glos = glos self._filename = "" diff --git a/pyglossary/plugins/testformat/reader.py b/pyglossary/plugins/testformat/reader.py index 7f59bcff3..d76967c79 100644 --- a/pyglossary/plugins/testformat/reader.py +++ b/pyglossary/plugins/testformat/reader.py @@ -5,11 +5,11 @@ # -*- coding: utf-8 -*- from collections.abc import Iterator -from pyglossary.glossary_types import EntryType, GlossaryType +from pyglossary.glossary_types import EntryType, ReaderGlossaryType class Reader: - def __init__(self, glos: GlossaryType) -> None: + def __init__(self, glos: ReaderGlossaryType) -> None: self._glos = glos self._filename = "" self._wordCount = 0 diff --git a/pyglossary/plugins/testformat/writer.py b/pyglossary/plugins/testformat/writer.py index 48f18b227..e6ac51918 100644 --- a/pyglossary/plugins/testformat/writer.py +++ b/pyglossary/plugins/testformat/writer.py @@ -5,11 +5,11 @@ # -*- coding: utf-8 -*- from collections.abc import Generator -from pyglossary.glossary_types import EntryType, GlossaryType +from pyglossary.glossary_types import EntryType, WriterGlossaryType class Writer: - def __init__(self, glos: GlossaryType) -> None: + def __init__(self, glos: WriterGlossaryType) -> None: self._glos = glos self._filename = "" diff --git a/pyglossary/plugins/wiktextract/reader.py b/pyglossary/plugins/wiktextract/reader.py index a029edd19..22dd2a7b7 100644 --- a/pyglossary/plugins/wiktextract/reader.py +++ b/pyglossary/plugins/wiktextract/reader.py @@ -11,7 +11,7 @@ from collections.abc import Callable, Iterator from typing import Any - from pyglossary.glossary_types import EntryType, GlossaryType + from pyglossary.glossary_types import EntryType, ReaderGlossaryType from pyglossary.lxml_types import Element, T_htmlfile @@ -51,7 +51,7 @@ class Reader: # 0.5ex ~= 0.3em, but "ex" is recommended ) - def __init__(self, glos: GlossaryType) -> None: + def __init__(self, glos: ReaderGlossaryType) -> None: self._glos = glos self._filename = "" self._file: IOBase = nullBinaryIO diff --git a/pyglossary/plugins/wordnet/reader.py b/pyglossary/plugins/wordnet/reader.py index 434cafe2f..424a1417a 100644 --- a/pyglossary/plugins/wordnet/reader.py +++ b/pyglossary/plugins/wordnet/reader.py @@ -27,7 +27,7 @@ import io from collections.abc import Iterator - from pyglossary.glossary_types import EntryType, GlossaryType + from pyglossary.glossary_types import EntryType, ReaderGlossaryType # original expression from # http://stackoverflow.com/questions/694344/regular-expression-that-matches-between-quotes-containing-escaped-quotes @@ -303,7 +303,7 @@ def process(self) -> Iterator[tuple[str, str]]: class Reader: - def __init__(self, glos: GlossaryType) -> None: + def __init__(self, glos: ReaderGlossaryType) -> None: self._glos = glos self._filename = "" self._wordCount = 0 diff --git a/pyglossary/plugins/wordset/reader.py b/pyglossary/plugins/wordset/reader.py index 4c19b8b42..d6c67fd1d 100644 --- a/pyglossary/plugins/wordset/reader.py +++ b/pyglossary/plugins/wordset/reader.py @@ -12,13 +12,13 @@ from collections.abc import Iterator from typing import Any - from pyglossary.glossary_types import EntryType, GlossaryType + from pyglossary.glossary_types import EntryType, ReaderGlossaryType class Reader: _encoding: str = "utf-8" - def __init__(self, glos: GlossaryType) -> None: + def __init__(self, glos: ReaderGlossaryType) -> None: self._glos = glos self._clear() self.defiTemplate = ( diff --git a/pyglossary/plugins/xdxf/reader.py b/pyglossary/plugins/xdxf/reader.py index 194d26d73..cf9e10c86 100644 --- a/pyglossary/plugins/xdxf/reader.py +++ b/pyglossary/plugins/xdxf/reader.py @@ -29,7 +29,7 @@ import io from collections.abc import Iterator, Sequence - from pyglossary.glossary_types import EntryType, GlossaryType + from pyglossary.glossary_types import EntryType, ReaderGlossaryType from pyglossary.lxml_types import Element from lxml import etree as ET @@ -62,7 +62,7 @@ class Reader: "full_title": "name", } - def __init__(self, glos: GlossaryType) -> None: + def __init__(self, glos: ReaderGlossaryType) -> None: self._glos = glos self._filename = "" self._file: io.IOBase = nullBinaryIO diff --git a/pyglossary/plugins/xdxf_css/reader.py b/pyglossary/plugins/xdxf_css/reader.py index 1a1f0a076..756410f13 100644 --- a/pyglossary/plugins/xdxf_css/reader.py +++ b/pyglossary/plugins/xdxf_css/reader.py @@ -31,7 +31,7 @@ import io from collections.abc import Iterator, Sequence - from pyglossary.glossary_types import EntryType, GlossaryType + from pyglossary.glossary_types import EntryType, ReaderGlossaryType from pyglossary.lxml_types import Element @@ -64,7 +64,7 @@ class Reader: "full_title": "name", } - def __init__(self, glos: GlossaryType) -> None: + def __init__(self, glos: ReaderGlossaryType) -> None: self._glos = glos self._filename = "" self._file: io.IOBase = nullBinaryIO diff --git a/pyglossary/plugins/xdxf_lax/reader.py b/pyglossary/plugins/xdxf_lax/reader.py index 806787246..4e437b408 100644 --- a/pyglossary/plugins/xdxf_lax/reader.py +++ b/pyglossary/plugins/xdxf_lax/reader.py @@ -33,7 +33,7 @@ from lxml.html import HtmlElement as Element - from pyglossary.glossary_types import EntryType, GlossaryType + from pyglossary.glossary_types import EntryType, ReaderGlossaryType from pyglossary.compression import ( compressionOpen, @@ -65,7 +65,7 @@ class Reader: "full_title": "name", } - def __init__(self, glos: GlossaryType) -> None: + def __init__(self, glos: ReaderGlossaryType) -> None: self._glos = glos self._filename = "" self._file: io.IOBase = nullBinaryIO diff --git a/pyglossary/plugins/yomichan/writer.py b/pyglossary/plugins/yomichan/writer.py index 94b6a2a31..f98643390 100644 --- a/pyglossary/plugins/yomichan/writer.py +++ b/pyglossary/plugins/yomichan/writer.py @@ -10,7 +10,7 @@ if TYPE_CHECKING: from collections.abc import Generator, Sequence - from pyglossary.glossary_types import EntryType, GlossaryType + from pyglossary.glossary_types import EntryType, WriterGlossaryType def _isKana(char: str) -> bool: @@ -72,7 +72,7 @@ class Writer: _rule_vk_defi_pattern = "" _rule_adji_defi_pattern = "" - def __init__(self, glos: GlossaryType) -> None: + def __init__(self, glos: WriterGlossaryType) -> None: self._glos = glos self._filename = "" # Yomichan technically supports "structured content" that renders to diff --git a/pyglossary/plugins/zimfile/reader.py b/pyglossary/plugins/zimfile/reader.py index 3ed362f03..2b3d38b9d 100644 --- a/pyglossary/plugins/zimfile/reader.py +++ b/pyglossary/plugins/zimfile/reader.py @@ -10,7 +10,7 @@ from libzim.reader import Archive # type: ignore - from pyglossary.glossary_types import EntryType, GlossaryType + from pyglossary.glossary_types import EntryType, ReaderGlossaryType from pyglossary.core import cacheDir, exc_note, log, pip @@ -40,7 +40,7 @@ class Reader: "application/font-woff", } - def __init__(self, glos: GlossaryType) -> None: + def __init__(self, glos: ReaderGlossaryType) -> None: self._glos = glos self._filename = "" self._zimfile: Archive | None = None