From f435a4df69eb2321a66d4ba5eb6978c04e1f4477 Mon Sep 17 00:00:00 2001 From: krassowski <5832902+krassowski@users.noreply.github.com> Date: Tue, 15 Oct 2024 11:03:09 +0100 Subject: [PATCH] Drop `include_hidden=all_files` from `iglob` instead as per review users can still do `/learn .*` and it would be in line how `bash`/`zsh` works (e.g. `ls * -a` does not files in hidden directories but `ls .*` does). --- .../jupyter-ai/jupyter_ai/document_loaders/directory.py | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/packages/jupyter-ai/jupyter_ai/document_loaders/directory.py b/packages/jupyter-ai/jupyter_ai/document_loaders/directory.py index 3e8b144c5..d3b81a839 100644 --- a/packages/jupyter-ai/jupyter_ai/document_loaders/directory.py +++ b/packages/jupyter-ai/jupyter_ai/document_loaders/directory.py @@ -4,7 +4,6 @@ import tarfile from datetime import datetime from glob import iglob -from inspect import signature from pathlib import Path from typing import List @@ -137,12 +136,7 @@ def collect_filepaths(path, all_files: bool): filepaths = walk_directory(path, all_files) else: filepaths = [] - glob_iterator = ( - iglob(str(path), recursive=True, include_hidden=all_files) - if "include_hidden" in signature(iglob).parameters - else iglob(str(path), recursive=True) - ) - for glob_path in glob_iterator: + for glob_path in iglob(str(path), recursive=True): if os.path.isfile(glob_path): filepaths.append(Path(glob_path)) valid_exts = {j.lower() for j in SUPPORTED_EXTS}