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

Function extract_python_code

RealChart2Code_eval/evaluate_task1.py:277–291  ·  view source on GitHub ↗
(response: str)

Source from the content-addressed store, hash-verified

275
276
277def extract_python_code(response: str) -> str:
278
279 pattern = r'```python\s*\n(.*?)\n```'
280 matches = re.findall(pattern, response, re.DOTALL)
281
282 if matches:
283 return matches[0].strip()
284
285 pattern = r'```\s*\n(.*?)\n```'
286 matches = re.findall(pattern, response, re.DOTALL)
287
288 if matches:
289 return matches[0].strip()
290
291 return ""
292
293
294def preprocess_code_paths(code_content: str, data_directory: Path) -> str:

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected