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

Function extract_python_code

RealChart2Code_eval/evaluate_task2.py:269–283  ·  view source on GitHub ↗
(response: str)

Source from the content-addressed store, hash-verified

267
268
269def extract_python_code(response: str) -> str:
270
271 pattern = r'```python\s*\n(.*?)\n```'
272 matches = re.findall(pattern, response, re.DOTALL)
273
274 if matches:
275 return matches[0].strip()
276
277 pattern = r'```\s*\n(.*?)\n```'
278 matches = re.findall(pattern, response, re.DOTALL)
279
280 if matches:
281 return matches[0].strip()
282
283 return ""
284
285
286def preprocess_code_paths(code_content: str, data_directory: Path) -> str:

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected