plugins.py 文件源码

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

项目:SuperOcto 作者: mcecchi 项目源码 文件源码
def _get_commands(self):
        """Fetch all commands from plugins providing any."""

        import collections
        result = collections.OrderedDict()

        for name, hook in self.hooks.items():
            try:
                commands = hook(self, pass_octoprint_ctx)
                for command in commands:
                    if not isinstance(command, click.Command):
                        self._logger.warn("Plugin {} provided invalid CLI command, ignoring it: {!r}".format(name, command))
                        continue
                    result[name + self.sep + command.name] = command
            except:
                self._logger.exception("Error while retrieving cli commants for plugin {}".format(name))

        return result
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号