plugins.py 文件源码

python
阅读 27 收藏 0 点赞 0 评论 0

项目:aniping 作者: kuruoujou 项目源码 文件源码
def scan_for_plugins(self):
        """Plugin scanner.

        Scans for plugins in the known plugin directories. Adds them to the
        available plugins dictionary, ready to be loaded.

        Returns:
            The available plugins dictionary.
        """
        _logger.debug("Scanning for plugins.")
        for category,info in CATEGORIES.items():
            _logger.debug("Scanning category {0}".format(category))
            for module in os.listdir(os.path.join(os.path.dirname(__file__),info["directory"])):
                if module == "__init__.py" or module[-3:] != ".py":
                    continue
                _logger.debug("\tFound plugin {0}".format(module[:-3]))
                importlib.import_module("aniping.{0}.{1}".format(info["directory"], module[:-3]))
                self._available_plugins[category].append(module[:-3])
        _logger.debug("All available plugins found.")
        return self._available_plugins
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号