优化了检查体动标签正确性的代码
This commit is contained in:
@ -1368,13 +1368,7 @@ class Data:
|
||||
|
||||
try:
|
||||
# 检查体动标签正确性,长度
|
||||
if len(self.Artifact) % 4 != 0:
|
||||
return Result().failure(info=Constants.INPUT_FAILURE +
|
||||
Constants.FAILURE_REASON["Artifact_Format_Not_Correct"])
|
||||
for i in range(0, len(self.Artifact), 4):
|
||||
unit_data = self.Artifact[i:i + 4]
|
||||
if len(unit_data) < 4:
|
||||
break
|
||||
PublicFunc.examine_artifact(self.Artifact)
|
||||
self.Artifact = self.Artifact.reshape(-1, 4)
|
||||
except Exception as e:
|
||||
return Result().failure(info=Constants.INPUT_FAILURE +
|
||||
|
||||
@ -205,4 +205,15 @@ class PublicFunc:
|
||||
"path": str(path),
|
||||
"freq": int(freq)
|
||||
}
|
||||
return Result().success(data=data)
|
||||
return Result().success(data=data)
|
||||
|
||||
@staticmethod
|
||||
def examine_artifact(artifact):
|
||||
# 检查体动标签正确性,长度
|
||||
if len(artifact) % 4 != 0:
|
||||
return Result().failure(info=Constants.INPUT_FAILURE +
|
||||
Constants.FAILURE_REASON["Artifact_Format_Not_Correct"])
|
||||
for i in range(0, len(artifact), 4):
|
||||
unit_data = artifact[i:i + 4]
|
||||
if len(unit_data) < 4:
|
||||
break
|
||||
Reference in New Issue
Block a user