Reformat Python code with black
diff --git a/buildkite/bazelci.py b/buildkite/bazelci.py
index 2147ad1..32cb2fa 100644
--- a/buildkite/bazelci.py
+++ b/buildkite/bazelci.py
@@ -47,17 +47,17 @@
     "Android Testing": {
         "git_repository": "https://github.com/googlesamples/android-testing.git",
         "http_config": "https://raw.githubusercontent.com/googlesamples/android-testing/master/bazelci/buildkite-pipeline.yml",
-        "pipeline_slug": "android-testing"
+        "pipeline_slug": "android-testing",
     },
     "Bazel": {
         "git_repository": "https://github.com/bazelbuild/bazel.git",
         "http_config": "https://raw.githubusercontent.com/bazelbuild/bazel/master/.bazelci/postsubmit.yml",
-        "pipeline_slug": "bazel-bazel"
+        "pipeline_slug": "bazel-bazel",
     },
     "Bazel Remote Execution": {
         "git_repository": "https://github.com/bazelbuild/bazel.git",
         "http_config": "https://raw.githubusercontent.com/bazelbuild/continuous-integration/master/buildkite/pipelines/bazel-remote-execution-postsubmit.yml",
-        "pipeline_slug": "remote-execution"
+        "pipeline_slug": "remote-execution",
     },
     "BUILD_file_generator": {
         "git_repository": "https://github.com/bazelbuild/BUILD_file_generator.git",
@@ -67,67 +67,67 @@
     "bazel-toolchains": {
         "git_repository": "https://github.com/bazelbuild/bazel-toolchains.git",
         "http_config": "https://raw.githubusercontent.com/bazelbuild/bazel-toolchains/master/.bazelci/presubmit.yml",
-        "pipeline_slug": "bazel-toolchains"
+        "pipeline_slug": "bazel-toolchains",
     },
     "bazel-skylib": {
         "git_repository": "https://github.com/bazelbuild/bazel-skylib.git",
         "http_config": "https://raw.githubusercontent.com/bazelbuild/bazel-skylib/master/.bazelci/presubmit.yml",
-        "pipeline_slug": "bazel-skylib"
+        "pipeline_slug": "bazel-skylib",
     },
     "buildtools": {
         "git_repository": "https://github.com/bazelbuild/buildtools.git",
         "http_config": "https://raw.githubusercontent.com/bazelbuild/buildtools/master/.bazelci/presubmit.yml",
-        "pipeline_slug": "buildtools"
+        "pipeline_slug": "buildtools",
     },
     "CLion Plugin": {
         "git_repository": "https://github.com/bazelbuild/intellij.git",
         "http_config": "https://raw.githubusercontent.com/bazelbuild/continuous-integration/master/buildkite/pipelines/clion-postsubmit.yml",
-        "pipeline_slug": "clion-plugin"
+        "pipeline_slug": "clion-plugin",
     },
     "Gerrit": {
         "git_repository": "https://gerrit.googlesource.com/gerrit.git",
         "http_config": "https://raw.githubusercontent.com/bazelbuild/continuous-integration/master/buildkite/pipelines/gerrit-postsubmit.yml",
-        "pipeline_slug": "gerrit"
+        "pipeline_slug": "gerrit",
     },
     "Google Logging": {
         "git_repository": "https://github.com/google/glog.git",
         "http_config": "https://raw.githubusercontent.com/bazelbuild/continuous-integration/master/buildkite/pipelines/glog-postsubmit.yml",
-        "pipeline_slug": "google-logging"
+        "pipeline_slug": "google-logging",
     },
     "IntelliJ Plugin": {
         "git_repository": "https://github.com/bazelbuild/intellij.git",
         "http_config": "https://raw.githubusercontent.com/bazelbuild/continuous-integration/master/buildkite/pipelines/intellij-postsubmit.yml",
-        "pipeline_slug": "intellij-plugin"
+        "pipeline_slug": "intellij-plugin",
     },
     "migration-tooling": {
         "git_repository": "https://github.com/bazelbuild/migration-tooling.git",
         "http_config": "https://raw.githubusercontent.com/bazelbuild/migration-tooling/master/.bazelci/presubmit.yml",
-        "pipeline_slug": "migration-tooling"
+        "pipeline_slug": "migration-tooling",
     },
     "protobuf": {
         "git_repository": "https://github.com/google/protobuf.git",
         "http_config": "https://raw.githubusercontent.com/bazelbuild/continuous-integration/master/buildkite/pipelines/protobuf-postsubmit.yml",
-        "pipeline_slug": "protobuf"
+        "pipeline_slug": "protobuf",
     },
     "re2": {
         "git_repository": "https://github.com/google/re2.git",
         "http_config": "https://raw.githubusercontent.com/bazelbuild/continuous-integration/master/buildkite/pipelines/re2-postsubmit.yml",
-        "pipeline_slug": "re2"
+        "pipeline_slug": "re2",
     },
     "rules_appengine": {
         "git_repository": "https://github.com/bazelbuild/rules_appengine.git",
         "http_config": "https://raw.githubusercontent.com/bazelbuild/rules_appengine/master/.bazelci/presubmit.yml",
-        "pipeline_slug": "rules-appengine-appengine"
+        "pipeline_slug": "rules-appengine-appengine",
     },
     "rules_apple": {
         "git_repository": "https://github.com/bazelbuild/rules_apple.git",
         "http_config": "https://raw.githubusercontent.com/bazelbuild/rules_apple/master/.bazelci/presubmit.yml",
-        "pipeline_slug": "rules-apple-darwin"
+        "pipeline_slug": "rules-apple-darwin",
     },
     "rules_closure": {
         "git_repository": "https://github.com/bazelbuild/rules_closure.git",
         "http_config": "https://raw.githubusercontent.com/bazelbuild/rules_closure/master/.bazelci/presubmit.yml",
-        "pipeline_slug": "rules-closure-closure-compiler"
+        "pipeline_slug": "rules-closure-closure-compiler",
     },
     "rules_docker": {
         "git_repository": "https://github.com/bazelbuild/rules_docker.git",
@@ -142,90 +142,90 @@
     "rules_go": {
         "git_repository": "https://github.com/bazelbuild/rules_go.git",
         "http_config": "https://raw.githubusercontent.com/bazelbuild/rules_go/master/.bazelci/presubmit.yml",
-        "pipeline_slug": "rules-go-golang"
+        "pipeline_slug": "rules-go-golang",
     },
     "rules_groovy": {
         "git_repository": "https://github.com/bazelbuild/rules_groovy.git",
         "http_config": "https://raw.githubusercontent.com/bazelbuild/rules_groovy/master/.bazelci/presubmit.yml",
-        "pipeline_slug": "rules-groovy"
+        "pipeline_slug": "rules-groovy",
     },
     "rules_gwt": {
         "git_repository": "https://github.com/bazelbuild/rules_gwt.git",
         "http_config": "https://raw.githubusercontent.com/bazelbuild/rules_gwt/master/.bazelci/presubmit.yml",
-        "pipeline_slug": "rules-gwt"
+        "pipeline_slug": "rules-gwt",
     },
     "rules_jsonnet": {
         "git_repository": "https://github.com/bazelbuild/rules_jsonnet.git",
         "http_config": "https://raw.githubusercontent.com/bazelbuild/rules_jsonnet/master/.bazelci/presubmit.yml",
-        "pipeline_slug": "rules-jsonnet"
+        "pipeline_slug": "rules-jsonnet",
     },
     "rules_kotlin": {
         "git_repository": "https://github.com/bazelbuild/rules_kotlin.git",
         "http_config": "https://raw.githubusercontent.com/bazelbuild/rules_kotlin/master/.bazelci/presubmit.yml",
-        "pipeline_slug": "rules-kotlin-kotlin"
+        "pipeline_slug": "rules-kotlin-kotlin",
     },
     "rules_k8s": {
         "git_repository": "https://github.com/bazelbuild/rules_k8s.git",
         "http_config": "https://raw.githubusercontent.com/bazelbuild/rules_k8s/master/.bazelci/presubmit.yml",
-        "pipeline_slug": "rules-k8s-k8s"
+        "pipeline_slug": "rules-k8s-k8s",
     },
     "rules_nodejs": {
         "git_repository": "https://github.com/bazelbuild/rules_nodejs.git",
         "http_config": "https://raw.githubusercontent.com/bazelbuild/rules_nodejs/master/.bazelci/presubmit.yml",
-        "pipeline_slug": "rules-nodejs-nodejs"
+        "pipeline_slug": "rules-nodejs-nodejs",
     },
     "rules_perl": {
         "git_repository": "https://github.com/bazelbuild/rules_perl.git",
         "http_config": "https://raw.githubusercontent.com/bazelbuild/rules_perl/master/.bazelci/presubmit.yml",
-        "pipeline_slug": "rules-perl"
+        "pipeline_slug": "rules-perl",
     },
     "rules_python": {
         "git_repository": "https://github.com/bazelbuild/rules_python.git",
         "http_config": "https://raw.githubusercontent.com/bazelbuild/rules_python/master/.bazelci/presubmit.yml",
-        "pipeline_slug": "rules-python-python"
+        "pipeline_slug": "rules-python-python",
     },
     "rules_rust": {
         "git_repository": "https://github.com/bazelbuild/rules_rust.git",
         "http_config": "https://raw.githubusercontent.com/bazelbuild/rules_rust/master/.bazelci/presubmit.yml",
-        "pipeline_slug": "rules-rust-rustlang"
+        "pipeline_slug": "rules-rust-rustlang",
     },
     "rules_sass": {
         "git_repository": "https://github.com/bazelbuild/rules_sass.git",
         "http_config": "https://raw.githubusercontent.com/bazelbuild/rules_sass/master/.bazelci/presubmit.yml",
-        "pipeline_slug": "rules-sass"
+        "pipeline_slug": "rules-sass",
     },
     "rules_scala": {
         "git_repository": "https://github.com/bazelbuild/rules_scala.git",
         "http_config": "https://raw.githubusercontent.com/bazelbuild/rules_scala/master/.bazelci/presubmit.yml",
-        "pipeline_slug": "rules-scala-scala"
+        "pipeline_slug": "rules-scala-scala",
     },
     "rules_typescript": {
         "git_repository": "https://github.com/bazelbuild/rules_typescript.git",
         "http_config": "https://raw.githubusercontent.com/bazelbuild/rules_typescript/master/.bazelci/presubmit.yml",
         "pipeline_slug": "rules-typescript-typescript",
-        "disabled_reason": "Re-enable once merged: https://github.com/bazelbuild/rules_typescript/pull/343"
+        "disabled_reason": "Re-enable once merged: https://github.com/bazelbuild/rules_typescript/pull/343",
     },
     "rules_webtesting": {
         "git_repository": "https://github.com/bazelbuild/rules_webtesting.git",
         "http_config": "https://raw.githubusercontent.com/bazelbuild/continuous-integration/master/buildkite/pipelines/rules_webtesting-postsubmit.yml",
         "pipeline_slug": "rules-webtesting-saucelabs",
-        "disabled_reason": "Re-enable once fixed: https://github.com/bazelbuild/continuous-integration/issues/191"
+        "disabled_reason": "Re-enable once fixed: https://github.com/bazelbuild/continuous-integration/issues/191",
     },
     "skydoc": {
         "git_repository": "https://github.com/bazelbuild/skydoc.git",
         "http_config": "https://raw.githubusercontent.com/bazelbuild/skydoc/master/.bazelci/presubmit.yml",
-        "pipeline_slug": "skydoc"
+        "pipeline_slug": "skydoc",
     },
     "subpar": {
         "git_repository": "https://github.com/google/subpar.git",
         "http_config": "https://raw.githubusercontent.com/bazelbuild/continuous-integration/master/buildkite/pipelines/subpar-postsubmit.yml",
-        "pipeline_slug": "subpar"
+        "pipeline_slug": "subpar",
     },
     "TensorFlow": {
         "git_repository": "https://github.com/tensorflow/tensorflow.git",
         "http_config": "https://raw.githubusercontent.com/bazelbuild/continuous-integration/master/buildkite/pipelines/tensorflow-postsubmit.yml",
-        "pipeline_slug": "tensorflow"
-    }
+        "pipeline_slug": "tensorflow",
+    },
 }
 
 
