def __init__(self, default_preference=[]): self.plugins = dict() self.all_names = [x.name for x in IPlugin.__subclasses__()] self.changed = True self._force_backend = None self.preference = [] self.default_preference = default_preference self._backend = None
def get_valid_plugin_by_name(self, name): if name not in self.plugins: ls = filter(lambda x: x.name == name, IPlugin.__subclasses__()) if len(ls): try: plugin = ls[0]() except Exception: plugin = None else: plugin = None self.plugins[name] = plugin return self.plugins[name]
def plugin_classes(self): return IPlugin.__subclasses__()