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/cros.py b/scripts/cros.py
index b071f20..2d76b0a 100644
--- a/scripts/cros.py
+++ b/scripts/cros.py
@@ -21,92 +21,100 @@
 
 
 def GetOptions(cmd_name=None):
-  """Returns the parser to use for commandline parsing.
+    """Returns the parser to use for commandline parsing.
 
-  Args:
-    cmd_name: The subcommand to import & add.
+    Args:
+      cmd_name: The subcommand to import & add.
 
-  Returns:
-    A commandline.ArgumentParser object.
-  """
-  parser = commandline.ArgumentParser(caching=True, default_log_level='notice')
+    Returns:
+      A commandline.ArgumentParser object.
+    """
+    parser = commandline.ArgumentParser(
+        caching=True, default_log_level="notice"
+    )
 
-  subparsers = parser.add_subparsers(title='Subcommands', dest='subcommand')
-  subparsers.required = True
+    subparsers = parser.add_subparsers(title="Subcommands", dest="subcommand")
+    subparsers.required = True
 
-  # We add all the commands so `cros --help ...` looks reasonable.
-  # We add them in order also so the --help output is stable for users.
-  for subcommand in sorted(command.ListCommands()):
-    if subcommand == cmd_name:
-      class_def = command.ImportCommand(cmd_name)
-      epilog = getattr(class_def, 'EPILOG', None)
-      sub_parser = subparsers.add_parser(
-          cmd_name, description=class_def.__doc__, epilog=epilog,
-          caching=class_def.use_caching_options,
-          formatter_class=argparse.RawDescriptionHelpFormatter)
-      class_def.AddParser(sub_parser)
-    else:
-      subparsers.add_parser(subcommand, add_help=False)
+    # We add all the commands so `cros --help ...` looks reasonable.
+    # We add them in order also so the --help output is stable for users.
+    for subcommand in sorted(command.ListCommands()):
+        if subcommand == cmd_name:
+            class_def = command.ImportCommand(cmd_name)
+            epilog = getattr(class_def, "EPILOG", None)
+            sub_parser = subparsers.add_parser(
+                cmd_name,
+                description=class_def.__doc__,
+                epilog=epilog,
+                caching=class_def.use_caching_options,
+                formatter_class=argparse.RawDescriptionHelpFormatter,
+            )
+            class_def.AddParser(sub_parser)
+        else:
+            subparsers.add_parser(subcommand, add_help=False)
 
-  help_parser = subparsers.add_parser('help', add_help=False)
-  help_parser.add_argument('help_subcommand', nargs='?',
-                           help='The command to show help for')
+    help_parser = subparsers.add_parser("help", add_help=False)
+    help_parser.add_argument(
+        "help_subcommand", nargs="?", help="The command to show help for"
+    )
 
-  return parser
+    return parser
 
 
 def _RunSubCommand(subcommand):
-  """Helper function for testing purposes."""
-  return subcommand.Run()
+    """Helper function for testing purposes."""
+    return subcommand.Run()
 
 
 def main(argv):
-  try:
-    # The first time we parse the commandline is only to figure out what
-    # subcommand the user wants to run.  This allows us to avoid importing
-    # all subcommands which can be quite slow.  This works because there is
-    # no way in Python to list all subcommands and their help output in a
-    # single run.
-    parser = GetOptions()
-    if not argv:
-      parser.print_help()
-      return 1
-
-    namespace, _ = parser.parse_known_args(argv)
-
-    if namespace.subcommand == 'help':
-      if namespace.help_subcommand is None:
-        parser.print_help()
-        return
-
-      parser = GetOptions(namespace.help_subcommand)
-      parser.parse_args([namespace.help_subcommand, '--help'])
-
-    # The user has selected a subcommand now, so get the full parser after we
-    # import the single subcommand.
-    parser = GetOptions(namespace.subcommand)
-    namespace = parser.parse_args(argv)
-    namespace.command_class.ProcessOptions(parser, namespace)
-    subcommand = namespace.command_class(namespace)
-    namespace.Freeze()
     try:
-      code = _RunSubCommand(subcommand)
-    except (commandline.ChrootRequiredError, commandline.ExecRequiredError):
-      # The higher levels want these passed back, so oblige.
-      raise
-    except Exception as e:
-      code = 1
-      logging.error('cros %s failed before completing.', namespace.subcommand)
-      if namespace.debug:
-        raise
-      else:
-        logging.error(e)
-        logging.error('(Re-run with --debug for more details.)')
+        # The first time we parse the commandline is only to figure out what
+        # subcommand the user wants to run.  This allows us to avoid importing
+        # all subcommands which can be quite slow.  This works because there is
+        # no way in Python to list all subcommands and their help output in a
+        # single run.
+        parser = GetOptions()
+        if not argv:
+            parser.print_help()
+            return 1
 
-    if code is not None:
-      return code
+        namespace, _ = parser.parse_known_args(argv)
 
-    return 0
-  except KeyboardInterrupt:
-    logging.debug('Aborted due to keyboard interrupt.')
-    return 1
+        if namespace.subcommand == "help":
+            if namespace.help_subcommand is None:
+                parser.print_help()
+                return
+
+            parser = GetOptions(namespace.help_subcommand)
+            parser.parse_args([namespace.help_subcommand, "--help"])
+
+        # The user has selected a subcommand now, so get the full parser after we
+        # import the single subcommand.
+        parser = GetOptions(namespace.subcommand)
+        namespace = parser.parse_args(argv)
+        namespace.command_class.ProcessOptions(parser, namespace)
+        subcommand = namespace.command_class(namespace)
+        namespace.Freeze()
+        try:
+            code = _RunSubCommand(subcommand)
+        except (commandline.ChrootRequiredError, commandline.ExecRequiredError):
+            # The higher levels want these passed back, so oblige.
+            raise
+        except Exception as e:
+            code = 1
+            logging.error(
+                "cros %s failed before completing.", namespace.subcommand
+            )
+            if namespace.debug:
+                raise
+            else:
+                logging.error(e)
+                logging.error("(Re-run with --debug for more details.)")
+
+        if code is not None:
+            return code
+
+        return 0
+    except KeyboardInterrupt:
+        logging.debug("Aborted due to keyboard interrupt.")
+        return 1