MCPcopy Index your code
hub / github.com/going-doer/Paper2Code / content_to_json

Function content_to_json

codes/utils.py:26–42  ·  view source on GitHub ↗
(data)

Source from the content-addressed store, hash-verified

24
25
26def content_to_json(data):
27 clean_data = re.sub(r'\[CONTENT\]|\[/CONTENT\]', '', data).strip()
28
29 clean_data = re.sub(r'(".*?"),\s*#.*', r'\1,', clean_data)
30
31 clean_data = re.sub(r',\s*\]', ']', clean_data)
32
33 clean_data = re.sub(r'\n\s*', '', clean_data)
34
35
36 # JSON parsing
37 try:
38 json_data = json.loads(clean_data)
39 return json_data
40 except json.JSONDecodeError as e:
41 # print(e)
42 return content_to_json2(data)
43
44
45def content_to_json2(data):

Callers 8

mainFunction · 0.90
3.1_coding_sh.pyFile · 0.90
2_analyzing_llm.pyFile · 0.90
4_debugging.pyFile · 0.90
2_analyzing.pyFile · 0.90
3_coding.pyFile · 0.90
3_coding_llm.pyFile · 0.90

Calls 1

content_to_json2Function · 0.85

Tested by

no test coverage detected