From d1d8b3b9ef771dc95f16a2a5905bba5f1559ead8 Mon Sep 17 00:00:00 2001 From: kadarakos Date: Thu, 15 Sep 2022 12:52:10 +0000 Subject: [PATCH] make suffix optional for walk --- spacy/cli/_util.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spacy/cli/_util.py b/spacy/cli/_util.py index 84e611841..296e17563 100644 --- a/spacy/cli/_util.py +++ b/spacy/cli/_util.py @@ -578,7 +578,7 @@ def setup_gpu(use_gpu: int, silent=None) -> None: local_msg.info("To switch to GPU 0, use the option: --gpu-id 0") -def walk_directory(path: Path, suffix: str) -> List[Path]: +def walk_directory(path: Path, suffix: Optional[str] = None) -> List[Path]: if not path.is_dir(): return [path] paths = [path] @@ -592,7 +592,7 @@ def walk_directory(path: Path, suffix: str) -> List[Path]: continue elif path.is_dir(): paths.extend(path.iterdir()) - elif not path.parts[-1].endswith(suffix): + elif suffix is not None and not path.parts[-1].endswith(suffix): continue else: locs.append(path)