MCPcopy Create free account
hub / github.com/OpenBMB/ToolBench / __getitem__

Method __getitem__

toolbench/tooleval/evaluation/dataclass.py:242–257  ·  view source on GitHub ↗
(self, item)

Source from the content-addressed store, hash-verified

240
241
242 def __getitem__(self, item)->Union[ExecutionNode,DirectedEdge]:
243 if isinstance(item, GID):
244 return self.nodes[item]
245 elif isinstance(item, tuple) and len(item) == 2:
246 k1,k2 = item
247 if isinstance(k1,ExecutionNode):
248 k1 = k1.node_id
249 if isinstance(k2,ExecutionNode):
250 k2 = k2.node_id
251
252 if isinstance(k1,GID) and isinstance(k2,GID):
253 return self.edges[k1][k2]
254 else:
255 raise TypeError('key must be GID or ExecutionNode!')
256 else:
257 raise IndexError("Invalid number of arguments")
258
259 def __setitem__(self,key,value):
260 if len(key)==0:

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected