MCPcopy Create free account
hub / github.com/Serial-Studio/Serial-Studio / run_black

Function run_black

scripts/sanitize-commit.py:110–128  ·  view source on GitHub ↗
(root: Path)

Source from the content-addressed store, hash-verified

108
109
110def run_black(root: Path) -> None:
111 targets = [str(root / d) for d in PYTHON_DIRS if (root / d).is_dir()]
112 if not targets:
113 return
114
115 print("Running black...")
116 if shutil.which("black") is not None:
117 cmd = ["black", "--quiet", *targets]
118 else:
119 cmd = [sys.executable, "-m", "black", "--quiet", *targets]
120
121 result = run(cmd)
122 if result.returncode == 127 or (
123 result.returncode != 0 and shutil.which("black") is None
124 ):
125 print("black not available -- skipping. Install with: pip install black")
126 return
127 if result.returncode != 0:
128 print("black failed.")
129
130
131def run_python_step(label: str, script: Path, *args: str) -> None:

Callers 1

mainFunction · 0.85

Calls 1

runFunction · 0.85

Tested by

no test coverage detected