Anki/pylib/anki/importing/__init__.py
David Culley 63afb0f8c6
Update type annotation syntax (#3283)
* chore: add myself to CONTRIBUTORS file

* refactor: use newer type hints for Union/Optional

* refactor: fix deprecated type annotations

use collections.abc rather than typing

* refactor: use lower letter type annotations

* style: reformat with black

* refactor: remove unused imports

* refactor: add missing imports for type hints

* fixup! refactor: use newer type hints for Union/Optional

* fix: add missing imports for type annotations

* fixup! refactor: use newer type hints for Union/Optional

* fixup! style: reformat with black

* refactor: fix remaining imports re: type hints
2024-07-21 14:00:52 +07:00

31 lines
1.2 KiB
Python

# Copyright: Ankitects Pty Ltd and contributors
# License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
from collections.abc import Sequence
from typing import Any, Callable, Type, Union
import anki
from anki.collection import Collection
from anki.importing.anki2 import Anki2Importer
from anki.importing.apkg import AnkiPackageImporter
from anki.importing.base import Importer
from anki.importing.csvfile import TextImporter
from anki.importing.mnemo import MnemosyneImporter
from anki.importing.pauker import PaukerImporter
from anki.importing.supermemo_xml import SupermemoXmlImporter # type: ignore
from anki.lang import TR
def importers(col: Collection) -> Sequence[tuple[str, type[Importer]]]:
importers = [
(col.tr.importing_text_separated_by_tabs_or_semicolons(), TextImporter),
(
col.tr.importing_packaged_anki_deckcollection_apkg_colpkg_zip(),
AnkiPackageImporter,
),
(col.tr.importing_mnemosyne_20_deck_db(), MnemosyneImporter),
(col.tr.importing_supermemo_xml_export_xml(), SupermemoXmlImporter),
(col.tr.importing_pauker_18_lesson_paugz(), PaukerImporter),
]
anki.hooks.importing_importers(importers)
return importers