From 68d12e49002faa9e8ef7d6189eb100e857310069 Mon Sep 17 00:00:00 2001 From: Ethan Dalool Date: Fri, 4 Jun 2021 13:07:59 -0700 Subject: [PATCH] Pass _case_correct=True on trusted values to speed up walk. --- voussoirkit/spinal.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/voussoirkit/spinal.py b/voussoirkit/spinal.py index 39d2e5c..f9c4b40 100644 --- a/voussoirkit/spinal.py +++ b/voussoirkit/spinal.py @@ -876,7 +876,7 @@ def walk( continue new_child_dirs.append(child_dir) - directories.append(pathclass.Path(child_dir_abspath)) + directories.append(pathclass.Path(child_dir_abspath, _case_correct=True)) # This will actually affect the results of the os.walk going forward! child_dirs[:] = new_child_dirs @@ -887,9 +887,9 @@ def walk( if handle_exclusion(glob_filenames, exclude_filenames, child_file, child_file_abspath): continue - files.append(pathclass.Path(child_file_abspath)) + files.append(pathclass.Path(child_file_abspath, _case_correct=True)) - current_location = pathclass.Path(current_location) + current_location = pathclass.Path(current_location, _case_correct=True) yield (current_location, directories, files) def walkstep_flat(current_location, child_dirs, child_files): @@ -901,7 +901,7 @@ def walk( new_child_dirs.append(child_dir) if yield_directories: - yield pathclass.Path(child_dir_abspath) + yield pathclass.Path(child_dir_abspath, _case_correct=True) # This will actually affect the results of the os.walk going forward! child_dirs[:] = new_child_dirs @@ -912,7 +912,7 @@ def walk( if handle_exclusion(glob_filenames, exclude_filenames, child_file, child_file_abspath): continue - yield pathclass.Path(child_file_abspath) + yield pathclass.Path(child_file_abspath, _case_correct=True) walker = os.walk(path.absolute_path, onerror=callback_permission_denied, followlinks=True) if yield_style == 'flat':