(cls, node_data: dict)
| 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: |
no test coverage detected