Rename hash_file's callback to callback_progress.

This commit is contained in:
Ethan Dalool 2020-02-18 00:20:51 -08:00
parent edd2ee716b
commit ef89ba67c2

View file

@ -471,7 +471,7 @@ def copy_file(
if validate_hash: if validate_hash:
verify_hash( verify_hash(
destination, destination,
callback=callback_validate_hash, callback_progress=callback_validate_hash,
known_size=source_bytes, known_size=source_bytes,
known_hash=hasher.hexdigest(), known_hash=hasher.hexdigest(),
) )
@ -504,11 +504,11 @@ def hash_file(
path, path,
hash_class=HASH_CLASS, hash_class=HASH_CLASS,
*, *,
callback=do_nothing, callback_progress=do_nothing,
chunk_size=CHUNK_SIZE, chunk_size=CHUNK_SIZE,
): ):
''' '''
callback: callback_progress:
A function that takes three parameters: A function that takes three parameters:
path object, bytes ingested so far, bytes total path object, bytes ingested so far, bytes total
''' '''
@ -525,7 +525,7 @@ def hash_file(
break break
hasher.update(chunk) hasher.update(chunk)
checked_bytes += len(chunk) checked_bytes += len(chunk)
callback(path, checked_bytes, file_size) callback_progress(path, checked_bytes, file_size)
return hasher.hexdigest() return hasher.hexdigest()