This commit is contained in:
Hykilpikonna
2021-12-27 11:56:23 -05:00
parent 331171a61f
commit 5e021df11a
2 changed files with 30 additions and 1 deletions
+13
View File
@@ -0,0 +1,13 @@
$ErrorActionPreference = "Stop"
$VERSION = $(python -c 'import hypy_utils; print(hypy_utils.__version__)')
Write-Output "$VERSION"
# Build
python setup.py sdist bdist_wheel
# Check
python -m twine check dist/*
# Upload
python -m twine upload dist/*
+17 -1
View File
@@ -1,6 +1,7 @@
__version__ = "1.0.1"
__version__ = "1.0.2"
import dataclasses
import hashlib
import json
from datetime import datetime, date
from pathlib import Path
@@ -157,3 +158,18 @@ def read(file: Union[str, Path]) -> str:
:return: None
"""
return file.read_text('utf-8')
def md5(file: Union[str, Path]) -> str:
"""
Compute md5 of a file
:param file: File path
:return: md5 string
"""
file = Path(file)
hash_md5 = hashlib.md5()
with open(file, "rb") as f:
for chunk in iter(lambda: f.read(4096), b""):
hash_md5.update(chunk)
return hash_md5.hexdigest()