def main(): many = sum(1 for s in sys.argv[1:] if not s.startswith("-")) > 1 register() import black if many and sys.version_info.minor > 6: mock.patch.object(black, "ProcessPoolExecutor", CustomProcessPoolExecutor).start() black.patched_main()
#!/usr/bin/env python3 import sys # Ensure we import the black requirement, not this wrapper module. top = sys.path.pop(0) sys.path.append(top) import black # type: ignore if __name__ == "__main__": black.patched_main() # type: ignore
#!/usr/bin/env python3 import sys # Ensure we import the black requirement, not this wrapper module. top = sys.path.pop(0) sys.path.append(top) import black if __name__ == "__main__": black.patched_main()
def cli_main(): black.main = main black.patched_main()
from black import patched_main patched_main()