From e693147ebddab83d0cca76f6fb72f2d8bae44992 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20H=C3=B8xbro=20Hansen?= Date: Thu, 6 Jun 2024 08:49:05 +0200 Subject: [PATCH 1/2] Add more ignoredirs --- src/clean_notebook/clean.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/clean_notebook/clean.py b/src/clean_notebook/clean.py index 2110aad..3497a45 100644 --- a/src/clean_notebook/clean.py +++ b/src/clean_notebook/clean.py @@ -7,6 +7,8 @@ __all__ = ("clean_notebook", "clean_single_notebook") +IGNOREDIRS = (".venv", ".pixi", "site-packages", ".ipynb_checkpoints") + def clean_notebook( paths: list[str | Path], @@ -86,9 +88,12 @@ def _get_files(paths: list[str | Path]) -> Iterator[Path]: if path.is_file() and path.suffix == ".ipynb": yield path if path.is_dir(): + if path.name in IGNOREDIRS: + continue for file in path.rglob("*.ipynb"): - if file.parent.name != ".ipynb_checkpoints": - yield file + if any(ps in IGNOREDIRS for ps in file.parts): + continue + yield file def _ignore(cell: dict[str, Any], ignore: list[str] | None) -> dict[str, Any]: From 9a5798235154540afb7856c46da77ebcc675dfe0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20H=C3=B8xbro=20Hansen?= Date: Thu, 6 Jun 2024 08:54:35 +0200 Subject: [PATCH 2/2] Bump pre-commit versions --- .pre-commit-config.yaml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index d5e3d5b..89c437b 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,7 +1,7 @@ exclude: ^tests/data/ repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.5.0 + rev: v4.6.0 hooks: - id: mixed-line-ending - id: end-of-file-fixer @@ -11,22 +11,22 @@ repos: - id: check-json - id: check-executables-have-shebangs - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.3.3 + rev: v0.4.8 hooks: - id: ruff - id: ruff-format - repo: https://github.com/pre-commit/mirrors-mypy - rev: v1.9.0 + rev: v1.10.0 hooks: - id: mypy - repo: https://github.com/codespell-project/codespell - rev: v2.2.6 + rev: v2.3.0 hooks: - id: codespell additional_dependencies: - tomli - - repo: https://github.com/pre-commit/mirrors-prettier - rev: v3.1.0 + - repo: https://github.com/hoxbro/prettier-pre-commit + rev: v3.3.1 hooks: - id: prettier types_or: