mirror of
https://github.com/ankitects/anki.git
synced 2025-09-18 14:02:21 -04:00

This adds Python 3.9 and 3.10 typing syntax to files that import attributions from __future___. Python 3.9 should be able to cope with the 3.10 syntax, but Python 3.8 will no longer work. On Windows/Mac, install the latest Python 3.9 version from python.org. There are currently no orjson wheels for Python 3.10 on Windows/Mac, which will break the build unless you have Rust installed separately. On Linux, modern distros should have Python 3.9 available already. If you're on an older distro, you'll need to build Python from source first.
27 lines
1.1 KiB
Python
27 lines
1.1 KiB
Python
# Copyright: Ankitects Pty Ltd and contributors
|
|
# License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
|
|
|
from typing import Any, Callable, Sequence, Type, Union
|
|
|
|
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]]]:
|
|
return (
|
|
(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),
|
|
)
|