From 8e5175e56ba5f97f4348172bf42cd0bda92ff878 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sat, 17 Jul 2021 09:51:06 +0530 Subject: [PATCH] Revert "icat: Use scandir for slightly better performance" This reverts commit 2e893690bd288108baff210f710a0d415b030c1c. scandir is not recursive --- kittens/icat/main.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/kittens/icat/main.py b/kittens/icat/main.py index f18350c46..e951b892d 100755 --- a/kittens/icat/main.py +++ b/kittens/icat/main.py @@ -359,11 +359,11 @@ def process(path: str, args: IcatCLIOptions, parsed_opts: ParsedOpts, is_tempfil def scan(d: str) -> Generator[Tuple[str, str], None, None]: - for entry in os.scandir(d): - if entry.is_file(): - mt = guess_type(entry.name) + for dirpath, dirnames, filenames in os.walk(d): + for f in filenames: + mt = guess_type(f) if mt and mt.startswith('image/'): - yield entry.path, mt + yield os.path.join(dirpath, f), mt def detect_support(wait_for: float = 10, silent: bool = False) -> bool: