From 2f253ba098d56b7df229f125223090bffa3e9785 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 1 Nov 2023 22:58:23 +0000 Subject: [PATCH] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- packages/jupyter-ai/jupyter_ai/chat_handlers/learn.py | 4 +++- packages/jupyter-ai/jupyter_ai/document_loaders/directory.py | 5 +++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/packages/jupyter-ai/jupyter_ai/chat_handlers/learn.py b/packages/jupyter-ai/jupyter_ai/chat_handlers/learn.py index 8fdffba66..ca4858deb 100644 --- a/packages/jupyter-ai/jupyter_ai/chat_handlers/learn.py +++ b/packages/jupyter-ai/jupyter_ai/chat_handlers/learn.py @@ -133,7 +133,9 @@ def _build_list_response(self): {dir_list}""" return message - async def learn_dir(self, path: str, chunk_size: int, chunk_overlap: int, all: bool): + async def learn_dir( + self, path: str, chunk_size: int, chunk_overlap: int, all: bool + ): dask_client = await self.dask_client_future splitter_kwargs = {"chunk_size": chunk_size, "chunk_overlap": chunk_overlap} splitters = { diff --git a/packages/jupyter-ai/jupyter_ai/document_loaders/directory.py b/packages/jupyter-ai/jupyter_ai/document_loaders/directory.py index ea4db8b42..d3e55fb1a 100644 --- a/packages/jupyter-ai/jupyter_ai/document_loaders/directory.py +++ b/packages/jupyter-ai/jupyter_ai/document_loaders/directory.py @@ -17,6 +17,7 @@ def path_to_doc(path): metadata = {"path": str(path), "sha256": m.digest(), "extension": path.suffix} return Document(page_content=text, metadata=metadata) + # Unless /learn has the "all files" option passed in, files and directories beginning with '.' are excluded EXCLUDE_DIRS = { "node_modules", @@ -55,7 +56,7 @@ def split(path, all: bool, splitter): continue # Exclude hidden directories - if all is False and dir[0] == '.': + if all is False and dir[0] == ".": continue for filename in filenames: @@ -64,7 +65,7 @@ def split(path, all: bool, splitter): continue # Unless we're learning "all" files, exclude hidden files - if all is False and filepath.name[0] == '.': + if all is False and filepath.name[0] == ".": continue document = dask.delayed(path_to_doc)(filepath)