(o)
| 60 | #--- NODE ------------------------------------------------------------------------------------------ |
| 61 | |
| 62 | def 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 | |
| 77 | class Node(object): |
| 78 |
searching dependent graphs…