MCPcopy Create free account
hub / github.com/InternLM/InternBootcamp / parse_python_code

Function parse_python_code

verl/agentic_workflow/utils.py:4–12  ·  view source on GitHub ↗
(text_with_code_block: str)

Source from the content-addressed store, hash-verified

2from typing import Optional
3
4def parse_python_code(text_with_code_block: str) -> Optional[str]:
5 pattern = re.compile(r"```python\s*\n(.*?)\n\s*```", re.DOTALL)
6
7 match = pattern.search(text_with_code_block)
8
9 if match:
10 return match.group(1).strip()
11
12 return None
13
14def parse_yaml_code(text_with_code_block: str) -> Optional[str]:
15 pattern = re.compile(r"```yaml\s*\n(.*?)\n\s*```", re.DOTALL)

Callers 1

main.pyFile · 0.90

Calls 1

searchMethod · 0.80

Tested by

no test coverage detected