confit.py 文件源码

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

项目:flinck 作者: Kraymer 项目源码 文件源码
def _package_path(name):
    """Returns the path to the package containing the named module or
    None if the path could not be identified (e.g., if
    ``name == "__main__"``).
    """
    loader = pkgutil.get_loader(name)
    if loader is None or name == b'__main__':
        return None

    if hasattr(loader, 'get_filename'):
        filepath = loader.get_filename(name)
    else:
        # Fall back to importing the specified module.
        __import__(name)
        filepath = sys.modules[name].__file__

    return os.path.dirname(os.path.abspath(filepath))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号