Fix CodeTask execute
Browse files- components.py +6 -10
components.py
CHANGED
@@ -260,18 +260,16 @@ Extract it. Remove anything after the function definition.""",
|
|
260 |
):
|
261 |
if not function:
|
262 |
return None
|
|
|
263 |
|
264 |
import inspect
|
|
|
|
|
265 |
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
for p in eval(packages):
|
271 |
-
print(f"Installing {p}")
|
272 |
-
subprocess.check_call([sys.executable, "-m", "pip", "install", p])
|
273 |
|
274 |
-
function = function.strip()
|
275 |
function = f"import os\nos.environ = {{}}\n\n{function}"
|
276 |
exec(function, locals())
|
277 |
# Looking for the last defined function
|
@@ -287,10 +285,8 @@ Extract it. Remove anything after the function definition.""",
|
|
287 |
except:
|
288 |
pass
|
289 |
if formatted_input:
|
290 |
-
install()
|
291 |
return self._toolkit_func(formatted_input)
|
292 |
return None
|
293 |
-
install()
|
294 |
return self._toolkit_func()
|
295 |
|
296 |
|
|
|
260 |
):
|
261 |
if not function:
|
262 |
return None
|
263 |
+
function = function.strip()
|
264 |
|
265 |
import inspect
|
266 |
+
import subprocess
|
267 |
+
import sys
|
268 |
|
269 |
+
for p in eval(packages):
|
270 |
+
print(f"Installing")
|
271 |
+
subprocess.check_call([sys.executable, "-m", "pip", "install", p])
|
|
|
|
|
|
|
|
|
272 |
|
|
|
273 |
function = f"import os\nos.environ = {{}}\n\n{function}"
|
274 |
exec(function, locals())
|
275 |
# Looking for the last defined function
|
|
|
285 |
except:
|
286 |
pass
|
287 |
if formatted_input:
|
|
|
288 |
return self._toolkit_func(formatted_input)
|
289 |
return None
|
|
|
290 |
return self._toolkit_func()
|
291 |
|
292 |
|