MCPcopy Create free account
hub / github.com/claw-bench/claw-bench / fix_missing_data_dir

Function fix_missing_data_dir

scripts/fix_task_bugs.py:25–50  ·  view source on GitHub ↗

Fix setup.sh that copies from non-existent data/ directory.

(apply: bool)

Source from the content-addressed store, hash-verified

23
24
25def fix_missing_data_dir(apply: bool):
26 """Fix setup.sh that copies from non-existent data/ directory."""
27 for setup in sorted(TASKS_ROOT.rglob("environment/setup.sh")):
28 task_dir = setup.parent.parent
29 data_dir = task_dir / "environment" / "data"
30 content = setup.read_text()
31
32 if not data_dir.exists() and ("data/" in content or "data\"" in content):
33 new_content = content
34 new_content = re.sub(
35 r'cp\s+.*?["\']?\$.*?/environment/data/["\']?\*?\s+.*?\n',
36 '', new_content
37 )
38 new_content = re.sub(
39 r'cp\s+-r?\s*.*?data/\*?\s+.*?\n',
40 '', new_content
41 )
42 new_content = re.sub(
43 r'cp\s+.*?"?\$\(dirname.*?\)/data/"?\*\s+.*?\n',
44 '', new_content
45 )
46 if new_content != content:
47 stats["data_dir"] += 1
48 if apply:
49 setup.write_text(new_content)
50 print(f" [data_dir] {task_dir.name}: removed broken cp from setup.sh")
51
52
53def fix_heredoc_fstring(apply: bool):

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected