Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Nov 1, 2023
1 parent 86b450c commit 2f253ba
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
4 changes: 3 additions & 1 deletion packages/jupyter-ai/jupyter_ai/chat_handlers/learn.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down
5 changes: 3 additions & 2 deletions packages/jupyter-ai/jupyter_ai/document_loaders/directory.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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:
Expand All @@ -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)
Expand Down

0 comments on commit 2f253ba

Please sign in to comment.