MCPcopy Create free account
hub / github.com/aaPanel/BaoTa / new_by_data

Method new_by_data

mod/project/node/nodeutil/base.py:159–181  ·  view source on GitHub ↗
(cls, node_data: dict)

Source from the content-addressed store, hash-verified

157
158 @classmethod
159 def new_by_data(cls, node_data: dict):
160 if node_data["api_key"] == "local" and node_data["app_key"] == "local":
161 return LocalNode()
162
163 if node_data['lpver']:
164 lp = LPanelNode(
165 address=node_data['address'],
166 api_key=node_data['api_key'],
167 lpver=node_data['lpver'],
168 timeout=node_data.get('timeout', 20)
169 )
170 lp.remarks = node_data['remarks']
171 return lp
172 if not node_data["api_key"] and not node_data["app_key"]:
173 return None
174
175 return cls(
176 origin=node_data['address'],
177 api_key=node_data['api_key'],
178 app_key=node_data['app_key'],
179 remarks=node_data['remarks'],
180 timeout=node_data.get('timeout', 20)
181 )
182
183 def show_name(self) -> str:
184 if self.remarks:

Callers 3

file_dstpath_checkMethod · 0.80
new_by_idMethod · 0.80

Calls 3

LocalNodeClass · 0.85
LPanelNodeClass · 0.85
getMethod · 0.45

Tested by

no test coverage detected