Skip to content

Commit

Permalink
Fix /learn in 2.14.0 (#747)
Browse files Browse the repository at this point in the history
* accumulate filepaths

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
michaelchia and pre-commit-ci[bot] authored Apr 26, 2024
1 parent 3e6b61d commit f0f1999
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions packages/jupyter-ai/jupyter_ai/document_loaders/directory.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,9 @@ def split(path, all_files: bool, splitter):

# Check if the path points to a single file
if os.path.isfile(path):
dir = os.path.dirname(path)
filenames = [os.path.basename(path)]
filepaths = [Path(path)]
else:
filepaths = []
for dir, subdirs, filenames in os.walk(path):
# Filter out hidden filenames, hidden directories, and excluded directories,
# unless "all files" are requested
Expand All @@ -77,9 +77,9 @@ def split(path, all_files: bool, splitter):
d for d in subdirs if not (d[0] == "." or d in EXCLUDE_DIRS)
]
filenames = [f for f in filenames if not f[0] == "."]
filepaths += [Path(os.path.join(dir, filename)) for filename in filenames]

for filename in filenames:
filepath = Path(os.path.join(dir, filename))
for filepath in filepaths:
# Lower case everything to make sure file extension comparisons are not case sensitive
if filepath.suffix.lower() not in {j.lower() for j in SUPPORTED_EXTS}:
continue
Expand Down

0 comments on commit f0f1999

Please sign in to comment.