commands_collector.py 文件源码

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

项目:quokka_ng 作者: rochacbruno 项目源码 文件源码
def get_command(self, ctx, name):
        try:
            if sys.version_info[0] == 2:
                name = name.encode('ascii', 'replace')
            splitted = name.split('_')
            if len(splitted) <= 1:
                return
            module_name, command_name = splitted
            if not all([module_name, command_name]):
                return
            module = '{0}.{1}.commands.{2}'.format(
                self.base_module_name,
                module_name,
                command_name)
            mod = importlib.import_module(module)
        except ImportError:
            return
        return getattr(mod, 'cli', None)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号