Formatting: Format all python code with black.

This CL is probably not what you're looking for, it's only
automated formatting. Ignore it with
`git blame --ignore-rev <revision>` for this commit.

BUG=b:233893248
TEST=CQ

Change-Id: I66591d7a738d241aed3290138c0f68065ab10a6d
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/chromite/+/3879174
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Tested-by: Alex Klein <saklein@chromium.org>
diff --git a/scripts/repo_sync_manifest.py b/scripts/repo_sync_manifest.py
index 0f92b73..0cb8633 100644
--- a/scripts/repo_sync_manifest.py
+++ b/scripts/repo_sync_manifest.py
@@ -28,197 +28,233 @@
 
 
 def GetParser():
-  """Creates the argparse parser."""
-  parser = commandline.ArgumentParser(description=__doc__)
+    """Creates the argparse parser."""
+    parser = commandline.ArgumentParser(description=__doc__)
 
-  parser.add_argument('--repo-root', type='path', default='.',
-                      help='Path to the repo root to sync.')
+    parser.add_argument(
+        "--repo-root",
+        type="path",
+        default=".",
+        help="Path to the repo root to sync.",
+    )
 
-  manifest_group = parser.add_argument_group(
-      'Manifest',
-      description='What manifest do we sync?')
+    manifest_group = parser.add_argument_group(
+        "Manifest", description="What manifest do we sync?"
+    )
 
-  manifest_ex = manifest_group.add_mutually_exclusive_group()
-  manifest_ex.add_argument(
-      '--branch',
-      default='master',
-      help='Sync to top of given branch.')
-  manifest_ex.add_argument(
-      '--buildspec',
-      help='Path to manifest, relative to manifest-versions root.')
-  manifest_ex.add_argument(
-      '--version',
-      help='Shorthand for an official release buildspec. e.g. 9799.0.0')
-  manifest_ex.add_argument(
-      '--manifest-file', type='path',
-      help='Sync to an existing local manifest file.')
+    manifest_ex = manifest_group.add_mutually_exclusive_group()
+    manifest_ex.add_argument(
+        "--branch", default="master", help="Sync to top of given branch."
+    )
+    manifest_ex.add_argument(
+        "--buildspec",
+        help="Path to manifest, relative to manifest-versions root.",
+    )
+    manifest_ex.add_argument(
+        "--version",
+        help="Shorthand for an official release buildspec. e.g. 9799.0.0",
+    )
+    manifest_ex.add_argument(
+        "--manifest-file",
+        type="path",
+        help="Sync to an existing local manifest file.",
+    )
 
-  manifest_group.add_argument(
-      '--groups', help='manifest groups to sync.')
+    manifest_group.add_argument("--groups", help="manifest groups to sync.")
 
-  manifest_url_ex = manifest_group.add_mutually_exclusive_group()
-  manifest_url_ex.add_argument(
-      '--external', action='store_true', default=False,
-      help='Sync to the external version of a manifest. Switch from '
-           'manifest-versions-internal to manifest-versions for buildspecs. '
-           'Not usable with --manifest.')
-  manifest_url_ex.add_argument(
-      '--manifest-url', help='Manually set URL to fetch repo manifest from.')
+    manifest_url_ex = manifest_group.add_mutually_exclusive_group()
+    manifest_url_ex.add_argument(
+        "--external",
+        action="store_true",
+        default=False,
+        help="Sync to the external version of a manifest. Switch from "
+        "manifest-versions-internal to manifest-versions for buildspecs. "
+        "Not usable with --manifest.",
+    )
+    manifest_url_ex.add_argument(
+        "--manifest-url", help="Manually set URL to fetch repo manifest from."
+    )
 
-  patch_group = parser.add_argument_group(
-      'Patch',
-      description='Which patches should be included with the build?')
-  patch_group.add_argument(
-      '-g', '--gerrit-patches', action='split_extend', default=[],
-      metavar='Id1 *int_Id2...IdN',
-      help='Space-separated list of short-form Gerrit '
-           "Change-Id's or change numbers to patch. "
-           "Please prepend '*' to internal Change-Id's")
+    patch_group = parser.add_argument_group(
+        "Patch", description="Which patches should be included with the build?"
+    )
+    patch_group.add_argument(
+        "-g",
+        "--gerrit-patches",
+        action="split_extend",
+        default=[],
+        metavar="Id1 *int_Id2...IdN",
+        help="Space-separated list of short-form Gerrit "
+        "Change-Id's or change numbers to patch. "
+        "Please prepend '*' to internal Change-Id's",
+    )
 
-  resources_group = parser.add_argument_group(
-      'Resources',
-      description='External resources that might be needed.')
+    resources_group = parser.add_argument_group(
+        "Resources", description="External resources that might be needed."
+    )
 
