初始化提交

This commit is contained in:
王立帮
2024-07-19 10:16:00 +08:00
parent 4c7b571f20
commit 4a2d56dcc4
7084 changed files with 741212 additions and 63 deletions

View File

@@ -0,0 +1,25 @@
import hashlib
import os
def sha_file(f):
if f not in set(os.listdir(".")):
return 'None:::sha_file_end'
else:
sha = hashlib.sha256()
with open(f, encoding='utf-8') as fd:
file_buffer = fd.read(128).encode("utf-8")
while len(file_buffer) > 0:
sha.update(file_buffer)
file_buffer = fd.read(128).encode("utf-8")
h = sha.digest()
return ''.join(['%.2x' % i for i in h]) + ":::sha_file_end"
def reload(mod):
import sys
mod_name = mod.__name__
try:
del sys.modules[mod_name]
__import__(mod_name)
except:
pass