mirror of
https://github.com/explosion/spaCy.git
synced 2025-08-07 21:54:54 +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")
|
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():
|
if not path.is_dir():
|
||||||
return [path]
|
return [path]
|
||||||
paths = [path]
|
paths = [path]
|
||||||
|
@ -592,7 +592,7 @@ def walk_directory(path: Path, suffix: str) -> List[Path]:
|
||||||
continue
|
continue
|
||||||
elif path.is_dir():
|
elif path.is_dir():
|
||||||
paths.extend(path.iterdir())
|
paths.extend(path.iterdir())
|
||||||
elif not path.parts[-1].endswith(suffix):
|
elif suffix is not None and not path.parts[-1].endswith(suffix):
|
||||||
continue
|
continue
|
||||||
else:
|
else:
|
||||||
locs.append(path)
|
locs.append(path)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user