Example #1
0
 def __deepcopy__(self, memo):
   if hasattr(self._EventObj_stuff.clazz, "__deepcopy__"):
     clone = self._EventObj_stuff.clazz.__deepcopy__(self, memo)
     if clone.__class__ is self.__class__:
       clone.__class__ = self._EventObj_stuff.clazz
     if hasattr(clone, "_EventObj_stuff"): del clone._EventObj_stuff
     return clone
   else:
     import copy
     
     if hasattr(self, '__getinitargs__'):
       args = self.__getinitargs__()
       copy._keep_alive(args, memo)
       args = copy.deepcopy(args, memo)
       return apply(self._EventObj_stuff.clazz, args)
     else:
       y = copy._EmptyClass()
       y.__class__ = self._EventObj_stuff.clazz
       memo[id(self)] = y
     if hasattr(self, '__getstate__'):
       state = self.__getstate__()
       copy._keep_alive(state, memo)
     else:
       state = self.__dict__
     state = copy.deepcopy(state, memo)
     if hasattr(y, '__setstate__'): y.__setstate__(state)
     else:                          y.__dict__.update(state)
     return y
Example #2
0
 def __copy__(self):
     """
     Simplified version of copy._copy_inst extended for copying
     _info and _catalog.
     """
     result = _EmptyClass()
     result.__class__ = self.__class__
     state = self.__dict__
     state['_info'] = self._info.copy()
     state['_catalog'] = self._catalog.copy()
     result.__dict__.update(state)
     return result
Example #3
0
 def __copy__(self):
     """
     Simplified version of copy._copy_inst extended for copying
     _info and _catalog.
     """
     result = _EmptyClass()
     result.__class__ = self.__class__
     state = self.__dict__
     state["_info"] = self._info.copy()
     state["_catalog"] = self._catalog.copy()
     result.__dict__.update(state)
     return result
Example #4
0
 def __copy__(self):
   if hasattr(self._EventObj_stuff.clazz, "__copy__"):
     clone = self._EventObj_stuff.clazz.__copy__(self)
     if clone.__class__ is self.__class__:
       clone.__class__ = self._EventObj_stuff.clazz
     if hasattr(clone, "_EventObj_stuff"): del clone._EventObj_stuff
     return clone
   else:
     import copy
     
     if hasattr(self, '__getinitargs__'):
       args = self.__getinitargs__()
       return apply(self._EventObj_stuff.clazz, args)
     else:
       y = copy._EmptyClass()
       y.__class__ = self._EventObj_stuff.clazz
     if hasattr(self, '__getstate__'):
       state = self.__getstate__()
     else:
       state = self.__dict__
     if hasattr(y, '__setstate__'): y.__setstate__(state)
     else:                          y.__dict__.update(state)
     return y