コード例 #1
0
 def __deepcopy__(self, memo):
     '''
     Deepcopy the object. If `DontCopyPersistent` is given, only mock-copy.
     
     When this method receieves an instance of `DontCopyPersistent` as a
     memo dictionary, it will not actually deepcopy the object but only
     return a reference to the original object.
     '''
     if isinstance(memo, DontCopyPersistent):
         memo[id(self)] = self
         return self
     else:
         new_copy = copy_tools.deepcopy_as_simple_object(self, memo)
         return new_copy
コード例 #2
0
ファイル: persistent.py プロジェクト: ofri/GarlicSim
 def __deepcopy__(self, memo):
     '''
     Deepcopy the object. If DontCopyPersistent is given, only mock-copy.
     
     When this method receieves an instance of DontCopyPersistent as a memo
     dictionary, it will not actually deepcopy the object but only return a
     reference to the original object.
     '''
     if isinstance(memo, DontCopyPersistent):
         memo[id(self)] = self
         return self
     else:
         new_copy = copy_tools.deepcopy_as_simple_object(self, memo)
         return new_copy
コード例 #3
0
 def __deepcopy__(self, memo):
     '''
     Deepcopy the object. If DontCopyPersistent is given, only mock-copy.
     
     When this method receieves an instance of DontCopyPersistent as a memo
     dictionary, it will not actually deepcopy the object but only return a
     reference to the original object.
     '''
     if isinstance(memo, DontCopyPersistent):
         memo[id(self)] = self
         return self
     else:
         new_copy = copy_tools.deepcopy_as_simple_object(self, memo)
         new_copy._Persistent__uuid = uuid.uuid4()
         if hasattr(new_copy, '_CrossProcessPersistent__personality'):
             del new_copy._Persistent__personality
         return new_copy
コード例 #4
0
 def __deepcopy__(self, memo):
     '''
     Deepcopy the object. If `DontCopyPersistent` is given, only mock-copy.
     
     When this method receieves an instance of `DontCopyPersistent` as a
     memo dictionary, it will not actually `deepcopy` the object but only
     return a reference to the original object.
     '''
     if isinstance(memo, DontCopyPersistent):
         memo[id(self)] = self
         return self
     else:
         new_copy = copy_tools.deepcopy_as_simple_object(self, memo)
         new_copy._Persistent__uuid = uuid.uuid4()
         try:
             del self.personality
         except AttributeError:
             pass
         return new_copy
コード例 #5
0
 def __deepcopy__(self, memo):
     '''
     Deepcopy the object. If `DontCopyPersistent` is given, only mock-copy.
     
     When this method receieves an instance of `DontCopyPersistent` as a
     memo dictionary, it will not actually `deepcopy` the object but only
     return a reference to the original object.
     '''
     if isinstance(memo, DontCopyPersistent):
         memo[id(self)] = self
         return self
     else:
         new_copy = copy_tools.deepcopy_as_simple_object(self, memo)
         new_copy._Persistent__uuid = uuid.uuid4()
         try:
             del self.personality
         except AttributeError:
             pass
         return new_copy