From c837143d315e67f8dbf580ff08509c45418b2af0 Mon Sep 17 00:00:00 2001 From: Arthur Milchior Date: Sun, 5 Apr 2020 11:32:51 +0200 Subject: [PATCH] Remove useless recursion in DeckManager.rem For any deck the children of it's children are its children. So applying rem to children of children is useless and actually slightly costly for deep subdecks --- pylib/anki/decks.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pylib/anki/decks.py b/pylib/anki/decks.py index 105752e13..ae33da771 100644 --- a/pylib/anki/decks.py +++ b/pylib/anki/decks.py @@ -150,13 +150,13 @@ class DeckManager: self.col.sched.emptyDyn(did) if childrenToo: for name, id in self.children(did): - self.rem(id, cardsToo) + self.rem(id, cardsToo, childrenToo=False) else: # delete children first if childrenToo: # we don't want to delete children when syncing for name, id in self.children(did): - self.rem(id, cardsToo) + self.rem(id, cardsToo, childrenToo=False) # delete cards too? if cardsToo: # don't use cids(), as we want cards in cram decks too