| import re | |
| import os | |
| files = [ | |
| "task_conditional_count.py", | |
| "task_conditional_duration.py", | |
| "task_between_events.py", | |
| "task_event_density.py", | |
| "task_duration_gap.py", | |
| "task_temporal_arithmetic.py", | |
| "task_temporal_loudness.py", | |
| "task_multi_hop.py" | |
| ] | |
| for filename in files: | |
| with open(filename, 'r') as f: | |
| content = f.read() | |
| # Remove random.choice() around self.task_config["mcq_questions"]... | |
| content = re.sub(r'random\.choice\(\s*(self\.task_config\[(?:\"|\')mcq_questions(?:\"|\')\]\[[^\]]+\])\s*\)', r'\1', content) | |
| content = re.sub(r'random\.choice\(\s*(self\.task_config\[(?:\"|\')open_text_questions(?:\"|\')\]\[[^\]]+\])\s*\)', r'\1', content) | |
| with open(filename, 'w') as f: | |
| f.write(content) | |
| print("Fixed files") | |