def script_write(script, args, filepath=None): # insert fields into json json_set_fields(script, args) # insert variables into instructions json_set_instructions(script, args) # insert variables into description json_set_description(script, args) # produce output or run task if filepath: with open(filepath, 'w') as data_file: data_file.write(json.dumps(script, indent=2)) print('JSON Written To: ', filepath) else: print(json.dumps(script, indent=2))
def get_instructions(self, constants={}): json_set_instructions(self.script, constants) return self.script['script'].get('instructions', [])