Skip to content

Commit 31f8eba

Browse files
authored
Merge pull request #67 from man-group/fix/hidden-directories
Fix issue with ignoring hidden directories
2 parents 3c13eaf + 5756190 commit 31f8eba

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

notebooker/utils/templates.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515

1616
def _valid_dirname(d):
17-
hidden_dirs = [dir for dir in d.split("/") if dir.startswith(".")]
17+
hidden_dirs = [dir for dir in d.split("/") if dir.startswith(".") and (dir != "." or dir != "..")]
1818
return "__init__" not in d and "__pycache__" not in d and not hidden_dirs
1919

2020

tests/unit/utils/test_templates.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@ def test_get_directory_structure():
2121
"depth/3.ipynb",
2222
".hidden/4.ipynb",
2323
".hidden/visible/5.ipynb",
24-
".hidden/.more-hidden/6.ipynb"
24+
".hidden/.more-hidden/6.ipynb",
25+
"./visible/7.ipynb",
26+
"this/is/../is/8.ipynb"
2527
]
2628
for path in paths:
2729
abspath = os.path.join(temp_dir, path)
@@ -33,8 +35,9 @@ def test_get_directory_structure():
3335
"hello": None,
3436
"goodbye": None,
3537
"depth": {"depth/1": None, "depth/2": None, "depth/3": None},
36-
"this": {"this/report": None, "is": {"this/is/deep": None, "very": {"this/is/very/deep": None}}},
38+
"this": {"this/report": None, "is": {"this/is/8": None, "this/is/deep": None, "very": {"this/is/very/deep": None}}},
3739
"hello_again": None,
40+
"visible": {"visible/7": None},
3841
}
3942

4043
assert get_directory_structure(temp_dir) == expected_structure

0 commit comments

Comments
 (0)