def load(self, file):
try:
tree = json.load(io.TextIOWrapper(file, encoding='utf8'))
tree = Audit.SCHEMA.validate(tree)
self.__artifact = Artifact.fromData(tree["artifact"])
self.__references = {
r["artifact-id"] : Artifact.fromData(r) for r in tree["references"]
}
except schema.SchemaError as e:
raise ParseError("Invalid audit record: " + str(e))
except ValueError as e:
raise ParseError("Invalid json: " + str(e))
self.__validate()
评论列表
文章目录