Anki/anki/importing/base.py
Damien Elmes 6ecfff56c5 add pytype inferred types to anki/
I've corrected some obvious issues, and we can fix others over time.
Mypy tests are currently broken, as adding the type hints has increased
mypy's testing surface.
2019-12-20 11:07:08 +10:00

37 lines
1,003 B
Python

# -*- coding: utf-8 -*-
# Copyright: Ankitects Pty Ltd and contributors
# License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
from anki.utils import maxID
from typing import Any
# Base importer
##########################################################################
class Importer:
needMapper = False
needDelimiter = False
def __init__(self, col, file) -> None:
self.file = file
self.log = []
self.col = col
self.total = 0
self.dst = None
def run(self) -> None:
pass
# Timestamps
######################################################################
# It's too inefficient to check for existing ids on every object,
# and a previous import may have created timestamps in the future, so we
# need to make sure our starting point is safe.
def _prepareTS(self) -> None:
self._ts = maxID(self.dst.db)
def ts(self) -> Any:
self._ts += 1
return self._ts