@@ -238,56 +238,56 @@
         "emoji-name": ":ubuntu: 14.04 (JDK 8)",
         "agent-directory": "/var/lib/buildkite-agent/builds/${BUILDKITE_AGENT_NAME}",
         "publish_binary": True,
-        "java": "8"
+        "java": "8",
     },
     "ubuntu1604": {
         "name": "Ubuntu 16.04, JDK 8",
         "emoji-name": ":ubuntu: 16.04 (JDK 8)",
         "agent-directory": "/var/lib/buildkite-agent/builds/${BUILDKITE_AGENT_NAME}",
         "publish_binary": False,
-        "java": "8"
+        "java": "8",
     },
     "ubuntu1804": {
         "name": "Ubuntu 18.04, JDK 8",
         "emoji-name": ":ubuntu: 18.04 (JDK 8)",
         "agent-directory": "/var/lib/buildkite-agent/builds/${BUILDKITE_AGENT_NAME}",
         "publish_binary": False,
-        "java": "8"
+        "java": "8",
     },
     "ubuntu1804_nojava": {
         "name": "Ubuntu 18.04, no JDK",
         "emoji-name": ":ubuntu: 18.04 (no JDK)",
         "agent-directory": "/var/lib/buildkite-agent/builds/${BUILDKITE_AGENT_NAME}",
         "publish_binary": False,
-        "java": "no"
+        "java": "no",
     },
     "ubuntu1804_java9": {
         "name": "Ubuntu 18.04, JDK 9",
         "emoji-name": ":ubuntu: 18.04 (JDK 9)",
         "agent-directory": "/var/lib/buildkite-agent/builds/${BUILDKITE_AGENT_NAME}",
         "publish_binary": False,
-        "java": "9"
+        "java": "9",
     },
     "ubuntu1804_java10": {
         "name": "Ubuntu 18.04, JDK 10",
         "emoji-name": ":ubuntu: 18.04 (JDK 10)",
         "agent-directory": "/var/lib/buildkite-agent/builds/${BUILDKITE_AGENT_NAME}",
         "publish_binary": False,
-        "java": "10"
+        "java": "10",
     },
     "macos": {
         "name": "macOS, JDK 8",
         "emoji-name": ":darwin: (JDK 8)",
         "agent-directory": "/Users/buildkite/builds/${BUILDKITE_AGENT_NAME}",
         "publish_binary": True,
-        "java": "8"
+        "java": "8",
     },
     "windows": {
         "name": "Windows, JDK 8",
         "emoji-name": ":windows: (JDK 8)",
         "agent-directory": "d:/b/${BUILDKITE_AGENT_NAME}",
         "publish_binary": True,
-        "java": "8"
+        "java": "8",
     },
     "rbe_ubuntu1604": {
         "name": "RBE (Ubuntu 16.04, JDK 8)",
@@ -295,8 +295,8 @@
         "agent-directory": "/var/lib/buildkite-agent/builds/${BUILDKITE_AGENT_NAME}",
         "publish_binary": False,
         "host-platform": "ubuntu1604",
-        "java": "8"
-    }
+        "java": "8",
+    },
 }
 
 
@@ -304,6 +304,7 @@
     """
     Raised whenever something goes wrong and we should exit with an error.
     """
+
     pass
 
 
