コード例 #1
0
ファイル: anki2.py プロジェクト: random-healer/anki-card-x
 def _uniquifyNote(self, note):
     origGuid = note[GUID]
     srcMid = note[MID]
     dstMid = self._mid(srcMid)
     # duplicate schemas?
     if srcMid == dstMid:
         return origGuid not in self._notes
     # differing schemas and note doesn't exist?
     note[MID] = dstMid
     if origGuid not in self._notes:
         return True
     # as the schemas differ and we already have a note with a different
     # note type, this note needs a new guid
     if not self.dupeOnSchemaChange:
         self._ignoredGuids[origGuid] = True
         return False
     while True:
         note[GUID] = incGuid(note[GUID])
         self._changedGuids[origGuid] = note[GUID]
         # if we don't have an existing guid, we can add
         if note[GUID] not in self._notes:
             return True
         # if the existing guid shares the same mid, we can reuse
         if dstMid == self._notes[note[GUID]][MID]:
             return False
コード例 #2
0
ファイル: anki2.py プロジェクト: Stvad/anki
 def _uniquifyNote(self, note):
     origGuid = note[GUID]
     srcMid = note[MID]
     dstMid = self._mid(srcMid)
     # duplicate schemas?
     if srcMid == dstMid:
         return origGuid not in self._notes
     # differing schemas and note doesn't exist?
     note[MID] = dstMid
     if origGuid not in self._notes:
         return True
     # as the schemas differ and we already have a note with a different
     # note type, this note needs a new guid
     if not self.dupeOnSchemaChange:
         self._ignoredGuids[origGuid] = True
         return False
     while True:
         note[GUID] = incGuid(note[GUID])
         self._changedGuids[origGuid] = note[GUID]
         # if we don't have an existing guid, we can add
         if note[GUID] not in self._notes:
             return True
         # if the existing guid shares the same mid, we can reuse
         if dstMid == self._notes[note[GUID]][MID]:
             return False