mirror of
https://github.com/1Panel-dev/MaxKB.git
synced 2025-12-27 02:52:48 +00:00
fix: common (#3154)
Some checks are pending
sync2gitee / repo-sync (push) Waiting to run
Some checks are pending
sync2gitee / repo-sync (push) Waiting to run
This commit is contained in:
parent
b45095f7ec
commit
129d52dff2
|
|
@ -280,7 +280,10 @@ def bulk_create_in_batches(model, data, batch_size=1000):
|
|||
model.objects.bulk_create(batch)
|
||||
|
||||
|
||||
def get_sha256_hash(_v: str):
|
||||
def get_sha256_hash(_v: str | bytes):
|
||||
sha256 = hashlib.sha256()
|
||||
sha256.update(_v.encode())
|
||||
if isinstance(_v, str):
|
||||
sha256.update(_v.encode())
|
||||
else:
|
||||
sha256.update(_v)
|
||||
return sha256.hexdigest()
|
||||
|
|
|
|||
Loading…
Reference in New Issue