@@ -312,6 +313,7 @@
     Raised when try_publish_binaries wasn't able to publish a set of binaries,
     because the generation of the current file didn't match the expected value.
     """
+
     pass
 
 
@@ -319,6 +321,7 @@
     """
     Raised when a Bazel test fails.
     """
+
     pass
 
 
@@ -326,6 +329,7 @@
     """
     Raised when a Bazel build fails.
     """
+
     pass
 
 
@@ -339,9 +343,10 @@
 def rchop(string_, *endings):
     for ending in endings:
         if string_.endswith(ending):
-            return string_[:-len(ending)]
+            return string_[: -len(ending)]
     return string_
 
+
 def python_binary(platform=None):
     if platform == "windows":
         return "python.exe"
@@ -366,18 +371,24 @@
     """
     URL to the latest version of this script.
     """
-    return "https://raw.githubusercontent.com/bazelbuild/continuous-integration/master/buildkite/bazelci.py?{}".format(int(time.time()))
+    return "https://raw.githubusercontent.com/bazelbuild/continuous-integration/master/buildkite/bazelci.py?{}".format(
+        int(time.time())
+    )
 
 
 def incompatible_flag_verbose_failures_url():
     """
     URL to the latest version of this script.
     """
-    return "https://raw.githubusercontent.com/bazelbuild/continuous-integration/master/buildkite/incompatible_flag_verbose_failures.py?{}".format(int(time.time()))
+    return "https://raw.githubusercontent.com/bazelbuild/continuous-integration/master/buildkite/incompatible_flag_verbose_failures.py?{}".format(
+        int(time.time())
+    )
 
 
 def downstream_projects_root(platform):
-    downstream_projects_dir = os.path.expandvars("${BUILDKITE_ORGANIZATION_SLUG}-downstream-projects")
+    downstream_projects_dir = os.path.expandvars(
+        "${BUILDKITE_ORGANIZATION_SLUG}-downstream-projects"
+    )
     agent_directory = os.path.expandvars(PLATFORMS[platform]["agent-directory"])
     path = os.path.join(agent_directory, downstream_projects_dir)
     if not os.path.exists(path):
@@ -413,9 +424,20 @@
     eprint("\n\n+++ {0}\n\n".format(name))
 
 
-def execute_commands(config, platform, git_repository, git_commit, git_repo_location,
-                     use_bazel_at_commit, use_but, save_but, build_only, test_only,
-                     monitor_flaky_tests, incompatible_flags):
+def execute_commands(
+    config,
+    platform,
+    git_repository,
+    git_commit,
+    git_repo_location,
+    use_bazel_at_commit,
+    use_but,
+    save_but,
+    build_only,
+    test_only,
+    monitor_flaky_tests,
+    incompatible_flags,
+):
     fail_pipeline = False
     tmpdir = None
     bazel_binary = "bazel"
@@ -438,9 +460,13 @@
         else:
             git_repository = os.getenv("BUILDKITE_REPO")
 
-        if (is_pull_request()
-                and not os.getenv("BUILDKITE_PULL_REQUEST_REPO").startswith("git://github.com/bazelbuild/")
-                and not is_trusted_author(github_user_for_pull_request(), git_repository)):
+        if (
+            is_pull_request()
+            and not os.getenv("BUILDKITE_PULL_REQUEST_REPO").startswith(
+                "git://github.com/bazelbuild/"
+            )
+            and not is_trusted_author(github_user_for_pull_request(), git_repository)
+        ):
             update_pull_request_verification_status(git_repository, commit, state="success")
 
         if use_bazel_at_commit:
@@ -464,7 +490,9 @@
             execute_batch_commands(config.get("batch_commands", None))
         else:
             execute_shell_commands(config.get("shell_commands", None))
-        execute_bazel_run(bazel_binary, platform, config.get("run_targets", None), incompatible_flags)
+        execute_bazel_run(
+            bazel_binary, platform, config.get("run_targets", None), incompatible_flags
+        )
 
         if config.get("sauce", None):
             print_collapsed_group(":saucelabs: Starting Sauce Connect Proxy")
@@ -481,62 +509,94 @@
             wait_start = time.time()
             while not os.path.exists(readyfile):
                 if time.time() - wait_start > 30:
-                    raise BuildkiteException("Sauce Connect Proxy is still not ready after 30 seconds, aborting!")
+                    raise BuildkiteException(
+                        "Sauce Connect Proxy is still not ready after 30 seconds, aborting!"
+                    )
                 time.sleep(1)
             print("Sauce Connect Proxy is ready, continuing...")
 
         if not test_only:
             build_bep_file = os.path.join(tmpdir, "build_bep.json")
             if is_pull_request():
-                update_pull_request_build_status(
-                    platform, git_repository, commit, "pending", None)
+                update_pull_request_build_status(platform, git_repository, commit, "pending", None)
             try:
-                execute_bazel_build(bazel_binary, platform, config.get("build_flags", []),
-                                    config.get("build_targets", None), build_bep_file, incompatible_flags)
+                execute_bazel_build(
+                    bazel_binary,
+                    platform,
+                    config.get("build_flags", []),
+                    config.get("build_targets", None),
+                    build_bep_file,
+                    incompatible_flags,
+                )
                 if is_pull_request():
                     invocation_id = bes_invocation_id(build_bep_file)
                     update_pull_request_build_status(
-                        platform, git_repository, commit, "success", invocation_id)
+                        platform, git_repository, commit, "success", invocation_id
+                    )
                 if save_but:
                     upload_bazel_binary(platform)
             except BazelBuildFailedException:
                 if is_pull_request():
                     invocation_id = bes_invocation_id(build_bep_file)
                     update_pull_request_build_status(
-                        platform, git_repository, commit, "failure", invocation_id)
+                        platform, git_repository, commit, "failure", invocation_id
+                    )
                 fail_pipeline = True
         if (not fail_pipeline) and (not build_only):
             test_bep_file = os.path.join(tmpdir, "test_bep.json")
             try:
                 if is_pull_request():
                     update_pull_request_test_status(
-                        platform, git_repository, commit, "pending", None)
-                execute_bazel_test(bazel_binary, platform, config.get("test_flags", []),
-                                   config.get("test_targets", None), test_bep_file,
-                                   monitor_flaky_tests, incompatible_flags)
+                        platform, git_repository, commit, "pending", None
+                    )
+                execute_bazel_test(
+                    bazel_binary,
+                    platform,
+                    config.get("test_flags", []),
+                    config.get("test_targets", None),
+                    test_bep_file,
+                    monitor_flaky_tests,
+                    incompatible_flags,
+                )
                 if has_flaky_tests(test_bep_file):
                     if monitor_flaky_tests:
                         # Upload the BEP logs from Bazel builds for later analysis on flaky tests
                         build_id = os.getenv("BUILDKITE_BUILD_ID")
                         pipeline_slug = os.getenv("BUILDKITE_PIPELINE_SLUG")
-                        execute_command([gsutil_command(), "cp", test_bep_file,
-                            "gs://bazel-buildkite-stats/flaky-tests-bep/" + pipeline_slug + "/" + build_id + ".json"])
+                        execute_command(
+                            [
+                                gsutil_command(),
+                                "cp",
+                                test_bep_file,
+                                "gs://bazel-buildkite-stats/flaky-tests-bep/"
+                                + pipeline_slug
+                                + "/"
+                                + build_id
+                                + ".json",
+                            ]
+                        )
                 if is_pull_request():
                     invocation_id = bes_invocation_id(test_bep_file)
                     update_pull_request_test_status(
-                        platform, git_repository, commit, "success", invocation_id)
+                        platform, git_repository, commit, "success", invocation_id
+                    )
             except BazelTestFailedException:
                 if is_pull_request():
                     invocation_id = bes_invocation_id(test_bep_file)
-                    failed_tests = tests_with_status(
-                        test_bep_file, status="FAILED")
-                    timed_out_tests = tests_with_status(
-                        test_bep_file, status="TIMEOUT")
-                    flaky_tests = tests_with_status(
-                        test_bep_file, status="FLAKY")
+                    failed_tests = tests_with_status(test_bep_file, status="FAILED")
+                    timed_out_tests = tests_with_status(test_bep_file, status="TIMEOUT")
+                    flaky_tests = tests_with_status(test_bep_file, status="FLAKY")
 
-                    update_pull_request_test_status(platform, git_repository, commit, "failure", invocation_id,
-                                                    len(failed_tests), len(timed_out_tests), len(flaky_tests))
+                    update_pull_request_test_status(
+                        platform,
+                        git_repository,
+                        commit,
+                        "failure",
+                        invocation_id,
+                        len(failed_tests),
+                        len(timed_out_tests),
+                        len(flaky_tests),
+                    )
                 fail_pipeline = True
 
             upload_test_logs(test_bep_file, tmpdir)
@@ -569,10 +629,35 @@
         return __github_token__
     try:
         execute_command(
-            [gsutil_command(), "cp", "gs://bazel-encrypted-secrets/github-token.enc", "github-token.enc"])
-        __github_token__ = subprocess.check_output([gcloud_command(), "kms", "decrypt", "--location", "global", "--keyring", "buildkite",
-                                                    "--key", "github-token", "--ciphertext-file", "github-token.enc",
-                                                    "--plaintext-file", "-"], env=os.environ).decode("utf-8").strip()
+            [
+                gsutil_command(),
+                "cp",
+                "gs://bazel-encrypted-secrets/github-token.enc",
+                "github-token.enc",
+            ]
+        )
+        __github_token__ = (
+            subprocess.check_output(
+                [
+                    gcloud_command(),
+                    "kms",
+                    "decrypt",
+                    "--location",
+                    "global",
+                    "--keyring",
+                    "buildkite",
+                    "--key",
+                    "github-token",
+                    "--ciphertext-file",
+                    "github-token.enc",
+                    "--plaintext-file",
+                    "-",
+                ],
+                env=os.environ,
+            )
+            .decode("utf-8")
+            .strip()
+        )
         return __github_token__
     finally:
         os.remove("github-token.enc")
@@ -584,10 +669,35 @@
         return __saucelabs_token__
     try:
         execute_command(
-            [gsutil_command(), "cp", "gs://bazel-encrypted-secrets/saucelabs-access-key.enc", "saucelabs-access-key.enc"])
-        __saucelabs_token__ = subprocess.check_output([gcloud_command(), "kms", "decrypt", "--location", "global", "--keyring", "buildkite",
-                                                       "--key", "saucelabs-access-key", "--ciphertext-file", "saucelabs-access-key.enc",
-                                                       "--plaintext-file", "-"], env=os.environ).decode("utf-8").strip()
+            [
+                gsutil_command(),
+                "cp",
+                "gs://bazel-encrypted-secrets/saucelabs-access-key.enc",
+                "saucelabs-access-key.enc",
+            ]
+        )
+        __saucelabs_token__ = (
+            subprocess.check_output(
+                [
+                    gcloud_command(),
+                    "kms",
+                    "decrypt",
+                    "--location",
+                    "global",
+                    "--keyring",
+                    "buildkite",
+                    "--key",
+                    "saucelabs-access-key",
+                    "--ciphertext-file",
+                    "saucelabs-access-key.enc",
+                    "--plaintext-file",
+                    "-",
+                ],
+                env=os.environ,
+            )
+            .decode("utf-8")
+            .strip()
+        )
         return __saucelabs_token__
     finally:
         os.remove("saucelabs-access-key.enc")
@@ -599,10 +709,35 @@
         return __buildkite_token__
     try:
         execute_command(
-            [gsutil_command(), "cp", "gs://bazel-encrypted-secrets/buildkite-api-token.enc", "buildkite-api-token.enc"])
-        __buildkite_token__ = subprocess.check_output([gcloud_command(), "kms", "decrypt", "--location", "global", "--keyring", "buildkite",
-                                                       "--key", "buildkite-api-token", "--ciphertext-file", "buildkite-api-token.enc",
-                                                       "--plaintext-file", "-"], env=os.environ).decode("utf-8").strip()
+            [
+                gsutil_command(),
+                "cp",
+                "gs://bazel-encrypted-secrets/buildkite-api-token.enc",
+                "buildkite-api-token.enc",
+            ]
+        )
+        __buildkite_token__ = (
+            subprocess.check_output(
+                [
+                    gcloud_command(),
+                    "kms",
+                    "decrypt",
+                    "--location",
+                    "global",
+                    "--keyring",
+                    "buildkite",
+                    "--key",
+                    "buildkite-api-token",
+                    "--ciphertext-file",
+                    "buildkite-api-token.enc",
+                    "--plaintext-file",
+                    "-",
+                ],
+                env=os.environ,
+            )
+            .decode("utf-8")
+            .strip()
+        )
         return __buildkite_token__
     finally:
         os.remove("buildkite-api-token.enc")
@@ -625,8 +760,9 @@
     gh = login(token=fetch_github_token())
     owner, repo = owner_repository_from_url(git_repository)
     repo = gh.repository(owner=owner, repository=repo)
-    repo.create_status(sha=commit, state=state, target_url=details_url, description=description,
-                       context=context)
+    repo.create_status(
+        sha=commit, state=state, target_url=details_url, description=description, context=context
+    )
 
 
 def update_pull_request_verification_status(git_repository, commit, state):
@@ -636,8 +772,9 @@
     elif state == "success":
         description = "Verified"
     build_url = os.getenv("BUILDKITE_BUILD_URL")
-    update_pull_request_status(git_repository, commit, state, build_url, description,
-                               "Verify Pull Request")
+    update_pull_request_status(
+        git_repository, commit, state, build_url, description, "Verify Pull Request"
+    )
 
 
 def update_pull_request_build_status(platform, git_repository, commit, state, invocation_id):
@@ -648,12 +785,26 @@
         description = "Failure"
     elif state == "success":
         description = "Success"
-    update_pull_request_status(git_repository, commit, state, results_view_url(invocation_id),
-                               description, "bazel build ({0})".format(PLATFORMS[platform]["name"]))
+    update_pull_request_status(
+        git_repository,
+        commit,
+        state,
+        results_view_url(invocation_id),
+        description,
+        "bazel build ({0})".format(PLATFORMS[platform]["name"]),
+    )
 
 
-def update_pull_request_test_status(platform, git_repository, commit, state, invocation_id, num_failed=0,
-                                    num_timed_out=0, num_flaky=0):
+def update_pull_request_test_status(
+    platform,
+    git_repository,
+    commit,
+    state,
+    invocation_id,
+    num_failed=0,
+    num_timed_out=0,
+    num_flaky=0,
+):
     description = ""
     if state == "pending":
         description = "Testing ..."
@@ -679,8 +830,14 @@
             description = "Some tests didn't pass"
     elif state == "success":
         description = "All tests passed"
-    update_pull_request_status(git_repository, commit, state, results_view_url(invocation_id),
-                               description, "bazel test ({0})".format(PLATFORMS[platform]["name"]))
+    update_pull_request_status(
+        git_repository,
+        commit,
+        state,
+        results_view_url(invocation_id),
+        description,
+        "bazel test ({0})".format(PLATFORMS[platform]["name"]),
+    )
 
 
 def is_pull_request():
@@ -710,8 +867,16 @@
 
 def print_bazel_version_info(bazel_binary, platform):
     print_collapsed_group(":information_source: Bazel Info")
-    execute_command([bazel_binary] + common_startup_flags(platform) + ["--nomaster_bazelrc", "--bazelrc=/dev/null", "version"])
-    execute_command([bazel_binary] + common_startup_flags(platform) + ["--nomaster_bazelrc", "--bazelrc=/dev/null", "info"])
+    execute_command(
+        [bazel_binary]
+        + common_startup_flags(platform)
+        + ["--nomaster_bazelrc", "--bazelrc=/dev/null", "version"]
+    )
+    execute_command(
+        [bazel_binary]
+        + common_startup_flags(platform)
+        + ["--nomaster_bazelrc", "--bazelrc=/dev/null", "info"]
+    )
 
 
 def print_environment_variables_info():
@@ -735,8 +900,9 @@
         binary_path = r"bazel-bin\src\bazel"
 
     source_step = create_label(host_platform, "Bazel", build_only=True)
-    execute_command(["buildkite-agent", "artifact", "download",
-                     binary_path, dest_dir, "--step", source_step])
+    execute_command(
+        ["buildkite-agent", "artifact", "download", binary_path, dest_dir, "--step", source_step]
+    )
     bazel_binary_path = os.path.join(dest_dir, binary_path)
     st = os.stat(bazel_binary_path)
     os.chmod(bazel_binary_path, st.st_mode | stat.S_IEXEC)
@@ -749,25 +915,54 @@
     if "ubuntu" in PLATFORMS[platform].get("host-platform", platform):
         platform = "ubuntu1404"
     bazel_binary_path = os.path.join(dest_dir, "bazel.exe" if platform == "windows" else "bazel")
-    execute_command([gsutil_command(), "cp", bazelci_builds_gs_url(platform, bazel_git_commit),
-                     bazel_binary_path])
+    execute_command(
+        [
+            gsutil_command(),
+            "cp",
+            bazelci_builds_gs_url(platform, bazel_git_commit),
+            bazel_binary_path,
+        ]
+    )
     st = os.stat(bazel_binary_path)
     os.chmod(bazel_binary_path, st.st_mode | stat.S_IEXEC)
     return bazel_binary_path
 
+
 def clone_git_repository(git_repository, platform, git_commit=None):
     root = downstream_projects_root(platform)
     project_name = re.search(r"/([^/]+)\.git$", git_repository).group(1)
     clone_path = os.path.join(root, project_name)
-    print_collapsed_group("Fetching %s sources at %s" % (project_name, git_commit if git_commit else "HEAD"))
+    print_collapsed_group(
+        "Fetching %s sources at %s" % (project_name, git_commit if git_commit else "HEAD")
+    )
 
     if not os.path.exists(clone_path):
         if platform in ["ubuntu1404", "ubuntu1604", "ubuntu1804", "rbe_ubuntu1604"]:
-            execute_command(["git", "clone", "--reference", "/var/lib/bazelbuild", git_repository, clone_path])
+            execute_command(
+                ["git", "clone", "--reference", "/var/lib/bazelbuild", git_repository, clone_path]
+            )
         elif platform in ["macos"]:
-            execute_command(["git", "clone", "--reference", "/usr/local/var/bazelbuild", git_repository, clone_path])
+            execute_command(
+                [
+                    "git",
+                    "clone",
+                    "--reference",
+                    "/usr/local/var/bazelbuild",
+                    git_repository,
+                    clone_path,
+                ]
+            )
         elif platform in ["windows"]:
-            execute_command(["git", "clone", "--reference", "c:\\buildkite\\bazelbuild", git_repository, clone_path])
+            execute_command(
+                [
+                    "git",
+                    "clone",
+                    "--reference",
+                    "c:\\buildkite\\bazelbuild",
+                    git_repository,
+                    clone_path,
+                ]
+            )
         else:
             execute_command(["git", "clone", git_repository, clone_path])
 
@@ -781,7 +976,11 @@
         execute_command(["git", "reset", git_commit, "--hard"])
     else:
         # sync to the latest commit of HEAD. Unlikely git pull this also works after a force push.
-        remote_head = subprocess.check_output(["git", "symbolic-ref", "refs/remotes/origin/HEAD"]).decode("utf-8").rstrip()
+        remote_head = (
+            subprocess.check_output(["git", "symbolic-ref", "refs/remotes/origin/HEAD"])
+            .decode("utf-8")
+            .rstrip()
+        )
         execute_command(["git", "reset", remote_head, "--hard"])
     execute_command(["git", "submodule", "sync", "--recursive"])
     execute_command(["git", "submodule", "update", "--init", "--recursive", "--force"])
@@ -812,35 +1011,58 @@
         return
     print_collapsed_group("Setup (Run Targets)")
     for target in targets:
-        execute_command([bazel_binary] + common_startup_flags(platform) + ["run"] + common_build_flags(None, platform) + (incompatible_flags or []) + [target])
+        execute_command(
+            [bazel_binary]
+            + common_startup_flags(platform)
+            + ["run"]
+            + common_build_flags(None, platform)
+            + (incompatible_flags or [])
+            + [target]
+        )
 
 
 def remote_caching_flags(platform):
-    if platform not in ["ubuntu1404", "ubuntu1604", "ubuntu1804", "ubuntu1804_nojava", "ubuntu1804_java9", "ubuntu1804_java10", "macos"]:
+    if platform not in [
+        "ubuntu1404",
+        "ubuntu1604",
+        "ubuntu1804",
+        "ubuntu1804_nojava",
+        "ubuntu1804_java9",
+        "ubuntu1804_java10",
+        "macos",
+    ]:
         return []
     flags = ["--google_default_credentials", "--experimental_guard_against_concurrent_changes"]
     if is_pull_request():
-        flags += ["--bes_backend=buildeventservice.googleapis.com",
-                  "--bes_timeout=360s",
-                  "--tls_enabled",
-                  "--project_id=bazel-public",
-                  "--remote_instance_name=projects/bazel-public/instances/default_instance",
-                  # TODO(ulfjack): figure out how to resolve
-                  # https://github.com/bazelbuild/bazel/issues/5382 and as part of that keep
-                  # or remove the `--disk_cache=` flag.
-                  "--disk_cache=",
-                  "--remote_timeout=360",
-                  "--remote_cache=remotebuildexecution.googleapis.com",
-                  "--experimental_remote_platform_override=properties:{name:\"platform\" value:\"" + platform + "\"}"]
+        flags += [
+            "--bes_backend=buildeventservice.googleapis.com",
+            "--bes_timeout=360s",
+            "--tls_enabled",
+            "--project_id=bazel-public",
+            "--remote_instance_name=projects/bazel-public/instances/default_instance",
+            # TODO(ulfjack): figure out how to resolve
+            # https://github.com/bazelbuild/bazel/issues/5382 and as part of that keep
+            # or remove the `--disk_cache=` flag.
+            "--disk_cache=",
+            "--remote_timeout=360",
+            "--remote_cache=remotebuildexecution.googleapis.com",
+            '--experimental_remote_platform_override=properties:{name:"platform" value:"'
+            + platform
+            + '"}',
+        ]
     else:
-        flags += ["--remote_timeout=10",
-                  # TODO(ulfjack): figure out how to resolve
-                  # https://github.com/bazelbuild/bazel/issues/5382 and as part of that keep
-                  # or remove the `--disk_cache=` flag.
-                  "--disk_cache=",
-                  "--remote_max_connections=200",
-                  "--experimental_remote_platform_override=properties:{name:\"platform\" value:\"" + platform + "\"}",
-                  "--remote_http_cache=https://storage.googleapis.com/bazel-buildkite-cache"]
+        flags += [
+            "--remote_timeout=10",
+            # TODO(ulfjack): figure out how to resolve
+            # https://github.com/bazelbuild/bazel/issues/5382 and as part of that keep
+            # or remove the `--disk_cache=` flag.
+            "--disk_cache=",
+            "--remote_max_connections=200",
+            '--experimental_remote_platform_override=properties:{name:"platform" value:"'
+            + platform
+            + '"}',
+            "--remote_http_cache=https://storage.googleapis.com/bazel-buildkite-cache",
+        ]
     return flags
 
 
@@ -886,7 +1108,7 @@
         "--experimental_build_event_json_file_path_conversion=false",
         "--announce_rc",
         "--sandbox_tmpfs_path=/tmp",
-        "--experimental_multi_threaded_digest"
+        "--experimental_multi_threaded_digest",
     ]
     if bep_file:
         flags += ["--build_event_json_file=" + bep_file]
@@ -905,14 +1127,14 @@
         "--genrule_strategy=remote",
         "--experimental_strict_action_env",
         "--tls_enabled=true",
-        "--google_default_credentials"
+        "--google_default_credentials",
     ]
 
     # Enable BES / Build Results reporting.
     flags += [
         "--bes_backend=buildeventservice.googleapis.com",
         "--bes_timeout=360s",
-        "--project_id=bazel-public"
+        "--project_id=bazel-public",
     ]
 
     if not accept_cached:
@@ -942,10 +1164,10 @@
     # More about platforms: https://docs.bazel.build/versions/master/platforms.html
     # Don't add platform flags if they are specified already.
     platform_flags = {
-        "--extra_toolchains" : "@bazel_toolchains//configs/ubuntu16_04_clang/latest:toolchain_default",
-        "--extra_execution_platforms" : "@bazel_toolchains//configs/ubuntu16_04_clang/latest:platform",
-        "--host_platform" : "@bazel_toolchains//configs/ubuntu16_04_clang/latest:platform",
-        "--platforms" : "@bazel_toolchains//configs/ubuntu16_04_clang/latest:platform",
+        "--extra_toolchains": "@bazel_toolchains//configs/ubuntu16_04_clang/latest:toolchain_default",
+        "--extra_execution_platforms": "@bazel_toolchains//configs/ubuntu16_04_clang/latest:platform",
+        "--host_platform": "@bazel_toolchains//configs/ubuntu16_04_clang/latest:platform",
+        "--platforms": "@bazel_toolchains//configs/ubuntu16_04_clang/latest:platform",
     }
     for platform_flag, value in list(platform_flags.items()):
         found = False
@@ -976,34 +1198,40 @@
 def execute_bazel_build(bazel_binary, platform, flags, targets, bep_file, incompatible_flags):
     print_expanded_group(":bazel: Build")
 
-    aggregated_flags = compute_flags(platform, flags, incompatible_flags, bep_file, enable_remote_cache=True)
+    aggregated_flags = compute_flags(
+        platform, flags, incompatible_flags, bep_file, enable_remote_cache=True
+    )
     try:
-        execute_command([bazel_binary] + common_startup_flags(platform) + ["build"] + aggregated_flags + targets)
+        execute_command(
+            [bazel_binary] + common_startup_flags(platform) + ["build"] + aggregated_flags + targets
+        )
     except subprocess.CalledProcessError as e:
-        raise BazelBuildFailedException(
-            "bazel build failed with exit code {}".format(e.returncode))
+        raise BazelBuildFailedException("bazel build failed with exit code {}".format(e.returncode))
 
 
-def execute_bazel_test(bazel_binary, platform, flags, targets, bep_file, monitor_flaky_tests, incompatible_flags):
+def execute_bazel_test(
+    bazel_binary, platform, flags, targets, bep_file, monitor_flaky_tests, incompatible_flags
+):
     print_expanded_group(":bazel: Test")
 
-    aggregated_flags = ["--flaky_test_attempts=3",
-                        "--build_tests_only",
-                        "--local_test_jobs=" + concurrent_test_jobs(platform)]
+    aggregated_flags = [
+        "--flaky_test_attempts=3",
+        "--build_tests_only",
+        "--local_test_jobs=" + concurrent_test_jobs(platform),
+    ]
     # Don't enable remote caching if the user enabled remote execution / caching themselves
     # or flaky test monitoring is enabled, as remote caching makes tests look less flaky than
     # they are.
-    aggregated_flags += compute_flags(platform,
-                                      flags,
-                                      incompatible_flags,
-                                      bep_file,
-                                      enable_remote_cache=not monitor_flaky_tests)
+    aggregated_flags += compute_flags(
+        platform, flags, incompatible_flags, bep_file, enable_remote_cache=not monitor_flaky_tests
+    )
 
     try:
-        execute_command([bazel_binary] + common_startup_flags(platform) + ["test"] + aggregated_flags + targets)
+        execute_command(
+            [bazel_binary] + common_startup_flags(platform) + ["test"] + aggregated_flags + targets
+        )
     except subprocess.CalledProcessError as e:
-        raise BazelTestFailedException(
-            "bazel test failed with exit code {}".format(e.returncode))
+        raise BazelTestFailedException("bazel test failed with exit code {}".format(e.returncode))
 
 
 def upload_test_logs(bep_file, tmpdir):
@@ -1075,8 +1303,7 @@
                 outputs = bep_obj["testSummary"]["failed"]
                 test_logs = []
                 for output in outputs:
-                    test_logs.append(url2pathname(
-                        urlparse(output["uri"]).path))
+                    test_logs.append(url2pathname(urlparse(output["uri"]).path))
                 targets.append((test_target, test_logs))
         pos += size + 1
     return targets
@@ -1089,7 +1316,7 @@
 
 def execute_command_background(args):
     eprint(" ".join(args))
-    #return subprocess.Popen(args, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, env=os.environ)
+    # return subprocess.Popen(args, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, env=os.environ)
     return subprocess.Popen(args, env=os.environ)
 
 
@@ -1109,8 +1336,16 @@
     return user[0]
 
 
-def print_project_pipeline(platform_configs, project_name, http_config, file_config,
-                           git_repository, monitor_flaky_tests, use_but, incompatible_flags):
+def print_project_pipeline(
+    platform_configs,
+    project_name,
+    http_config,
+    file_config,
+    git_repository,
+    monitor_flaky_tests,
+    use_but,
+    incompatible_flags,
+):
     if not platform_configs:
         raise BuildkiteException("{0} pipeline configuration is empty.".format(project_name))
 
@@ -1118,24 +1353,41 @@
     if is_pull_request():
         commit_author = github_user_for_pull_request()
         trusted_git_repository = git_repository or os.getenv("BUILDKITE_REPO")
-        if (is_pull_request()
-                and not os.getenv("BUILDKITE_PULL_REQUEST_REPO").startswith("git://github.com/bazelbuild/")
-                and not is_trusted_author(commit_author, trusted_git_repository)):
+        if (
+            is_pull_request()
+            and not os.getenv("BUILDKITE_PULL_REQUEST_REPO").startswith(
+                "git://github.com/bazelbuild/"
+            )
+            and not is_trusted_author(commit_author, trusted_git_repository)
+        ):
             commit = os.getenv("BUILDKITE_COMMIT")
             update_pull_request_verification_status(trusted_git_repository, commit, state="pending")
-            pipeline_steps.append({
-                "block": "Verify Pull Request",
-                "prompt": "Did you review this pull request for malicious code?"
-            })
+            pipeline_steps.append(
+                {
+                    "block": "Verify Pull Request",
+                    "prompt": "Did you review this pull request for malicious code?",
+                }
+            )
 
     # In Bazel Downstream Project pipelines, git_repository and project_name must be specified,
     # and we should test the project at the last green commit.
     git_commit = None
     if (use_but or incompatible_flags) and git_repository and project_name:
-        git_commit = get_last_green_commit(git_repository, DOWNSTREAM_PROJECTS[project_name]["pipeline_slug"])
+        git_commit = get_last_green_commit(
+            git_repository, DOWNSTREAM_PROJECTS[project_name]["pipeline_slug"]
+        )
     for platform in platform_configs:
-        step = runner_step(platform, project_name, http_config, file_config,
-                           git_repository, git_commit, monitor_flaky_tests, use_but, incompatible_flags)
+        step = runner_step(
+            platform,
+            project_name,
+            http_config,
+            file_config,
+            git_repository,
+            git_commit,
+            monitor_flaky_tests,
+            use_but,
+            incompatible_flags,
+        )
         pipeline_steps.append(step)
 
     pipeline_slug = os.getenv("BUILDKITE_PIPELINE_SLUG")
@@ -1148,26 +1400,41 @@
     #   3. This job doesn't run on master branch (Could be a custom build launched manually)
     #   4. We don't intend to run the same job in downstream with Bazel@HEAD (eg. google-bazel-presubmit)
     #   5. We are testing incompatible flags
-    if not (is_pull_request() or use_but or os.getenv("BUILDKITE_BRANCH") != "master" or \
-       pipeline_slug not in all_downstream_pipeline_slugs or incompatible_flags):
+    if not (
+        is_pull_request()
+        or use_but
+        or os.getenv("BUILDKITE_BRANCH") != "master"
+        or pipeline_slug not in all_downstream_pipeline_slugs
+        or incompatible_flags
+    ):
         pipeline_steps.append("wait")
 
         # If all builds succeed, update the last green commit of this project
-        pipeline_steps.append({
-            "label": "Try Update Last Green Commit",
-            "command": [
-                fetch_bazelcipy_command(),
-                python_binary() + " bazelci.py try_update_last_green_commit"
-            ],
-            "agents": {
-                "kind": "pipeline"
+        pipeline_steps.append(
+            {
+                "label": "Try Update Last Green Commit",
+                "command": [
+                    fetch_bazelcipy_command(),
+                    python_binary() + " bazelci.py try_update_last_green_commit",
+                ],
+                "agents": {"kind": "pipeline"},
             }
-        })
+        )
 
     print(yaml.dump({"steps": pipeline_steps}))
 
-def runner_step(platform, project_name=None, http_config=None, file_config=None,
-                git_repository=None, git_commit=None, monitor_flaky_tests=False, use_but=False, incompatible_flags=None):
+
+def runner_step(
+    platform,
+    project_name=None,
+    http_config=None,
+    file_config=None,
+    git_repository=None,
+    git_commit=None,
+    monitor_flaky_tests=False,
+    use_but=False,
+    incompatible_flags=None,
+):
     host_platform = PLATFORMS[platform].get("host-platform", platform)
     command = python_binary(host_platform) + " bazelci.py runner --platform=" + platform
     if http_config:
@@ -1182,34 +1449,36 @@
         command += " --monitor_flaky_tests"
     if use_but:
         command += " --use_but"
-    for flag in (incompatible_flags or []):
+    for flag in incompatible_flags or []:
         command += " --incompatible_flag=" + flag
     label = create_label(platform, project_name)
     return {
         "label": label,
-        "command": [
-            fetch_bazelcipy_command(),
-            command
-        ],
+        "command": [fetch_bazelcipy_command(), command],
         "agents": {
             "kind": "worker",
             "java": PLATFORMS[platform]["java"],
-            "os": rchop(host_platform, "_nojava", "_java8", "_java9", "_java10")
-        }
+            "os": rchop(host_platform, "_nojava", "_java8", "_java9", "_java10"),
+        },
     }
 
 
 def fetch_bazelcipy_command():
     return "curl -s {0} -o bazelci.py".format(bazelcipy_url())
 
+
 def fetch_incompatible_flag_verbose_failures_command():
-    return "curl -s {0} -o incompatible_flag_verbose_failures.py".format(incompatible_flag_verbose_failures_url())
+    return "curl -s {0} -o incompatible_flag_verbose_failures.py".format(
+        incompatible_flag_verbose_failures_url()
+    )
 
 
-def upload_project_pipeline_step(project_name, git_repository, http_config, file_config, incompatible_flags):
-    pipeline_command = ("{0} bazelci.py project_pipeline --project_name=\"{1}\" " +
-                        "--git_repository={2}").format(python_binary(), project_name,
-                                                                 git_repository)
+def upload_project_pipeline_step(
+    project_name, git_repository, http_config, file_config, incompatible_flags
+):
+    pipeline_command = (
+        '{0} bazelci.py project_pipeline --project_name="{1}" ' + "--git_repository={2}"
+    ).format(python_binary(), project_name, git_repository)
     if incompatible_flags == None:
         pipeline_command += " --use_but"
     else:
@@ -1223,19 +1492,14 @@
 
     return {
         "label": "Setup {0}".format(project_name),
-        "command": [
-            fetch_bazelcipy_command(),
-            pipeline_command
-        ],
-        "agents": {
-            "kind": "pipeline"
-        }
+        "command": [fetch_bazelcipy_command(), pipeline_command],
+        "agents": {"kind": "pipeline"},
     }
 
+
 def create_label(platform, project_name, build_only=False, test_only=False):
     if build_only and test_only:
-        raise BuildkiteException(
-            "build_only and test_only cannot be true at the same time")
+        raise BuildkiteException("build_only and test_only cannot be true at the same time")
     platform_name = PLATFORMS[platform]["emoji-name"]
 
     if build_only:
@@ -1253,7 +1517,9 @@
     return label
 
 
-def bazel_build_step(platform, project_name, http_config=None, file_config=None, build_only=False, test_only=False):
+def bazel_build_step(
+    platform, project_name, http_config=None, file_config=None, build_only=False, test_only=False
+):
     host_platform = PLATFORMS[platform].get("host-platform", platform)
     pipeline_command = python_binary(host_platform) + " bazelci.py runner"
     if build_only:
@@ -1270,15 +1536,12 @@
 
     return {
         "label": create_label(platform, project_name, build_only, test_only),
-        "command": [
-            fetch_bazelcipy_command(),
-            pipeline_command
-        ],
+        "command": [fetch_bazelcipy_command(), pipeline_command],
         "agents": {
             "kind": "worker",
             "java": PLATFORMS[platform]["java"],
-            "os": rchop(host_platform, "_nojava", "_java8", "_java9", "_java10")
-        }
+            "os": rchop(host_platform, "_nojava", "_java8", "_java9", "_java10"),
+        },
     }
 
 
@@ -1292,29 +1555,34 @@
         if not PLATFORMS[platform]["publish_binary"]:
             del configs[platform]
 
-    if set(configs) != set(name for name, platform in PLATFORMS.items() if platform["publish_binary"]):
-        raise BuildkiteException("Bazel publish binaries pipeline needs to build Bazel for every commit on all publish_binary-enabled platforms.")
+    if set(configs) != set(
+        name for name, platform in PLATFORMS.items() if platform["publish_binary"]
+    ):
+        raise BuildkiteException(
+            "Bazel publish binaries pipeline needs to build Bazel for every commit on all publish_binary-enabled platforms."
+        )
 
     # Build Bazel
     pipeline_steps = []
 
     for platform in configs:
-        pipeline_steps.append(bazel_build_step(
-            platform, "Bazel", http_config, file_config, build_only=True))
+        pipeline_steps.append(
+            bazel_build_step(platform, "Bazel", http_config, file_config, build_only=True)
+        )
 
     pipeline_steps.append("wait")
 
     # If all builds succeed, publish the Bazel binaries to GCS.
-    pipeline_steps.append({
-        "label": "Publish Bazel Binaries",
-        "command": [
-            fetch_bazelcipy_command(),
-            python_binary() + " bazelci.py publish_binaries"
-        ],
-        "agents": {
-            "kind": "pipeline"
+    pipeline_steps.append(
+        {
+            "label": "Publish Bazel Binaries",
+            "command": [
+                fetch_bazelcipy_command(),
+                python_binary() + " bazelci.py publish_binaries",
+            ],
+            "agents": {"kind": "pipeline"},
         }
-    })
+    )
 
     print(yaml.dump({"steps": pipeline_steps}))
 
@@ -1331,11 +1599,9 @@
     return {
         "label": ":sadpanda:",
         "command": [
-            "buildkite-agent annotate --append --style=info \"\n" + "\n".join(info_text) + "\n\"",
+            'buildkite-agent annotate --append --style=info "\n' + "\n".join(info_text) + '\n"'
         ],
-        "agents": {
-            "kind": "pipeline"
-        }
+        "agents": {"kind": "pipeline"},
     }
 
 
@@ -1350,11 +1616,9 @@
     return {
         "label": "Incompatible flags info",
         "command": [
-            "buildkite-agent annotate --append --style=info \"\n" + "\n".join(info_text) + "\n\"",
+            'buildkite-agent annotate --append --style=info "\n' + "\n".join(info_text) + '\n"'
         ],
-        "agents": {
-            "kind": "pipeline"
-        }
+        "agents": {"kind": "pipeline"},
     }
 
 
@@ -1363,10 +1627,18 @@
     Return a list of incompatible flags to be tested in downstream with the current release Bazel
     """
     # Get bazel major version on CI, eg. 0.21 from "Build label: 0.21.0\n..."
