Skip to content

Commit

Permalink
Add more ignoredirs
Browse files Browse the repository at this point in the history
  • Loading branch information
hoxbro committed Jun 6, 2024
1 parent 7fb7e4e commit e693147
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/clean_notebook/clean.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@

__all__ = ("clean_notebook", "clean_single_notebook")

IGNOREDIRS = (".venv", ".pixi", "site-packages", ".ipynb_checkpoints")


def clean_notebook(
paths: list[str | Path],
Expand Down Expand Up @@ -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]:
Expand Down

0 comments on commit e693147

Please sign in to comment.