[+] MD5
This commit is contained in:
+13
@@ -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
@@ -1,6 +1,7 @@
|
|||||||
__version__ = "1.0.1"
|
__version__ = "1.0.2"
|
||||||
|
|
||||||
import dataclasses
|
import dataclasses
|
||||||
|
import hashlib
|
||||||
import json
|
import json
|
||||||
from datetime import datetime, date
|
from datetime import datetime, date
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
@@ -157,3 +158,18 @@ def read(file: Union[str, Path]) -> str:
|
|||||||
:return: None
|
:return: None
|
||||||
"""
|
"""
|
||||||
return file.read_text('utf-8')
|
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()
|
||||||
|
|||||||
Reference in New Issue
Block a user