-    output = subprocess.check_output(["bazel", "--nomaster_bazelrc", "--bazelrc=/dev/null", "version"]).decode("utf-8")
+    output = subprocess.check_output(
+        ["bazel", "--nomaster_bazelrc", "--bazelrc=/dev/null", "version"]
+    ).decode("utf-8")
     bazel_major_version = output.split()[2].rsplit(".", 1)[0]
 
-    output = subprocess.check_output(["curl", "https://api.github.com/search/issues?q=repo:bazelbuild/bazel+label:migration-%s+state:open" % bazel_major_version]).decode("utf-8")
+    output = subprocess.check_output(
+        [
+            "curl",
+            "https://api.github.com/search/issues?q=repo:bazelbuild/bazel+label:migration-%s+state:open"
+            % bazel_major_version,
+        ]
+    ).decode("utf-8")
     issue_info = json.loads(output)
 
     incompatible_flags = {}
@@ -1378,17 +1650,25 @@
         if name.startswith("--incompatible_"):
             incompatible_flags[name] = url
         else:
-            eprint("%s is not recognized as an incompatible flag, please modify the issue title of %s to \"<incompatible flag name (without --)>:...\"" % (name, url))
+            eprint(
+                '%s is not recognized as an incompatible flag, please modify the issue title of %s to "<incompatible flag name (without --)>:..."'
+                % (name, url)
+            )
 
     return incompatible_flags
 
 