-  resources_group.add_argument(
-      '--manifest-versions-int', type='path',
-      help='Directory for internal manifest versions checkout. '
-           'May be refreshed.')
+    resources_group.add_argument(
+        "--manifest-versions-int",
+        type="path",
+        help="Directory for internal manifest versions checkout. "
+        "May be refreshed.",
+    )
 
-  resources_group.add_argument(
-      '--manifest-versions-ext', type='path',
-      help='Directory for internal manifest versions checkout. '
-           'May be refreshed.')
+    resources_group.add_argument(
+        "--manifest-versions-ext",
+        type="path",
+        help="Directory for internal manifest versions checkout. "
+        "May be refreshed.",
+    )
 
-  optimization_group = parser.add_argument_group(
-      'Optimization',
-      description='Hints provided to possibly speed up initial sync.')
+    optimization_group = parser.add_argument_group(
+        "Optimization",
+        description="Hints provided to possibly speed up initial sync.",
+    )
 
-  optimization_group.add_argument(
-      '--copy-repo', type='path',
-      help='Path to an existing repo root. Used to preload the local '
-           "checkout if the local checkout doesn't exist.")
-  optimization_group.add_argument(
-      '--git-cache-dir', type='path',
-      help='Git cache directory to use.')
-  optimization_group.add_argument(
-      '--repo-url', help='Repo repository location.')
+    optimization_group.add_argument(
+        "--copy-repo",
+        type="path",
+        help="Path to an existing repo root. Used to preload the local "
+        "checkout if the local checkout doesn't exist.",
+    )
+    optimization_group.add_argument(
+        "--git-cache-dir", type="path", help="Git cache directory to use."
+    )
+    optimization_group.add_argument(
+        "--repo-url", help="Repo repository location."
+    )
 
-  return parser
+    return parser
 
 
 def PrepareManifestVersions(options):
-  """Select manifest-versions checkout to use, and update it.
+    """Select manifest-versions checkout to use, and update it.
 
-  Looks at command line options to decide which manifest-versions checkout to
-  use, and updates (or creates) it as needed.
+    Looks at command line options to decide which manifest-versions checkout to
+    use, and updates (or creates) it as needed.
 
-  Args:
-    options: Parsed command line options.
+    Args:
+      options: Parsed command line options.
 
-  Returns:
-    Full path to manifest-versions directory to use for this sync.
+    Returns:
+      Full path to manifest-versions directory to use for this sync.
 
-  Raises:
-    AssertionError: If the needed manifest-versions path wasn't con the
-      command line.
-  """
-  site_params = config_lib.GetSiteParams()
+    Raises:
+      AssertionError: If the needed manifest-versions path wasn't con the
+        command line.
+    """
+    site_params = config_lib.GetSiteParams()
 
-  if options.external:
-    assert options.manifest_versions_ext, '--manifest-versions-ext required.'
-    manifest_versions_url = site_params.MANIFEST_VERSIONS_GOB_URL
-    manifest_versions_path = options.manifest_versions_ext
-  else:
-    assert options.manifest_versions_int, '--manifest-versions-int required.'
-    manifest_versions_url = site_params.MANIFEST_VERSIONS_INT_GOB_URL
-    manifest_versions_path = options.manifest_versions_int
+    if options.external:
+        assert (
+            options.manifest_versions_ext
+        ), "--manifest-versions-ext required."
+        manifest_versions_url = site_params.MANIFEST_VERSIONS_GOB_URL
+        manifest_versions_path = options.manifest_versions_ext
+    else:
+        assert (
+            options.manifest_versions_int
+        ), "--manifest-versions-int required."
+        manifest_versions_url = site_params.MANIFEST_VERSIONS_INT_GOB_URL
+        manifest_versions_path = options.manifest_versions_int
 
-  # Resolve buildspecs against a current manifest versions value.
-  manifest_version.RefreshManifestCheckout(
-      manifest_versions_path, manifest_versions_url)
+    # Resolve buildspecs against a current manifest versions value.
+    manifest_version.RefreshManifestCheckout(
+        manifest_versions_path, manifest_versions_url
+    )
 
-  return manifest_versions_path
+    return manifest_versions_path
 
 
 def ResolveLocalManifestPath(options):
-  """Based on command line options, decide what local manifest file to use.
+    """Based on command line options, decide what local manifest file to use.
 
-  Args:
-    options: Our parsed command line options.
+    Args:
+      options: Our parsed command line options.
 
-  Returns:
-    Path to local manifest file to use, or None for no file.
-  """
-  if options.manifest_file:
-    # If the user gives us an explicit local manifest file, use it.
-    return options.manifest_file
+    Returns:
+      Path to local manifest file to use, or None for no file.
+    """
+    if options.manifest_file:
+        # If the user gives us an explicit local manifest file, use it.
+        return options.manifest_file
 
