|
""" |
|
This module provides functionality to clean up benchmark directories by removing |
|
all files and folders except for 'prompt' and 'main_prompt'. |
|
""" |
|
|
|
|
|
|
|
|
|
import os |
|
import shutil |
|
|
|
from pathlib import Path |
|
|
|
from typer import run |
|
|
|
|
|
def main(): |
|
""" |
|
Main function that iterates through all directories in the 'benchmark' folder |
|
and cleans them by removing all files and directories except for 'prompt' and |
|
'main_prompt'. |
|
""" |
|
|
|
benchmarks = Path("benchmark") |
|
|
|
for benchmark in benchmarks.iterdir(): |
|
if benchmark.is_dir(): |
|
print(f"Cleaning {benchmark}") |
|
for path in benchmark.iterdir(): |
|
if path.name in ["prompt", "main_prompt"]: |
|
continue |
|
|
|
|
|
if path.is_dir(): |
|
|
|
shutil.rmtree(path) |
|
else: |
|
|
|
os.remove(path) |
|
|
|
|
|
if __name__ == "__main__": |
|
run(main) |
|
|