-def print_bazel_downstream_pipeline(configs, http_config, file_config, test_incompatible_flags, test_disabled_projects):
+def print_bazel_downstream_pipeline(
+    configs, http_config, file_config, test_incompatible_flags, test_disabled_projects
+):
     if not configs:
         raise BuildkiteException("Bazel downstream pipeline configuration is empty.")
 
     if set(configs) != set(PLATFORMS):
-        raise BuildkiteException("Bazel downstream pipeline needs to build Bazel on all supported platforms (has=%s vs. want=%s)." % (sorted(set(configs)), sorted(set(PLATFORMS))))
+        raise BuildkiteException(
+            "Bazel downstream pipeline needs to build Bazel on all supported platforms (has=%s vs. want=%s)."
+            % (sorted(set(configs)), sorted(set(PLATFORMS)))
+        )
 
     pipeline_steps = []
 
@@ -1398,7 +1678,8 @@
 
     for platform in configs:
         pipeline_steps.append(
-            bazel_build_step(platform, "Bazel", http_config, file_config, build_only=True))
+            bazel_build_step(platform, "Bazel", http_config, file_config, build_only=True)
+        )
 
     pipeline_steps.append("wait")
 
@@ -1414,39 +1695,45 @@
         disabled_reason = config.get("disabled_reason", None)
         # If test_disabled_projects is true, we add configs for disabled projects.
         # If test_disabled_projects is false, we add configs for not disbaled projects.
