From 70cc6bb182245d20c54afba79a265ef40f1ed080 Mon Sep 17 00:00:00 2001 From: "Chris St. Pierre" Date: Mon, 25 Mar 2013 11:39:50 -0400 Subject: Revert "Packages: properly implemented deepcopy() for PackagesSources objects" This reverts commit 432f448983ff27452d82d62314d91c942f31bce5. --- src/lib/Bcfg2/Server/Plugin/helpers.py | 33 --------------------------------- 1 file changed, 33 deletions(-) (limited to 'src/lib/Bcfg2/Server/Plugin') diff --git a/src/lib/Bcfg2/Server/Plugin/helpers.py b/src/lib/Bcfg2/Server/Plugin/helpers.py index 93f690e18..0b81077a3 100644 --- a/src/lib/Bcfg2/Server/Plugin/helpers.py +++ b/src/lib/Bcfg2/Server/Plugin/helpers.py @@ -1601,36 +1601,3 @@ class GroupSpool(Plugin, Generator): return reqid = self.core.fam.AddMonitor(name, self) self.handles[reqid] = relative - - -class DeepcopyMixin(object): - """ Mixin that adds a __deepcopy__() function that tries to do the - right thing by: - - #. Creating a new object of the same type by calling the - constructor with the arguments returned by - :func:`Bcfg2.Server.Plugin.helpers.DeepcopyMixin._deepcopy_constructor_args`; - #. Individually copying each attribute of the original object that - a) is not magical (``__whatever__``); b) is not callable; c) is - not a property; and d) is not in - :attr:`Bcfg2.Server.Plugin.helpers.DeepcopyMixin._deepcopy_exclude`. - """ - - #: Exclude the named attributes from the copy. - _deepcopy_exclude = ["fam", "logger", "setup"] - - def _deepcopy_constructor_args(self): - """ Get a tuple of arguments that will be passed to the - constructor of this class to create a base object before the - individual attributes are deepcopied. """ - raise NotImplementedError - - def __deepcopy__(self, memo): - rv = self.__class__(*self._deepcopy_constructor_args()) - for attr in dir(self): - if (not callable(getattr(self, attr)) and - (not attr.startswith("__") or not attr.endswith("__")) and - attr not in self._deepcopy_exclude and - not isinstance(getattr(self.__class__, attr, None), property)): - setattr(rv, attr, copy.deepcopy(getattr(self, attr), memo)) - return rv -- cgit v1.2.3-1-g7c22