Sort paths for cache consistency

This commit is contained in:
Matthew Honnibal 2020-09-25 19:07:26 +02:00
parent c3b5a3cfff
commit 3d8388969e
2 changed files with 4 additions and 0 deletions

View File

@ -209,6 +209,8 @@ def walk_directory(path: Path, converter: str) -> List[Path]:
continue
else:
locs.append(path)
# It's good to sort these, in case the ordering messes up cache.
locs.sort()
return locs

View File

@ -50,6 +50,8 @@ def walk_corpus(path: Union[str, Path], file_type) -> List[Path]:
locs.append(path)
if len(locs) == 0:
warnings.warn(Warnings.W090.format(path=orig_path, format=file_type))
# It's good to sort these, in case the ordering messes up a cache.
locs.sort()
return locs