Skip to content

Commit

Permalink
Drop include_hidden=all_files from iglob instead
Browse files Browse the repository at this point in the history
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).
  • Loading branch information
krassowski committed Oct 15, 2024
1 parent b8b5bdf commit f435a4d
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions packages/jupyter-ai/jupyter_ai/document_loaders/directory.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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}
Expand Down

0 comments on commit f435a4d

Please sign in to comment.