utils.py 文件源码

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

项目:Hawkeye 作者: tozhengxq 项目源码 文件源码
def format_fname(value):
    # If the value has a builtin prefix, return it unchanged
    if value.startswith(('{', '<')):
        return value

    value = os.path.normpath(value)

    # If the file is absolute, try normalizing it relative to the project root
    # to handle it as a project file
    if os.path.isabs(value):
        value = _shortest_relative_path(
            value, [current_app.root_path], os.path)

    # If the value is a relative path, it is a project file
    if not os.path.isabs(value):
        return os.path.join('.', value)

    # Otherwise, normalize other paths relative to sys.path
    return '<%s>' % _shortest_relative_path(value, sys.path, os.path)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号