module.py 文件源码

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

项目:swarm 作者: a7vinx 项目源码 文件源码
def get_modules():
    """
    Returns:
        return a list consist of module name.
    Raises:
        SwarmModuleException: An error occurred when try to get modules or no available module.
    """
    try:
        s=os.path.dirname(modules.__file__)
        ret=[name for _, name, _ in pkgutil.iter_modules([s])]
    except Exception as e:
        raise SwarmModuleException('an error occurred when try to get modules, please check'
            ' modules of swarm')

    # check available module
    if len(ret)==0:
        raise SwarmModuleException('no available module')
    return ret
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号