def output(self,d,output_path=None):
"""method for outputing dictionary to the output_json file path after
validating it through the output_schema_type
Parameters
----------
d:dict
output dictionary to output
output_path: str
path to save to output file, optional (with default to self.mod['output_json'] location)
Raises
------
marshmallow.ValidationError
If any of the output dictionary doesn't meet the output schema
"""
if output_path is None:
output_path = self.args['output_json']
output_json = self.get_output_json(d)
with open(output_path,'w') as fp:
json.dump(output_json,fp)
评论列表
文章目录