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

Function extract_python_code

RealChart2Code_eval/evaluate_task3.py:309–323  ·  view source on GitHub ↗
(response: str)

Source from the content-addressed store, hash-verified

307
308
309def extract_python_code(response: str) -> str:
310
311 pattern = r'```python\s*\n(.*?)\n```'
312 matches = re.findall(pattern, response, re.DOTALL)
313
314 if matches:
315 return matches[0].strip()
316
317 pattern = r'```\s*\n(.*?)\n```'
318 matches = re.findall(pattern, response, re.DOTALL)
319
320 if matches:
321 return matches[0].strip()
322
323 return ""
324
325
326def preprocess_code_paths(code_content: str, data_directory: Path) -> str:

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected