pathspec.py 文件源码

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

项目:bob 作者: BobBuildTool 项目源码 文件源码
def markLocation(line, loc):
    if len(line) <= 60:
        # line is short enough
        pass
    elif loc <= 30:
        # error at beginning
        line = line[:60] + '[...]'
    elif loc >= (len(line) - 30):
        # error at end
        loc = 60 - (len(line) - loc) + 5
        line = '[...]' + line[-60:]
    else:
        # error in middle
        line = '[...]' + line[loc-30:loc+30] + '[...]'
        loc = 35

    return "Offending query: " + line + "\n" + (" " * (loc + 17)) + \
        "^.-- Error location"
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号