-        if (test_disabled_projects and disabled_reason) or (not test_disabled_projects and not disabled_reason):
+        if (test_disabled_projects and disabled_reason) or (
+            not test_disabled_projects and not disabled_reason
+        ):
             pipeline_steps.append(
-                upload_project_pipeline_step(project_name=project,
-                                             git_repository=config["git_repository"],
-                                             http_config=config.get("http_config", None),
-                                             file_config=config.get("file_config", None),
-                                             incompatible_flags=incompatible_flags))
+                upload_project_pipeline_step(
+                    project_name=project,
+                    git_repository=config["git_repository"],
+                    http_config=config.get("http_config", None),
+                    file_config=config.get("file_config", None),
+                    incompatible_flags=incompatible_flags,
+                )
+            )
 
     if test_incompatible_flags:
-        pipeline_steps.append({
-            "wait": "~",
-            "continue_on_failure": "true"
-        })
+        pipeline_steps.append({"wait": "~", "continue_on_failure": "true"})
         current_build_number = os.environ.get("BUILDKITE_BUILD_NUMBER", None)
         if not current_build_number:
             raise BuildkiteException("Not running inside Buildkite")
-        pipeline_steps.append({
-            "label": "Test failing jobs with incompatible flag separately",
-            "command": [
-                fetch_bazelcipy_command(),
-                fetch_incompatible_flag_verbose_failures_command(),
-                python_binary() + " incompatible_flag_verbose_failures.py --build_number=%s | buildkite-agent pipeline upload" % current_build_number,
-            ],
-            "agents": {
-                "kind": "pipeline"
+        pipeline_steps.append(
+            {
+                "label": "Test failing jobs with incompatible flag separately",
+                "command": [
+                    fetch_bazelcipy_command(),
+                    fetch_incompatible_flag_verbose_failures_command(),
+                    python_binary()
+                    + " incompatible_flag_verbose_failures.py --build_number=%s | buildkite-agent pipeline upload"
+                    % current_build_number,
+                ],
+                "agents": {"kind": "pipeline"},
             }
-        })
+        )
 
     print(yaml.dump({"steps": pipeline_steps}))
 
 
 def bazelci_builds_download_url(platform, git_commit):
-    return "https://storage.googleapis.com/bazel-builds/artifacts/{0}/{1}/bazel".format(platform, git_commit)
+    return "https://storage.googleapis.com/bazel-builds/artifacts/{0}/{1}/bazel".format(
+        platform, git_commit
+    )
 
 
 def bazelci_builds_gs_url(platform, git_commit):
@@ -1458,13 +1745,22 @@
 
 
 def bazelci_last_green_commit_url(git_repository, pipeline_slug):
-    return "gs://bazel-builds/last_green_commit/%s/%s" % (git_repository[len("https://"):], pipeline_slug)
+    return "gs://bazel-builds/last_green_commit/%s/%s" % (
+        git_repository[len("https://") :],
+        pipeline_slug,
+    )
 
 
 def get_last_green_commit(git_repository, pipeline_slug):
     last_green_commit_url = bazelci_last_green_commit_url(git_repository, pipeline_slug)
     try:
-        return subprocess.check_output([gsutil_command(), "cat", last_green_commit_url], env=os.environ).decode("utf-8").strip()
+        return (
+            subprocess.check_output(
+                [gsutil_command(), "cat", last_green_commit_url], env=os.environ
+            )
+            .decode("utf-8")
+            .strip()
+        )
     except subprocess.CalledProcessError:
         return None
 
@@ -1475,21 +1771,42 @@
     last_green_commit = get_last_green_commit(git_repository, pipeline_slug)
     current_commit = subprocess.check_output(["git", "rev-parse", "HEAD"]).decode("utf-8").strip()
     if last_green_commit:
-        result = subprocess.check_output(["git", "rev-list", "%s..%s" % (last_green_commit, current_commit)]).decode("utf-8").strip()
+        result = (
+            subprocess.check_output(
+                ["git", "rev-list", "%s..%s" % (last_green_commit, current_commit)]
+            )
+            .decode("utf-8")
+            .strip()
+        )
 
     # If current_commit is newer that last_green_commit, `git rev-list A..B` will output a bunch of commits,
     # otherwise the output should be empty.
     if not last_green_commit or result:
-        execute_command(["echo %s | %s cp - %s" % (current_commit, gsutil_command(), bazelci_last_green_commit_url(git_repository, pipeline_slug))], shell = True)
+        execute_command(
+            [
+                "echo %s | %s cp - %s"
+                % (
+                    current_commit,
+                    gsutil_command(),
+                    bazelci_last_green_commit_url(git_repository, pipeline_slug),
+                )
+            ],
+            shell=True,
+        )
     else:
-        eprint("Updating abandoned: last green commit (%s) is not older than current commit (%s)." % (last_green_commit, current_commit))
+        eprint(
+            "Updating abandoned: last green commit (%s) is not older than current commit (%s)."
+            % (last_green_commit, current_commit)
+        )
+
 
 def latest_generation_and_build_number():
     output = None
     attempt = 0
     while attempt < 5:
         output = subprocess.check_output(
-            [gsutil_command(), "stat", bazelci_builds_metadata_url()], env=os.environ)
+            [gsutil_command(), "stat", bazelci_builds_metadata_url()], env=os.environ
+        )
         match = re.search("Generation:[ ]*([0-9]+)", output.decode("utf-8"))
         if not match:
             raise BuildkiteException("Couldn't parse generation. gsutil output format changed?")
