callanwu commited on
Commit
487e5ab
·
verified ·
1 Parent(s): 3a9149d

Update tool_python.py

Browse files
Files changed (1) hide show
  1. tool_python.py +10 -10
tool_python.py CHANGED
@@ -69,17 +69,17 @@ class PythonInterpreter(BaseToolWithFileAccess):
69
  # super().call(params=params, files=files) # copy remote files to work_dir
70
  try:
71
  code=params.split('<code>')[1].split('</code')[0]
72
- print(params)
73
- if type(params) is str:
74
- params = json5.loads(params)
75
- code = params.get('code', '')
76
- if not code:
77
- code = params.get('raw', '')
78
- triple_match = re.search(r'```[^\n]*\n(.+?)```', code, re.DOTALL)
79
- if triple_match:
80
- code = triple_match.group(1)
81
  except Exception:
82
- code = extract_code(params)
83
 
84
  if not code.strip():
85
  return '[Python Interpreter Error]: Empty code.'
 
69
  # super().call(params=params, files=files) # copy remote files to work_dir
70
  try:
71
  code=params.split('<code>')[1].split('</code')[0]
72
+ # print(params)
73
+ # if type(params) is str:
74
+ # params = json5.loads(params)
75
+ # code = params.get('code', '')
76
+ # if not code:
77
+ # code = params.get('raw', '')
78
+ # triple_match = re.search(r'```[^\n]*\n(.+?)```', code, re.DOTALL)
79
+ # if triple_match:
80
+ # code = triple_match.group(1)
81
  except Exception:
82
+ # return '[Python Interpreter Error]: format error.'
83
 
84
  if not code.strip():
85
  return '[Python Interpreter Error]: Empty code.'