diff --git a/scripts/find_commits_touching_func.py b/scripts/find_commits_touching_func.py index 85675cb6df42b..ba2f54dd9bbe3 100755 --- a/scripts/find_commits_touching_func.py +++ b/scripts/find_commits_touching_func.py @@ -96,13 +96,7 @@ def get_hits(defname, files=()): cs = set() for f in files: try: - r = sh.git( - "blame", - "-L", - r"/def\s*{start}/,/def/".format(start=defname), - f, - _tty_out=False, - ) + r = sh.git("blame", "-L", rf"/def\s*{defname}/,/def/", f, _tty_out=False,) except sh.ErrorReturnCode_128: logger.debug("no matches in %s" % f) continue @@ -117,14 +111,7 @@ def get_hits(defname, files=()): def get_commit_info(c, fmt, sep="\t"): - r = sh.git( - "log", - "--format={}".format(fmt), - "{}^..{}".format(c, c), - "-n", - "1", - _tty_out=False, - ) + r = sh.git("log", f"--format={fmt}", f"{c}^..{c}", "-n", "1", _tty_out=False,) return str(r).split(sep) @@ -203,10 +190,14 @@ def sorter(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( + f"{h[:HASH_LEN]:{HASH_LEN}} " + f"{d.isoformat()[:10]:10} " + f"{s:<{SUBJ_LEN}} " + f"{p[-20:]:<{PATH_LEN}}" + ) print("\n")