@@ -1501,7 +1818,8 @@
         expected_md5hash = base64.b64decode(match.group(1))
 
         output = subprocess.check_output(
-            [gsutil_command(), "cat", bazelci_builds_metadata_url()], env=os.environ)
+            [gsutil_command(), "cat", bazelci_builds_metadata_url()], env=os.environ
+        )
         hasher = hashlib.md5()
         hasher.update(output)
         actual_md5hash = hasher.digest()
@@ -1528,14 +1846,22 @@
         "build_number": build_number,
         "build_time": now.strftime("%d-%m-%Y %H:%M"),
         "git_commit": git_commit,
-        "platforms": {}
+        "platforms": {},
     }
     for platform in (name for name in PLATFORMS if PLATFORMS[name]["publish_binary"]):
         tmpdir = tempfile.mkdtemp()
         try:
             bazel_binary_path = download_bazel_binary(tmpdir, platform)
-            execute_command([gsutil_command(), "cp", "-a", "public-read", bazel_binary_path,
-                             bazelci_builds_gs_url(platform, git_commit)])
+            execute_command(
+                [
+                    gsutil_command(),
+                    "cp",
+                    "-a",
+                    "public-read",
+                    bazel_binary_path,
+                    bazelci_builds_gs_url(platform, git_commit),
+                ]
+            )
             info["platforms"][platform] = {
                 "url": bazelci_builds_download_url(platform, git_commit),
                 "sha256": sha256_hexdigest(bazel_binary_path),
@@ -1549,12 +1875,20 @@
             json.dump(info, fp, indent=2, sort_keys=True)
 
         try:
-            execute_command([
-                gsutil_command(),
-                "-h", "x-goog-if-generation-match:" + expected_generation,
-                "-h", "Content-Type:application/json",
-                "cp", "-a", "public-read",
-                info_file, bazelci_builds_metadata_url()])
+            execute_command(
+                [
+                    gsutil_command(),
+                    "-h",
+                    "x-goog-if-generation-match:" + expected_generation,
+                    "-h",
+                    "Content-Type:application/json",
+                    "cp",
+                    "-a",
+                    "public-read",
+                    info_file,
+                    bazelci_builds_metadata_url(),
+                ]
+            )
         except subprocess.CalledProcessError:
             raise BinaryUploadRaceException()
     finally:
@@ -1574,9 +1908,12 @@
         latest_generation, latest_build_number = latest_generation_and_build_number()
 
         if current_build_number <= latest_build_number:
-            eprint(("Current build '{0}' is not newer than latest published '{1}'. " +
-                    "Skipping publishing of binaries.").format(current_build_number,
-                                                               latest_build_number))
+            eprint(
+                (
+                    "Current build '{0}' is not newer than latest published '{1}'. "
+                    + "Skipping publishing of binaries."
+                ).format(current_build_number, latest_build_number)
+            )
             break
 
         try:
@@ -1585,19 +1922,23 @@
             # Retry.
             continue
 
-        eprint("Successfully updated '{0}' to binaries from build {1}."
-               .format(bazelci_builds_metadata_url(), current_build_number))
+        eprint(
+            "Successfully updated '{0}' to binaries from build {1}.".format(
+                bazelci_builds_metadata_url(), current_build_number
+            )
+        )
         break
     else:
-        raise BuildkiteException(
-            "Could not publish binaries, ran out of attempts.")
+        raise BuildkiteException("Could not publish binaries, ran out of attempts.")
+
 
 # This is so that multiline python strings are represnted as YAML
 # block strings
 def str_presenter(dumper, data):
-  if len(data.splitlines()) > 1:  # check for multiline string
-    return dumper.represent_scalar('tag:yaml.org,2002:str', data, style='|')
-  return dumper.represent_scalar('tag:yaml.org,2002:str', data)
+    if len(data.splitlines()) > 1:  # check for multiline string
+        return dumper.represent_scalar("tag:yaml.org,2002:str", data, style="|")
+    return dumper.represent_scalar("tag:yaml.org,2002:str", data)
+
 
 def main(argv=None):
     if argv is None:
@@ -1618,8 +1959,12 @@
     bazel_downstream_pipeline.add_argument("--file_config", type=str)
     bazel_downstream_pipeline.add_argument("--http_config", type=str)
     bazel_downstream_pipeline.add_argument("--git_repository", type=str)
-    bazel_downstream_pipeline.add_argument("--test_incompatible_flags", type=bool, nargs="?", const=True)
-    bazel_downstream_pipeline.add_argument("--test_disabled_projects", type=bool, nargs="?", const=True)
+    bazel_downstream_pipeline.add_argument(
+        "--test_incompatible_flags", type=bool, nargs="?", const=True
+    )
+    bazel_downstream_pipeline.add_argument(
+        "--test_disabled_projects", type=bool, nargs="?", const=True
+    )
 
     project_pipeline = subparsers.add_parser("project_pipeline")
     project_pipeline.add_argument("--project_name", type=str)
@@ -1628,22 +1973,30 @@
     project_pipeline.add_argument("--git_repository", type=str)
     project_pipeline.add_argument("--monitor_flaky_tests", type=bool, nargs="?", const=True)
     project_pipeline.add_argument("--use_but", type=bool, nargs="?", const=True)
-    project_pipeline.add_argument("--incompatible_flag", type=str, action='append')
+    project_pipeline.add_argument("--incompatible_flag", type=str, action="append")
 
     runner = subparsers.add_parser("runner")
     runner.add_argument("--platform", action="store", choices=list(PLATFORMS))
     runner.add_argument("--file_config", type=str)
     runner.add_argument("--http_config", type=str)
     runner.add_argument("--git_repository", type=str)
-    runner.add_argument("--git_commit", type=str, help="Reset the git repository to this commit after cloning it")
-    runner.add_argument("--git_repo_location", type=str, help="Use an existing repository instead of cloning from github")
-    runner.add_argument("--use_bazel_at_commit", type=str, help="Use Bazel binariy built at a specifc commit")
+    runner.add_argument(
+        "--git_commit", type=str, help="Reset the git repository to this commit after cloning it"
+    )
+    runner.add_argument(
+        "--git_repo_location",
+        type=str,
+        help="Use an existing repository instead of cloning from github",
+    )
+    runner.add_argument(
+        "--use_bazel_at_commit", type=str, help="Use Bazel binariy built at a specifc commit"
+    )
     runner.add_argument("--use_but", type=bool, nargs="?", const=True)
     runner.add_argument("--save_but", type=bool, nargs="?", const=True)
     runner.add_argument("--build_only", type=bool, nargs="?", const=True)
     runner.add_argument("--test_only", type=bool, nargs="?", const=True)
     runner.add_argument("--monitor_flaky_tests", type=bool, nargs="?", const=True)
-    runner.add_argument("--incompatible_flag", type=str, action='append')
+    runner.add_argument("--incompatible_flag", type=str, action="append")
 
     runner = subparsers.add_parser("publish_binaries")
 
@@ -1654,40 +2007,48 @@
     try:
         if args.subparsers_name == "bazel_publish_binaries_pipeline":
             configs = fetch_configs(args.http_config, args.file_config)
-            print_bazel_publish_binaries_pipeline(configs=configs.get("platforms", None),
-                                                  http_config=args.http_config,
-                                                  file_config=args.file_config)
+            print_bazel_publish_binaries_pipeline(
+                configs=configs.get("platforms", None),
+                http_config=args.http_config,
+                file_config=args.file_config,
+            )
         elif args.subparsers_name == "bazel_downstream_pipeline":
             configs = fetch_configs(args.http_config, args.file_config)
-            print_bazel_downstream_pipeline(configs=configs.get("platforms", None),
-                                            http_config=args.http_config,
-                                            file_config=args.file_config,
-                                            test_incompatible_flags=args.test_incompatible_flags,
-                                            test_disabled_projects=args.test_disabled_projects)
+            print_bazel_downstream_pipeline(
+                configs=configs.get("platforms", None),
+                http_config=args.http_config,
+                file_config=args.file_config,
+                test_incompatible_flags=args.test_incompatible_flags,
+                test_disabled_projects=args.test_disabled_projects,
+            )
         elif args.subparsers_name == "project_pipeline":
             configs = fetch_configs(args.http_config, args.file_config)
-            print_project_pipeline(platform_configs=configs.get("platforms", None),
-                                   project_name=args.project_name,
-                                   http_config=args.http_config,
-                                   file_config=args.file_config,
-                                   git_repository=args.git_repository,
-                                   monitor_flaky_tests=args.monitor_flaky_tests,
-                                   use_but=args.use_but,
-                                   incompatible_flags=args.incompatible_flag)
+            print_project_pipeline(
+                platform_configs=configs.get("platforms", None),
+                project_name=args.project_name,
+                http_config=args.http_config,
+                file_config=args.file_config,
+                git_repository=args.git_repository,
+                monitor_flaky_tests=args.monitor_flaky_tests,
+                use_but=args.use_but,
+                incompatible_flags=args.incompatible_flag,
+            )
         elif args.subparsers_name == "runner":
             configs = fetch_configs(args.http_config, args.file_config)
-            execute_commands(config=configs.get("platforms", None)[args.platform],
-                             platform=args.platform,
-                             git_repository=args.git_repository,
-                             git_commit=args.git_commit,
-                             git_repo_location=args.git_repo_location,
-                             use_bazel_at_commit=args.use_bazel_at_commit,
-                             use_but=args.use_but,
-                             save_but=args.save_but,
-                             build_only=args.build_only,
-                             test_only=args.test_only,
-                             monitor_flaky_tests=args.monitor_flaky_tests,
-                             incompatible_flags=args.incompatible_flag)
+            execute_commands(
+                config=configs.get("platforms", None)[args.platform],
+                platform=args.platform,
+                git_repository=args.git_repository,
+                git_commit=args.git_commit,
+                git_repo_location=args.git_repo_location,
+                use_bazel_at_commit=args.use_bazel_at_commit,
+                use_but=args.use_but,
+                save_but=args.save_but,
+                build_only=args.build_only,
+                test_only=args.test_only,
+                monitor_flaky_tests=args.monitor_flaky_tests,
+                incompatible_flags=args.incompatible_flag,
+            )
         elif args.subparsers_name == "publish_binaries":
             publish_binaries()
         elif args.subparsers_name == "try_update_last_green_commit":