Skip to content

Commit a0f966e

Browse files
committed
Fix removal of ignored assignment files
1 parent ea2c002 commit a0f966e

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

nbgrader/coursedir.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,10 @@ def find_assignments(self,
361361
# Locate all matching directories using a glob
362362
dirs = list(
363363
filter(
364-
lambda p: p.is_dir() and not is_ignored(p.relative_to(self.root), self.ignore),
364+
lambda p: (
365+
p.is_dir()
366+
and not is_ignored(str(p.relative_to(self.root)), self.ignore)
367+
),
365368
Path(self.root).glob(self.directory_structure.format(**kwargs))
366369
)
367370
)

nbgrader/utils.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,11 +272,14 @@ def self_owned(path):
272272
return get_osusername() == find_owner(os.path.abspath(path))
273273

274274

275-
def is_ignored(filename: str, ignore_globs: List[str]) -> bool:
275+
def is_ignored(filename: str, ignore_globs: List[str] = None) -> bool:
276276
"""Determines whether a filename should be ignored, based on whether it
277277
matches any file glob in the given list. Note that this only matches on the
278278
base filename itself, not the full path."""
279279

280+
if ignore_globs is None:
281+
return False
282+
280283
basename = os.path.basename(filename)
281284
for expr in ignore_globs:
282285
if fnmatch.fnmatch(basename, expr):

0 commit comments

Comments
 (0)