wsgicli.py 文件源码

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

项目:wsgicli 作者: kobinpy 项目源码 文件源码
def find_modules_from_path(import_path):
    import_from_path(import_path)

    site_dirs = site.getsitepackages()
    lib_dirs = [os.path.dirname(path) for path in site_dirs]

    for module in sys.modules.values():
        path = getattr(module, '__file__', '')
        if path[-4:] in ('.pyo', '.pyc'):
            path = path[:-1]
        if path and os.path.exists(path):
            if all(not path.startswith(lib_dir) for lib_dir in lib_dirs):
                yield module
评论列表


问题


面经


文章

微信
公众号

扫码关注公众号