mirror of
https://github.com/explosion/spaCy.git
synced 2025-08-07 13:44:55 +03:00
make suffix optional for walk
This commit is contained in:
parent
2525473c20
commit
d1d8b3b9ef
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue
Block a user