-  elif options.buildspec:
-    # Buildspec builds use a manifest file from manifest_versions. We do NOT
-    # use manifest_versions as the manifest git repo, because it's so large that
-    # sync time would be a major performance problem.
-    manifest_versions_path = PrepareManifestVersions(options)
-    return manifest_version.ResolveBuildspec(
-        manifest_versions_path, options.buildspec)
+    elif options.buildspec:
+        # Buildspec builds use a manifest file from manifest_versions. We do NOT
+        # use manifest_versions as the manifest git repo, because it's so large that
+        # sync time would be a major performance problem.
+        manifest_versions_path = PrepareManifestVersions(options)
+        return manifest_version.ResolveBuildspec(
+            manifest_versions_path, options.buildspec
+        )
 
-  elif options.version:
-    # Versions are a short hand version of a buildspec.
-    manifest_versions_path = PrepareManifestVersions(options)
-    return manifest_version.ResolveBuildspecVersion(
-        manifest_versions_path, options.version)
+    elif options.version:
+        # Versions are a short hand version of a buildspec.
+        manifest_versions_path = PrepareManifestVersions(options)
+        return manifest_version.ResolveBuildspecVersion(
+            manifest_versions_path, options.version
+        )
 
-  elif options.branch:
-    # Branch checkouts use our normal manifest repos, not a local manifest file.
-    return None
+    elif options.branch:
+        # Branch checkouts use our normal manifest repos, not a local manifest file.
+        return None
 
-  else:
-    assert False, 'No sync options specified. Should not be possible.'
+    else:
+        assert False, "No sync options specified. Should not be possible."
 
 
 def main(argv):
-  parser = GetParser()
-  options = parser.parse_args(argv)
-  options.Freeze()
+    parser = GetParser()
+    options = parser.parse_args(argv)
+    options.Freeze()
 
-  local_manifest = ResolveLocalManifestPath(options)
+    local_manifest = ResolveLocalManifestPath(options)
 
-  if local_manifest:
-    logging.info('Using local_manifest: %s', local_manifest)
+    if local_manifest:
+        logging.info("Using local_manifest: %s", local_manifest)
 
-  if options.manifest_url:
-    manifest_url = options.manifest_url
-  elif options.external:
-    manifest_url = config_lib.GetSiteParams().MANIFEST_URL
-  else:
-    manifest_url = config_lib.GetSiteParams().MANIFEST_INT_URL
+    if options.manifest_url:
+        manifest_url = options.manifest_url
+    elif options.external:
+        manifest_url = config_lib.GetSiteParams().MANIFEST_URL
+    else:
+        manifest_url = config_lib.GetSiteParams().MANIFEST_INT_URL
 
-  osutils.SafeMakedirs(options.repo_root)
-  repo = repository.RepoRepository(
-      manifest_repo_url=manifest_url,
-      directory=options.repo_root,
-      branch=options.branch,
-      git_cache_dir=options.git_cache_dir,
-      repo_url=options.repo_url,
-      groups=options.groups)
+    osutils.SafeMakedirs(options.repo_root)
+    repo = repository.RepoRepository(
+        manifest_repo_url=manifest_url,
+        directory=options.repo_root,
+        branch=options.branch,
+        git_cache_dir=options.git_cache_dir,
+        repo_url=options.repo_url,
+        groups=options.groups,
+    )
 
-  if options.copy_repo:
-    repo.PreLoad(options.copy_repo)
+    if options.copy_repo:
+        repo.PreLoad(options.copy_repo)
 
-  repo.Sync(local_manifest=local_manifest, detach=True)
+    repo.Sync(local_manifest=local_manifest, detach=True)
 
-  if options.gerrit_patches:
-    patches = gerrit.GetGerritPatchInfo(options.gerrit_patches)
-    # TODO: Extract patches from manifest synced.
+    if options.gerrit_patches:
+        patches = gerrit.GetGerritPatchInfo(options.gerrit_patches)
+        # TODO: Extract patches from manifest synced.
 
-    helper_pool = patch_series.HelperPool.SimpleCreate(
-        cros_internal=not options.external, cros=True)
+        helper_pool = patch_series.HelperPool.SimpleCreate(
+            cros_internal=not options.external, cros=True
+        )
 
-    series = patch_series.PatchSeries(
-        path=options.repo_root, helper_pool=helper_pool, forced_manifest=None)
+        series = patch_series.PatchSeries(
+            path=options.repo_root,
+            helper_pool=helper_pool,
+            forced_manifest=None,
+        )
 
-    _, failed_tot, failed_inflight = series.Apply(patches)
+        _, failed_tot, failed_inflight = series.Apply(patches)
 
-    failed = failed_tot + failed_inflight
-    if failed:
-      logging.error('Failed to apply: %s', ', '.join(str(p) for p in failed))
-      return 1
+        failed = failed_tot + failed_inflight
+        if failed:
+            logging.error(
+                "Failed to apply: %s", ", ".join(str(p) for p in failed)
+            )
+            return 1