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

Function delete_old_scripts

codegen/codegen.py:59–70  ·  view source on GitHub ↗
(sources_dirname, func_name)

Source from the content-addressed store, hash-verified

57 return f"{function_name}_{variation}.py"
58
59def delete_old_scripts(sources_dirname, func_name):
60 dir_path = os.path.join(sources_dirname, func_name)
61 if os.path.exists(dir_path) and os.path.isdir(dir_path):
62 py_files = glob.glob(os.path.join(dir_path, "*.py"))
63
64 # Iterate through the list of .py files and delete them
65 for py_file in py_files:
66 try:
67 os.remove(py_file)
68 print(f"Deleted {py_file}")
69 except OSError as e:
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

Callers 1

write_codeMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected