Performance improvements: Default to copy for clone(), exception is ast.Block that uses deepcopy.
import inspect
-from copy import deepcopy
+from copy import copy, deepcopy
from calvin.requests import calvinresponse
@@ -88,7 +88,7 @@ class Node(object):
return True
def clone(self):
- x = deepcopy(self)
+ x = copy(self)
x.parent = None
return x
@@ -312,6 +312,11 @@ class Block(Node):
self.args = kwargs.get('args', {})
self.add_children(kwargs.get('program', []))
+ def clone(self):
+ x = deepcopy(self)
+ x.parent = None
+ return x
+
class Component(Node):
"""docstring for ComponentNode"""
def __init__(self, **kwargs):
