MCPcopy Create free account
hub / github.com/deepseek-ai/DeepSeek-Coder / extract_python_block_with_solution

Function extract_python_block_with_solution

Evaluation/PAL-Math/run.py:13–24  ·  view source on GitHub ↗

Extract the code block from the text that contains the solution function. :param text: The text to search for the code block. :return: The extracted code block.

(text)

Source from the content-addressed store, hash-verified

11
12
13def extract_python_block_with_solution(text):
14 """
15 Extract the code block from the text that contains the solution function.
16 :param text: The text to search for the code block.
17 :return: The extracted code block.
18 """
19 pattern = r'```python\n(.*?)def solution\(\):\n(.*?)```'
20 match = re.search(pattern, text, re.DOTALL)
21 if match:
22 return match.group(1) + 'def solution():\n' + match.group(2)
23 else:
24 return ""
25
26def load_data(args):
27 """

Callers 1

inferenceFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected