re-add some tools functions
This commit is contained in:
parent
1d981022cb
commit
7e38d71b90
1 changed files with 17 additions and 0 deletions
|
|
@ -17,3 +17,20 @@ def m2k(m):
|
||||||
|
|
||||||
def k2m(k):
|
def k2m(k):
|
||||||
return (1/(2*k))-4
|
return (1/(2*k))-4
|
||||||
|
|
||||||
|
|
||||||
|
def record2name_key(record_path: str):
|
||||||
|
file = record_path.split("::")[0]
|
||||||
|
key = record_path.split("::")[1]
|
||||||
|
return file, key
|
||||||
|
|
||||||
|
|
||||||
|
def name_key2record(name: str, key: str):
|
||||||
|
return name + "::" + 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