Support Python 3.10 checksum verification
Browse files
tiny_english/artifacts.py
CHANGED
|
@@ -2,6 +2,9 @@ import hashlib
|
|
| 2 |
from pathlib import Path
|
| 3 |
|
| 4 |
|
| 5 |
-
def digest_file(path):
|
| 6 |
-
|
| 7 |
-
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
from pathlib import Path
|
| 3 |
|
| 4 |
|
| 5 |
+
def digest_file(path):
|
| 6 |
+
digest = hashlib.sha256()
|
| 7 |
+
with Path(path).open("rb") as handle:
|
| 8 |
+
for chunk in iter(lambda: handle.read(1024 * 1024), b""):
|
| 9 |
+
digest.update(chunk)
|
| 10 |
+
return digest.hexdigest()
|