|
5 | 5 | import typing
|
6 | 6 | from pathlib import Path
|
7 | 7 | from textwrap import dedent
|
| 8 | +import logging |
8 | 9 |
|
9 | 10 | from traitlets.config import LoggingConfigurable
|
10 | 11 | from traitlets import Integer, Bool, Unicode, List, default, validate, TraitError
|
@@ -379,12 +380,14 @@ def find_assignments(self,
|
379 | 380 | }
|
380 | 381 |
|
381 | 382 | # Convert to a Path and back to a string to remove any instances of `/.`
|
382 |
| - pattern = str(Path(self.directory_structure.format(**pattern_args))) |
| 383 | + pattern = str(self.directory_structure) |
383 | 384 |
|
| 385 | + # Escape backslashes on Windows before doing any other escaping |
384 | 386 | if sys.platform == 'win32':
|
385 |
| - # Escape backslashes on Windows |
386 | 387 | pattern = pattern.replace('\\', r'\\')
|
387 | 388 |
|
| 389 | + pattern = str(Path(self.directory_structure.format(**pattern_args))) |
| 390 | + |
388 | 391 | for dir in dirs:
|
389 | 392 | match = re.match(pattern, str(dir.relative_to(self.root)))
|
390 | 393 | if match:
|
@@ -438,14 +441,21 @@ def find_notebooks(
|
438 | 441 | for key, value in kwargs.items()
|
439 | 442 | }
|
440 | 443 |
|
| 444 | + logging.error("unescaped pattern: %s", pattern) |
| 445 | + |
441 | 446 | # Escape backslashes on Windows before doing any other escaping
|
442 | 447 | if sys.platform == 'win32':
|
443 | 448 | pattern = pattern.replace('\\', r'\\')
|
444 | 449 |
|
| 450 | + logging.error("winescaped pattern: %s", pattern) |
| 451 | + |
445 | 452 | # Convert to a Path and back to a string to remove any instances of `/.`
|
446 | 453 | pattern = str(Path(pattern.replace(".", r"\.").format(**pattern_args)))
|
447 | 454 |
|
| 455 | + logging.error("final pattern: %s", pattern) |
| 456 | + |
448 | 457 | for file in files:
|
| 458 | + loggging.error("file: %s", file.relative_to(self.root)) |
449 | 459 | match = re.match(pattern, str(file.relative_to(self.root)))
|
450 | 460 | if match:
|
451 | 461 | results.append({ **kwargs, **match.groupdict(), "path": file })
|
|
0 commit comments