MCPcopy
hub / github.com/zai-org/GLM-4 / execute

Method execute

demo/composite_demo/src/tools/python.py:63–81  ·  view source on GitHub ↗
(self, code)

Source from the content-addressed store, hash-verified

61 print("Code kernel started.")
62
63 def execute(self, code):
64 self.kernel.execute(code)
65 try:
66 shell_msg = self.kernel.get_shell_msg(timeout=30)
67 io_msg_content = self.kernel.get_iopub_msg(timeout=30)["content"]
68 while True:
69 msg_out = io_msg_content
70 ### Poll the message
71 try:
72 io_msg_content = self.kernel.get_iopub_msg(timeout=30)["content"]
73 if "execution_state" in io_msg_content and io_msg_content["execution_state"] == "idle":
74 break
75 except queue.Empty:
76 break
77
78 return shell_msg, msg_out
79 except Exception as e:
80 print(e)
81 return None
82
83 def execute_interactive(self, code, verbose=False):
84 shell_msg = self.kernel.execute_interactive(code)

Callers 1

executeFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected