Skip to content

Commit

Permalink
added ordering to file_utils.search_for_files
Browse files Browse the repository at this point in the history
  • Loading branch information
dmichaels-harvard committed May 8, 2024
1 parent 673de26 commit 8f78d94
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion dcicutils/file_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 []
Expand Down

0 comments on commit 8f78d94

Please sign in to comment.