conf.py 文件源码

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

项目:txacme 作者: twisted 项目源码 文件源码
def linkcode_resolve(domain, info):
    """
    Determine the URL corresponding to Python object
    """
    if domain != 'py':
        return None
    modname = info['module']
    fullname = info['fullname']
    submod = sys.modules.get(modname)
    if submod is None:
        return None
    obj = submod
    for part in fullname.split('.'):
        try:
            obj = getattr(obj, part)
        except:
            return None
    try:
        fn = inspect.getsourcefile(obj)
    except:
        fn = None
    if not fn:
        return None
    try:
        source, lineno = inspect.findsource(obj)
    except:
        lineno = None
    if lineno:
        linespec = "#L%d" % (lineno + 1)
    else:
        linespec = ""
    fn = relpath(fn, start='..')
    return "https://github.com/mithrandi/txacme/blob/%s/%s%s" % (
        txacme_version_info['full-revisionid'], fn, linespec)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号