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

Method _add_node_copy

pattern/graph/__init__.py:540–550  ·  view source on GitHub ↗
(self, n, **kwargs)

Source from the content-addressed store, hash-verified

538 if n.contains(x, y): return n
539
540 def _add_node_copy(self, n, **kwargs):
541 # Magical fairy dust to copy subclasses of Node.
542 # We assume that the subclass constructor takes an optional "text" parameter
543 # (Text objects in NodeBox for OpenGL's implementation are expensive).
544 try:
545 new = self.add_node(n.id, root=kwargs.get("root",False), text=False)
546 except TypeError:
547 new = self.add_node(n.id, root=kwargs.get("root",False))
548 new.__class__ = n.__class__
549 new.__dict__.update((k, deepcopy(v)) for k,v in n.__dict__.iteritems()
550 if k not in ("graph", "links", "_x", "_y", "force", "_weight", "_centrality"))
551
552 def _add_edge_copy(self, e, **kwargs):
553 if kwargs.get("node1", e.node1).id not in self \

Callers 1

copyMethod · 0.95

Calls 5

add_nodeMethod · 0.95
deepcopyFunction · 0.85
iteritemsMethod · 0.80
getMethod · 0.45
updateMethod · 0.45

Tested by

no test coverage detected