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

Function _clean_python_code_for_sft

Evaluation/MBPP/utils/utils.py:24–32  ·  view source on GitHub ↗
(code)

Source from the content-addressed store, hash-verified

22 return code
23
24def _clean_python_code_for_sft(code):
25 code = code.replace("\r", "")
26 if "```python" in code:
27 code_start_idx = code.index("```python")
28 code = code[code_start_idx:].replace("```python", "").strip()
29 end_idx = code.find("```") if "```" in code else len(code)
30 code = code[:end_idx].strip()
31
32 return code
33
34def _truncate_code_at_stopwords(code, stop_words):
35 min_stop_idx = len(code)

Callers 1

cleanup_codeFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected