diff options
author | BonfaceKilz | 2021-02-12 22:05:53 +0300 |
---|---|---|
committer | BonfaceKilz | 2021-02-12 22:05:53 +0300 |
commit | adb9a6e3d570c86cf902d6293b30fc1f0f27df82 (patch) | |
tree | 9c0fd48d8ffff9d140a26b838cc54504cc553aad /gn3/file_utils.py | |
parent | b2254d8f5fdabd97e38dcdbaebd5d8352309cd46 (diff) | |
download | genenetwork3-adb9a6e3d570c86cf902d6293b30fc1f0f27df82.tar.gz |
Use sorted list of files when calculating md5sums of directory
* gn3/file_utils.py (get_dir_hash): Sort list of files before
calculating their md5sums.
* tests/unit/test_file_utils.py (test_get_dir_hash): Update test-case
md5sum.
Diffstat (limited to 'gn3/file_utils.py')
-rw-r--r-- | gn3/file_utils.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/gn3/file_utils.py b/gn3/file_utils.py index 79e6854..d6e1c66 100644 --- a/gn3/file_utils.py +++ b/gn3/file_utils.py @@ -13,7 +13,7 @@ def get_dir_hash(directory: str) -> str: if not os.path.exists(directory): raise FileNotFoundError for root, _, files in os.walk(directory): - for names in files: + for names in sorted(files): file_path = os.path.join(root, names) with open(file_path, "rb") as file_: for buf in iter(partial(file_.read, 4096), b''): |