Size: 761 bytes.


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/usr/bin/env python3
# cs/devtools/format_black.py
# Bazel-run wrapper for Black (uses the Black library via @pip).
import sys
from typing import List


def main(argv: List[str]) -> int:
    # Defer to Black's CLI (respects pyproject.toml if present).
    try:
        from black.__main__ import main as black_main
    except Exception as e:
        print(f"[format_black] failed to import black: {e}", file=sys.stderr)
        return 1
    # If no args, format current directory.
    args = argv if argv else ["."]
    try:
        return black_main(args)
    except SystemExit as se:
        # black_main may sys.exit(); convert to int.
        return int(se.code) if se.code is not None else 0


if __name__ == "__main__":
    sys.exit(main(sys.argv[1:]))
v0 (commit) © 2025 @p13i.io | Load balancer proxied to: cs-code-viewer-1:8080 in 4ms.