MCPcopy Create free account
hub / github.com/Speakn0w/RealChart2Code / parse_task_file

Function parse_task_file

RealChart2Code_eval/evaluate_task2.py:92–115  ·  view source on GitHub ↗
(task_file: Path)

Source from the content-addressed store, hash-verified

90 return data_files
91
92def parse_task_file(task_file: Path) -> Tuple[str, str, List[str]]:
93
94 with open(task_file, 'r', encoding='utf-8') as f:
95 content = f.read()
96
97
98 category_match = re.search(r'## Category\s*\n(.+)', content)
99 category = category_match.group(1).strip() if category_match else ""
100
101
102 instruction_match = re.search(r'## Instruction\s*\n(.+?)(?=\n##|\n---|$)', content, re.DOTALL)
103 instruction = instruction_match.group(1).strip() if instruction_match else ""
104
105
106 files_match = re.search(r'## Files\s*\n(.+?)(?=\n##|\n---|$)', content, re.DOTALL)
107 files_text = files_match.group(1).strip() if files_match else ""
108
109 data_files = []
110 for f in files_text.split('\n'):
111 f = f.strip()
112 if f and (f.endswith('.csv') or f.endswith('.xlsx')):
113 data_files.append(f)
114
115 return category, instruction, data_files
116
117
118def find_data_files(directory: Path, filenames: List[str]) -> Dict[str, Path]:

Callers 1

prepare_task_infoFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected