def pprint_hits(hits):
    SUBJ_LEN=50
    PATH_LEN = 20
    hits=list(hits)
    max_p = 0
    for hit in hits:
        p=hit.path.split(os.path.realpath(os.curdir)+os.path.sep)[-1]
        max_p=max(max_p,len(p))

    if max_p < PATH_LEN:
        SUBJ_LEN += PATH_LEN - max_p
        PATH_LEN = max_p

    def sorter(i):
        h,s,d=get_commit_vitals(hits[i].commit)
        return hits[i].path,d

    print("\nThese commits touched the %s method in these files on these dates:\n" \
          % args.funcname)
    for i in sorted(lrange(len(hits)),key=sorter):
        hit = hits[i]
        h,s,d=get_commit_vitals(hit.commit)
        p=hit.path.split(os.path.realpath(os.curdir)+os.path.sep)[-1]

        fmt = "{:%d} {:10} {:<%d} {:<%d}" % (HASH_LEN, SUBJ_LEN, PATH_LEN)
        if len(s) > SUBJ_LEN:
            s = s[:SUBJ_LEN-5] + " ..."
        print(fmt.format(h[:HASH_LEN],d.isoformat()[:10],s,p[-20:]) )

    print("\n")
dataset/ETHPy150Open pydata/pandas/scripts/find_commits_touching_func.py/pprint_hits/original