manager.py 文件源码

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

项目:gluster-integration 作者: Tendrl 项目源码 文件源码
def list_modules_in_package_path(self, package_path, prefix):
        modules = []
        path_to_walk = [(package_path, prefix)]
        while len(path_to_walk) > 0:
            curr_path, curr_prefix = path_to_walk.pop()
            for importer, name, ispkg in pkgutil.walk_packages(
                path=[curr_path]
            ):
                if ispkg:
                    path_to_walk.append(
                        (
                            '%s/%s/' % (curr_path, name),
                            '%s.%s' % (curr_prefix, name)
                        )
                    )
                else:
                    modules.append((name, '%s.%s' % (curr_prefix, name)))
        return modules
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号