diff --git a/pylib/anki/collection.py b/pylib/anki/collection.py index cc46df113..58a22ed36 100644 --- a/pylib/anki/collection.py +++ b/pylib/anki/collection.py @@ -71,8 +71,7 @@ class Collection: return f"{super().__repr__()} {pprint.pformat(d, width=300)}" def name(self) -> Any: - n = os.path.splitext(os.path.basename(self.path))[0] - return n + return os.path.splitext(os.path.basename(self.path))[0] def weakref(self) -> Collection: "Shortcut to create a weak reference that doesn't break code completion." diff --git a/pylib/anki/importing/anki2.py b/pylib/anki/importing/anki2.py index 42524b44a..e3c31081e 100644 --- a/pylib/anki/importing/anki2.py +++ b/pylib/anki/importing/anki2.py @@ -322,7 +322,6 @@ class Anki2Importer(Importer): # does the card's note exist in dst col? if guid not in self._notes: continue - dnid = self._notes[guid] # does the card already exist in the dst col? ord = card[5] if (guid, ord) in self._cards: diff --git a/qt/aqt/customstudy.py b/qt/aqt/customstudy.py index 2b3e76020..5d789c2b0 100644 --- a/qt/aqt/customstudy.py +++ b/qt/aqt/customstudy.py @@ -201,5 +201,4 @@ class CustomStudy(QDialog): def _getTags(self): from aqt.taglimit import TagLimit - t = TagLimit(self.mw, self) - return t.tags + return TagLimit(self.mw, self).tags diff --git a/qt/aqt/deckchooser.py b/qt/aqt/deckchooser.py index d42eebffe..ef8a3e064 100644 --- a/qt/aqt/deckchooser.py +++ b/qt/aqt/deckchooser.py @@ -32,7 +32,7 @@ class DeckChooser(QHBoxLayout): self.deck = QPushButton(clicked=self.onDeckChange) # type: ignore self.deck.setAutoDefault(False) self.deck.setToolTip(shortcut(_("Target Deck (Ctrl+D)"))) - s = QShortcut(QKeySequence("Ctrl+D"), self.widget, activated=self.onDeckChange) # type: ignore + QShortcut(QKeySequence("Ctrl+D"), self.widget, activated=self.onDeckChange) # type: ignore self.addWidget(self.deck) # starting label if self.mw.col.conf.get("addToCur", True): diff --git a/qt/aqt/main.py b/qt/aqt/main.py index be5c84a38..edd0c1c02 100644 --- a/qt/aqt/main.py +++ b/qt/aqt/main.py @@ -601,8 +601,7 @@ from the profile screen." newpath = os.path.join(dir, fname) with open(path, "rb") as f: data = f.read() - b = self.BackupThread(newpath, data) - b.start() + self.BackupThread(newpath, data).start() # find existing backups backups = [] diff --git a/qt/aqt/modelchooser.py b/qt/aqt/modelchooser.py index 98ba9dfdb..fb50f3e02 100644 --- a/qt/aqt/modelchooser.py +++ b/qt/aqt/modelchooser.py @@ -29,7 +29,7 @@ class ModelChooser(QHBoxLayout): self.models = QPushButton() # self.models.setStyleSheet("* { text-align: left; }") self.models.setToolTip(shortcut(_("Change Note Type (Ctrl+N)"))) - s = QShortcut(QKeySequence("Ctrl+N"), self.widget, activated=self.onModelChange) + QShortcut(QKeySequence("Ctrl+N"), self.widget, activated=self.onModelChange) self.models.setAutoDefault(False) self.addWidget(self.models) qconnect(self.models.clicked, self.onModelChange) diff --git a/qt/aqt/update.py b/qt/aqt/update.py index 2513d84c3..5d3bbda0b 100644 --- a/qt/aqt/update.py +++ b/qt/aqt/update.py @@ -24,14 +24,13 @@ class LatestVersionFinder(QThread): self.config = main.pm.meta def _data(self): - d = { + return { "ver": versionWithBuild(), "os": platDesc(), "id": self.config["id"], "lm": self.config["lastMsg"], "crt": self.config["created"], } - return d def run(self): if not self.config["updates"]: