def loadplugins(plugindir=None, namespace="plugins"):
""" Load all of the modules from the plugins directory and instantiate the
classes within. """
if plugindir == None:
plugindir = os.path.join(os.path.dirname(os.path.abspath(__file__)), "plugins")
analytics = []
for _, x, _ in pkgutil.iter_modules([plugindir]):
m1 = __import__('supremm.' + namespace + '.' + x)
m = getattr(m1, namespace)
m = getattr(m, x)
c = getattr(m, x)
if issubclass(c, Plugin) or issubclass(c, PreProcessor):
analytics.append(c)
else:
del m1
return analytics
评论列表
文章目录