From 2ad03ddbc0703026c863d10e14dacd8477c1f4de Mon Sep 17 00:00:00 2001 From: Austin Siew <17107540+Aquafina-water-bottle@users.noreply.github.com> Date: Fri, 30 Dec 2022 20:26:58 -0700 Subject: [PATCH 1/4] added anki 2.1.54 and 2.1.55 tests & fixed NotFoundError not working on 2.1.55 --- plugin/__init__.py | 9 +++++++-- tox.ini | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/plugin/__init__.py b/plugin/__init__.py index 38851c5..589e1d4 100644 --- a/plugin/__init__.py +++ b/plugin/__init__.py @@ -350,17 +350,22 @@ class AnkiConnect: # Not a duplicate return 0 + def raiseNotfoundError(self, errorMsg): + if anki_version < (2, 1, 55): + raise NotFoundError(errorMsg) + raise NotFoundError(errorMsg, None, None, None) + def getCard(self, card_id: int) -> Card: try: return self.collection().getCard(card_id) except NotFoundError: - raise NotFoundError('Card was not found: {}'.format(card_id)) + self.raiseNotfoundError('Card was not found: {}'.format(card_id)) def getNote(self, note_id: int) -> Note: try: return self.collection().getNote(note_id) except NotFoundError: - raise NotFoundError('Note was not found: {}'.format(note_id)) + self.raiseNotfoundError('Note was not found: {}'.format(note_id)) def deckStatsToJson(self, due_tree): deckStats = {'deck_id': due_tree.deck_id, diff --git a/tox.ini b/tox.ini index 699b662..ab14f7c 100644 --- a/tox.ini +++ b/tox.ini @@ -54,7 +54,7 @@ requires = pypi-timemachine envlist = py38-anki2.1.{45,46,47,48,49} - py39-anki2.1.{50,51,52,53}-qt{5,6} + py39-anki2.1.{50,51,52,53,54,55}-qt{5,6} [testenv:.tox] install_command = From 0c37ab0f5cc9acfc13dee13e59a3b26dd37da4d0 Mon Sep 17 00:00:00 2001 From: Austin Siew <17107540+Aquafina-water-bottle@users.noreply.github.com> Date: Fri, 30 Dec 2022 20:34:50 -0700 Subject: [PATCH 2/4] Added 2.1.54 and 2.1.55 to github actions --- .github/workflows/tests.yml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 6b5d478..734abf5 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -48,6 +48,18 @@ jobs: - name: Anki 2.1.53 (Qt6) python: 3.9 environment: py39-anki2.1.53-qt6 + - name: Anki 2.1.54 (Qt5) + python: 3.9 + environment: py39-anki2.1.54-qt5 + - name: Anki 2.1.54 (Qt6) + python: 3.9 + environment: py39-anki2.1.54-qt6 + - name: Anki 2.1.55 (Qt5) + python: 3.9 + environment: py39-anki2.1.55-qt5 + - name: Anki 2.1.55 (Qt6) + python: 3.9 + environment: py39-anki2.1.55-qt6 fail-fast: false steps: From a2759710026a8fb18caabc4e2d017ff6de278085 Mon Sep 17 00:00:00 2001 From: Austin Siew <17107540+Aquafina-water-bottle@users.noreply.github.com> Date: Mon, 9 Jan 2023 21:23:43 -0700 Subject: [PATCH 3/4] fixed formatting issue --- plugin/__init__.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/plugin/__init__.py b/plugin/__init__.py index 589e1d4..e9c7b75 100644 --- a/plugin/__init__.py +++ b/plugin/__init__.py @@ -350,7 +350,7 @@ class AnkiConnect: # Not a duplicate return 0 - def raiseNotfoundError(self, errorMsg): + def raiseNotFoundError(self, errorMsg): if anki_version < (2, 1, 55): raise NotFoundError(errorMsg) raise NotFoundError(errorMsg, None, None, None) @@ -359,13 +359,13 @@ class AnkiConnect: try: return self.collection().getCard(card_id) except NotFoundError: - self.raiseNotfoundError('Card was not found: {}'.format(card_id)) + self.raiseNotFoundError('Card was not found: {}'.format(card_id)) def getNote(self, note_id: int) -> Note: try: return self.collection().getNote(note_id) except NotFoundError: - self.raiseNotfoundError('Note was not found: {}'.format(note_id)) + self.raiseNotFoundError('Note was not found: {}'.format(note_id)) def deckStatsToJson(self, due_tree): deckStats = {'deck_id': due_tree.deck_id, From 8187fa3c48cbde7b257c1bd32eeb710a8109d970 Mon Sep 17 00:00:00 2001 From: Austin Siew <17107540+Aquafina-water-bottle@users.noreply.github.com> Date: Fri, 13 Jan 2023 21:53:07 -0700 Subject: [PATCH 4/4] added 2.1.56 --- .github/workflows/tests.yml | 6 ++++++ tox.ini | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 734abf5..c2b0f5c 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -60,6 +60,12 @@ jobs: - name: Anki 2.1.55 (Qt6) python: 3.9 environment: py39-anki2.1.55-qt6 + - name: Anki 2.1.56 (Qt5) + python: 3.9 + environment: py39-anki2.1.56-qt5 + - name: Anki 2.1.56 (Qt6) + python: 3.9 + environment: py39-anki2.1.56-qt6 fail-fast: false steps: diff --git a/tox.ini b/tox.ini index ab14f7c..84f4173 100644 --- a/tox.ini +++ b/tox.ini @@ -54,7 +54,7 @@ requires = pypi-timemachine envlist = py38-anki2.1.{45,46,47,48,49} - py39-anki2.1.{50,51,52,53,54,55}-qt{5,6} + py39-anki2.1.{50,51,52,53,54,55,56}-qt{5,6} [testenv:.tox] install_command =