write wrapper hash method
This commit is contained in:
parent
4f3e78177e
commit
a080ca835f
1 changed files with 10 additions and 3 deletions
|
|
@ -1,5 +1,5 @@
|
||||||
|
import hashlib
|
||||||
|
import os
|
||||||
|
|
||||||
def str2list(string):
|
def str2list(string):
|
||||||
return string.split(",")
|
return string.split(",")
|
||||||
|
|
@ -22,3 +22,10 @@ def record2name_key(record_path: str):
|
||||||
file = record_path.split("::")[0]
|
file = record_path.split("::")[0]
|
||||||
key = record_path.split("::")[1]
|
key = record_path.split("::")[1]
|
||||||
return file, key
|
return file, key
|
||||||
|
|
||||||
|
|
||||||
|
def make_version_hash(path, record):
|
||||||
|
file, key = record2name_key(record)
|
||||||
|
with open(os.path.join(path, file), 'rb') as fp:
|
||||||
|
file_hash = hashlib.file_digest(fp, 'sha1').hexdigest()
|
||||||
|
return file_hash
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue