From 8f78d94df7b578515b24038775d6bd242b27d65c Mon Sep 17 00:00:00 2001 From: David Michaels Date: Wed, 8 May 2024 18:34:01 -0400 Subject: [PATCH] added ordering to file_utils.search_for_files --- dcicutils/file_utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dcicutils/file_utils.py b/dcicutils/file_utils.py index 552d314ac..0ebc8e4cd 100644 --- a/dcicutils/file_utils.py +++ b/dcicutils/file_utils.py @@ -29,7 +29,7 @@ def search_for_file(file: str, def order_by_fewest_number_of_paths_and_then_alphabetically(paths: List[str]) -> List[str]: def order_by(path: str): return len(path.split(os.path.sep)), path - return sorted(paths, key=order_by, reverse=True) + return sorted(paths, key=order_by) if not (file and isinstance(file, (str, pathlib.PosixPath))): return None if single is True else []