Skip to content

Commit 8d6ffab

Browse files
authored
Correct hidden folder removal
The first fix to remove hidden folder was not working properly in case multiple hidden folders exist.
1 parent 5e4181a commit 8d6ffab

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

jupyterlab-snippets/loader.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ def collect_snippets(self):
1515
snippets = []
1616
for root_path in self.snippet_paths:
1717
for dirpath, dirnames, filenames in os.walk(root_path, followlinks=True):
18-
# Remove hidden folder
19-
for folder_i, folder in enumerate(dirnames):
20-
if folder.startswith("."):
21-
dirnames.pop(folder_i)
18+
# Remove hidden folder
19+
to_remove = [folder for folder in dirnames if folder.startswith(".")]
20+
for folder in to_remove:
21+
dirnames.remove(folder)
2222

2323
for f in filenames:
2424
fullpath = PurePath(dirpath).relative_to(root_path).joinpath(f)

0 commit comments

Comments
 (0)