From 9f154379ae1b9254e6e50fc62d21467cff511fed Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 5 Feb 2024 21:19:29 +0000 Subject: [PATCH 1/2] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/psf/black: 23.12.1 → 24.1.1](https://github.com/psf/black/compare/23.12.1...24.1.1) - [github.com/PyCQA/flake8: 6.1.0 → 7.0.0](https://github.com/PyCQA/flake8/compare/6.1.0...7.0.0) --- .pre-commit-config.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 211c1c1..f3064ad 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,6 +1,6 @@ repos: - repo: https://github.com/psf/black - rev: 23.12.1 + rev: 24.1.1 hooks: - id: black @@ -28,7 +28,7 @@ repos: ] - repo: https://github.com/PyCQA/flake8 - rev: "6.1.0" # pick a git hash / tag to point to + rev: "7.0.0" # pick a git hash / tag to point to hooks: - id: flake8 additional_dependencies: ["flake8-bugbear"] From 54dddb534716b937f9a7c954d1a0fafa93ba9e0a Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 5 Feb 2024 21:20:05 +0000 Subject: [PATCH 2/2] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- ankipandas/ankidf.py | 2 +- ankipandas/test/test_raw.py | 6 +++--- ankipandas/util/misc.py | 8 +++++--- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/ankipandas/ankidf.py b/ankipandas/ankidf.py index cfb106a..e7432be 100644 --- a/ankipandas/ankidf.py +++ b/ankipandas/ankidf.py @@ -1603,7 +1603,7 @@ def _get_ids(self, n=1) -> list[int]: def add_notes( self, nmodel: str, - nflds: (list[list[str]] | dict[str, list[str]] | list[dict[str, str]]), + nflds: list[list[str]] | dict[str, list[str]] | list[dict[str, str]], ntags: list[list[str]] | None = None, nid=None, nguid=None, diff --git a/ankipandas/test/test_raw.py b/ankipandas/test/test_raw.py index f4b2122..152c08a 100644 --- a/ankipandas/test/test_raw.py +++ b/ankipandas/test/test_raw.py @@ -152,9 +152,9 @@ def test_update(self): for mode in ["update", "replace", "append"]: with self.subTest(mode=mode): self._reset() - notes2.loc[ - notes2["id"] == 1555579337683, "tags" - ] = "definitelynew!" + notes2.loc[notes2["id"] == 1555579337683, "tags"] = ( + "definitelynew!" + ) set_table(self.db_write, notes2, "notes", mode) if mode == "append": self._check_db_equal() diff --git a/ankipandas/util/misc.py b/ankipandas/util/misc.py index 2168144..ccc5bdb 100644 --- a/ankipandas/util/misc.py +++ b/ankipandas/util/misc.py @@ -53,8 +53,10 @@ def nested_dict(): def defaultdict2dict(defdict: collections.defaultdict) -> dict: return { - key: defaultdict2dict(value) - if isinstance(value, collections.defaultdict) - else value + key: ( + defaultdict2dict(value) + if isinstance(value, collections.defaultdict) + else value + ) for key, value in defdict.items() }