MCPcopy Create free account
hub / github.com/AMAP-ML/Thinking-with-Map / __init__

Method __init__

demo/qwen_agent/tools/python_executor.py:110–127  ·  view source on GitHub ↗
(self, cfg: Optional[Dict] = None)

Source from the content-addressed store, hash-verified

108 }
109
110 def __init__(self, cfg: Optional[Dict] = None):
111 _check_deps_for_python_executor()
112 import multiprocess
113 from multiprocess import Pool
114 super().__init__(cfg)
115
116 runtime: Optional[Any] = self.cfg.get('runtime', None)
117 get_answer_symbol: Optional[str] = self.cfg.get('get_answer_symbol', None)
118 get_answer_expr: Optional[str] = self.cfg.get('get_answer_expr', None)
119 get_answer_from_stdout: bool = self.cfg.get('get_answer_from_stdout', True)
120 timeout_length: int = self.cfg.get('timeout_length', 20)
121
122 self.runtime = runtime if runtime else GenericRuntime()
123 self.answer_symbol = get_answer_symbol
124 self.answer_expr = get_answer_expr
125 self.get_answer_from_stdout = get_answer_from_stdout
126 self.pool = Pool(multiprocess.cpu_count())
127 self.timeout_length = timeout_length
128
129 def call(self, params: Union[str, dict], **kwargs) -> list:
130 try:

Callers

nothing calls this directly

Calls 4

GenericRuntimeClass · 0.85
__init__Method · 0.45
getMethod · 0.45

Tested by

no test coverage detected