MCPcopy Index your code
hub / github.com/Tencent/CodeAnalysis / check_tool_usable

Method check_tool_usable

client/task/taskmgr.py:97–121  ·  view source on GitHub ↗

检查task可行性,具体内容: 1. 检查工具封装代码文件是否存在 2. 调用tool.py中的check函数进行具体的检查 :param tool_name: :param task_params: :return: 支持该工具的task类型数组,若不支持返回空数组

(tool_name, task_params)

Source from the content-addressed store, hash-verified

95
96 @staticmethod
97 def check_tool_usable(tool_name, task_params):
98 """
99 检查task可行性,具体内容:
100 1. 检查工具封装代码文件是否存在
101 2. 调用tool.py中的check函数进行具体的检查
102 :param tool_name:
103 :param task_params:
104 :return: 支持该工具的task类型数组,若不支持返回空数组
105 """
106 try:
107 tool_model = __import__("tool." + tool_name)
108 except ModuleNotFoundError:
109 # logger.exception("不是内置工具,使用自定义工具模块.")
110 tool_model = __import__("tool.customtool")
111 tool_name = "customtool"
112
113 tool = getattr(tool_model, tool_name).tool(task_params)
114 tool_params = task_params.get("checktool")
115 if tool_name == "customtool":
116 tool_usable_set = tool.check_tool_usable(task_params)
117 else:
118 tool_usable_set = tool.check_tool_usable(tool_params)
119 # puppy默认能执行所有的结果处理
120 tool_usable_set.append('datahandle')
121 return tool_usable_set
122
123 @staticmethod
124 def get_private_processes(tool_name):

Callers

nothing calls this directly

Calls 1

getMethod · 0.45

Tested by

no test coverage detected