MCPcopy Index your code
hub / github.com/clips/pattern / Links

Class Links

pattern/graph/__init__.py:202–220  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

200 return not self.__eq__(node)
201
202class Links(list):
203
204 def __init__(self):
205 """ A list in which each node has an associated edge.
206 The edge() method returns the edge for a given node id.
207 """
208 self.edges = dict()
209
210 def append(self, node, edge=None):
211 if node.id not in self.edges:
212 list.append(self, node)
213 self.edges[node.id] = edge
214
215 def remove(self, node):
216 list.remove(self, node)
217 self.edges.pop(node.id, None)
218
219 def edge(self, node):
220 return self.edges.get(isinstance(node, Node) and node.id or node)
221
222#--- EDGE ------------------------------------------------------------------------------------------
223

Callers 1

__init__Method · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…