👍️[Update] Model : status 348のlog を printLog関数に集約

This commit is contained in:
misyaguziya
2024-09-01 17:33:22 +09:00
parent 8f2c81a7d7
commit 4c2e4a6e04
7 changed files with 159 additions and 143 deletions

View File

@@ -1,3 +1,5 @@
from typing import Any
import json
import random
from typing import Union
from os import path as os_path, rename as os_rename
@@ -69,4 +71,15 @@ def splitList(lst:list, split_count:int, to_shuffle:bool=False):
for i in range(0, len(lst), split_count):
sub_list = lst[i:i+split_count]
split_lists.append(sub_list)
return split_lists
return split_lists
def encodeUtf8(data:str) -> dict:
data = {i: byte for i, byte in enumerate(data.encode('UTF-8'))}
return data
def decodeUtf8(data:dict) -> str:
data = bytes(data.values()).decode("UTF-8")
return data
def printLog(log:str, data:Any=None) -> None:
print(json.dumps({"status":348, "log":log, "data":str(data)}), flush=True)