MCPcopy Create free account
hub / github.com/catid/supercharger / write_script_to_disk

Function write_script_to_disk

codegen/codegen.py:72–80  ·  view source on GitHub ↗
(code, sources_dirname, func_name, is_test=False, variation=0)

Source from the content-addressed store, hash-verified

70 print(f"Error deleting {py_file}: {e}")
71
72def write_script_to_disk(code, sources_dirname, func_name, is_test=False, variation=0):
73 # Create the directory if it doesn't exist
74 dir_path = os.path.join(sources_dirname, func_name)
75 os.makedirs(dir_path, exist_ok=True)
76
77 # Write the script to the file
78 file_path = os.path.join(dir_path, get_script_name_from_function_name(func_name, is_test, variation))
79 with open(file_path, "w") as f:
80 f.write(code)
81
82def copy_candidate_scripts(source_dir, function_name, code_id, test_id):
83 code_source_path = os.path.join(source_dir, function_name, get_script_name_from_function_name(function_name, is_test=False, variation=code_id))

Callers 2

handle_codeMethod · 0.85
handle_testMethod · 0.85

Calls 1

Tested by

no test coverage detected