MCPcopy Create free account
hub / github.com/ROCm/AMDMIGraphX / yapf_format

Function yapf_format

tools/format.py:64–76  ·  view source on GitHub ↗
(against, apply=False)

Source from the content-addressed store, hash-verified

62
63
64def yapf_format(against, apply=False):
65 if not shutil.which('yapf'):
66 print("yapf not installed. Skipping format.")
67 return
68 diff_flag = "--in-place" if apply else "--diff"
69 files = ' '.join(get_changed_files(against))
70 files = [
71 f for f in files if f.endswith(YAPF_EXTENSIONS) and not is_excluded(f)
72 ]
73 if files:
74 run(f"yapf {diff_flag} -p {files}", cwd=get_top(), verbose=True)
75 else:
76 print("No modified python files to format")
77
78
79def main():

Callers 1

mainFunction · 0.85

Calls 5

get_changed_filesFunction · 0.90
runFunction · 0.90
get_topFunction · 0.90
is_excludedFunction · 0.85
printFunction · 0.50

Tested by

no test coverage detected