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

Function parse_task_file

RealChart2Code_eval/evaluate_task1.py:99–122  ·  view source on GitHub ↗
(task_file: Path)

Source from the content-addressed store, hash-verified

97
98
99def parse_task_file(task_file: Path) -> Tuple[str, str, List[str]]:
100
101 with open(task_file, 'r', encoding='utf-8') as f:
102 content = f.read()
103
104
105 category_match = re.search(r'## Category\s*\n(.+)', content)
106 category = category_match.group(1).strip() if category_match else ""
107
108
109 instruction_match = re.search(r'## Instruction\s*\n(.+?)(?=\n##|\n---|$)', content, re.DOTALL)
110 instruction = instruction_match.group(1).strip() if instruction_match else ""
111
112
113 files_match = re.search(r'## Files\s*\n(.+?)(?=\n##|\n---|$)', content, re.DOTALL)
114 files_text = files_match.group(1).strip() if files_match else ""
115
116 data_files = []
117 for f in files_text.split('\n'):
118 f = f.strip()
119 if f and (f.endswith('.csv') or f.endswith('.xlsx')):
120 data_files.append(f)
121
122 return category, instruction, data_files
123
124
125def 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