MCPcopy Create free account
hub / github.com/InternScience/SciReason / GenericRuntime

Class GenericRuntime

opencompass/lagent/actions/python_interpreter.py:13–30  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

11
12
13class GenericRuntime:
14 GLOBAL_DICT = {}
15 LOCAL_DICT = None
16 HEADERS = []
17
18 def __init__(self):
19 self._global_vars = copy.copy(self.GLOBAL_DICT)
20 self._local_vars = copy.copy(
21 self.LOCAL_DICT) if self.LOCAL_DICT else None
22
23 for c in self.HEADERS:
24 self.exec_code(c)
25
26 def exec_code(self, code_piece: str) -> None:
27 exec(code_piece, self._global_vars)
28
29 def eval_code(self, expr: str) -> Any:
30 return eval(expr, self._global_vars)
31
32
33DEFAULT_DESCRIPTION = """用来执行Python代码。代码必须是一个函数,

Callers 1

_callMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected