Trees | Indices | Help |
|
---|
|
1 ############################################################################### 2 # # 3 # Copyright (C) 2007-2003 Edward d'Auvergne # 4 # # 5 # This file is part of the program relax (http://www.nmr-relax.com). # 6 # # 7 # This program is free software: you can redistribute it and/or modify # 8 # it under the terms of the GNU General Public License as published by # 9 # the Free Software Foundation, either version 3 of the License, or # 10 # (at your option) any later version. # 11 # # 12 # This program is distributed in the hope that it will be useful, # 13 # but WITHOUT ANY WARRANTY; without even the implied warranty of # 14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # 15 # GNU General Public License for more details. # 16 # # 17 # You should have received a copy of the GNU General Public License # 18 # along with this program. If not, see <http://www.gnu.org/licenses/>. # 19 # # 20 ############################################################################### 21 22 # Module docstring. 23 """Module containing the Prototype base class for the molecule-residue-spin containers.""" 24 25 26 # Python module imports. 27 from copy import deepcopy 28 from re import search 29 3032 """Base class implementing the prototype design pattern.""" 336535 """Replacement deepcopy method.""" 36 37 # Make a new object. 38 new_obj = self.__class__.__new__(self.__class__) 39 40 # Loop over all objects in self and make deepcopies of them. 41 for name in dir(self): 42 # Skip all names begining with '__'. 43 if search('^__', name): 44 continue 45 46 # Skip the class methods. 47 if name in list(self.__class__.__dict__.keys()): 48 continue 49 50 # Get the object. 51 value = getattr(self, name) 52 53 # Replace the object with a deepcopy of it. 54 setattr(new_obj, name, deepcopy(value, memo)) 55 56 # Return the new object. 57 return new_obj58 59
Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0.1 on Thu Jul 3 13:38:50 2014 | http://epydoc.sourceforge.net |