Skip to content
This repository has been archived by the owner on Jan 16, 2023. It is now read-only.

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Anton Agestam <[email protected]>
  • Loading branch information
sean-wallace and antonagestam authored Jul 2, 2020
1 parent 0ab9abb commit a5385e7
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions collectfast/strategies/boto3.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,13 @@ def get_local_multipart_hash(
self, path: str, local_storage: Storage, chunk_size: int
) -> str:
"""Calculate multipart hash using a given chunk size."""
md5s = []
chunk_hashes = []
with local_storage.open(path, "rb") as f:
func: Callable[[], Any] = lambda: f.read(chunk_size)
for data in iter(func, b""):
md5s.append(hashlib.md5(data).digest())
m = hashlib.md5(b"".join(md5s))
return "{}-{}".format(m.hexdigest(), len(md5s))
summed_hash = hashlib.md5(b"".join(chunk_hashes)).hexdigest()
return f"{summed_hash}-{len(chunk_hashes)}"

@lru_cache(maxsize=None)
def get_local_file_hash(
Expand Down

0 comments on commit a5385e7

Please sign in to comment.