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

Function deepcopy

pattern/graph/__init__.py:62–75  ·  view source on GitHub ↗
(o)

Source from the content-addressed store, hash-verified

60#--- NODE ------------------------------------------------------------------------------------------
61
62def deepcopy(o):
63 # A color can be represented as a tuple or as a nodebox.graphics.Color object,
64 # in which case it needs to be copied by invoking Color.copy().
65 if o is None:
66 return o
67 if hasattr(o, "copy"):
68 return o.copy()
69 if isinstance(o, (basestring, bool, int, float, long, complex)):
70 return o
71 if isinstance(o, (list, tuple, set)):
72 return o.__class__(deepcopy(v) for v in o)
73 if isinstance(o, dict):
74 return dict((deepcopy(k), deepcopy(v)) for k,v in o.iteritems())
75 raise Exception, "don't know how to copy %s" % o.__class__.__name__
76
77class Node(object):
78

Callers 3

testDeepcopyMethod · 0.85
_add_node_copyMethod · 0.85
_add_edge_copyMethod · 0.85

Calls 2

iteritemsMethod · 0.80
copyMethod · 0.45

Tested by 1

testDeepcopyMethod · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…