/usr/lib/python3/dist-packages/pyutilib/component/config/managed_plugin.py is in python3-pyutilib 5.3.5-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | # _________________________________________________________________________
#
# PyUtilib: A Python utility library.
# Copyright (c) 2008 Sandia Corporation.
# This software is distributed under the BSD License.
# Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
# the U.S. Government retains certain rights in this software.
# _________________________________________________________________________
"""Plugins that contain options that support configuration of their services."""
__all__ = ['ManagedPlugin', 'ManagedSingletonPlugin']
from pyutilib.component.config.options import *
class ManagedPlugin(Plugin):
"""A plugin that has an option supports configuration of this service."""
def __init__(self, **kwds):
Plugin.__init__(self,**kwds)
#super(ManagedPlugin,self).__init__(**kwds)
declare_option(name=self.name, section="Services", local_name="enable", default=self._enable, cls=BoolOption, doc="Option that controls behavior of service %s." % self.name)
def __del__(self):
# JPW: There has to be a better way to determine/cache the name of the option created in the
# constructor call. For example, declare_option might return the name of the created attribute.
# In the mean time, I have hard-coded the (known) name.
# clean up the attached BoolOption, which is a plugin - otherwise, a memory leak will result.
self._enable.deactivate()
class ManagedSingletonPlugin(SingletonPlugin):
"""A singleton plugin that has an option supports configuration of this service."""
def __init__(self, **kwds):
Plugin.__init__(self,**kwds)
#super(ManagedSingletonPlugin,self).__init__(**kwds)
declare_option(name=self.name, section="Services", local_name="enable", default=self._enable, cls=BoolOption, doc="Option that controls behavior of service %s." % self.name )
|