From ea2e330e43c182dc16b0111ebc69ee5a71ee4ce1 Mon Sep 17 00:00:00 2001 From: Gavin Mak Date: Sat, 11 Mar 2023 06:46:20 +0000 Subject: Format codebase with black and check formatting in CQ Apply rules set by https://gerrit-review.googlesource.com/c/git-repo/+/362954/ across the codebase and fix any lingering errors caught by flake8. Also check black formatting in run_tests (and CQ). Bug: b/267675342 Change-Id: I972d77649dac351150dcfeb1cd1ad0ea2efc1956 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/363474 Reviewed-by: Mike Frysinger Tested-by: Gavin Mak Commit-Queue: Gavin Mak --- subcmds/checkout.py | 83 +++++++++++++++++++++++++++++------------------------ 1 file changed, 45 insertions(+), 38 deletions(-) (limited to 'subcmds/checkout.py') diff --git a/subcmds/checkout.py b/subcmds/checkout.py index 768b6027..08012a82 100644 --- a/subcmds/checkout.py +++ b/subcmds/checkout.py @@ -20,12 +20,12 @@ from progress import Progress class Checkout(Command): - COMMON = True - helpSummary = "Checkout a branch for development" - helpUsage = """ + COMMON = True + helpSummary = "Checkout a branch for development" + helpUsage = """ %prog [...] """ - helpDescription = """ + helpDescription = """ The '%prog' command checks out an existing branch that was previously created by 'repo start'. @@ -33,43 +33,50 @@ The command is equivalent to: repo forall [...] -c git checkout """ - PARALLEL_JOBS = DEFAULT_LOCAL_JOBS + PARALLEL_JOBS = DEFAULT_LOCAL_JOBS - def ValidateOptions(self, opt, args): - if not args: - self.Usage() + def ValidateOptions(self, opt, args): + if not args: + self.Usage() - def _ExecuteOne(self, nb, project): - """Checkout one project.""" - return (project.CheckoutBranch(nb), project) + def _ExecuteOne(self, nb, project): + """Checkout one project.""" + return (project.CheckoutBranch(nb), project) - def Execute(self, opt, args): - nb = args[0] - err = [] - success = [] - all_projects = self.GetProjects(args[1:], all_manifests=not opt.this_manifest_only) + def Execute(self, opt, args): + nb = args[0] + err = [] + success = [] + all_projects = self.GetProjects( + args[1:], all_manifests=not opt.this_manifest_only + ) - def _ProcessResults(_pool, pm, results): - for status, project in results: - if status is not None: - if status: - success.append(project) - else: - err.append(project) - pm.update() + def _ProcessResults(_pool, pm, results): + for status, project in results: + if status is not None: + if status: + success.append(project) + else: + err.append(project) + pm.update() - self.ExecuteInParallel( - opt.jobs, - functools.partial(self._ExecuteOne, nb), - all_projects, - callback=_ProcessResults, - output=Progress('Checkout %s' % (nb,), len(all_projects), quiet=opt.quiet)) + self.ExecuteInParallel( + opt.jobs, + functools.partial(self._ExecuteOne, nb), + all_projects, + callback=_ProcessResults, + output=Progress( + "Checkout %s" % (nb,), len(all_projects), quiet=opt.quiet + ), + ) - if err: - for p in err: - print("error: %s/: cannot checkout %s" % (p.relpath, nb), - file=sys.stderr) - sys.exit(1) - elif not success: - print('error: no project has branch %s' % nb, file=sys.stderr) - sys.exit(1) + if err: + for p in err: + print( + "error: %s/: cannot checkout %s" % (p.relpath, nb), + file=sys.stderr, + ) + sys.exit(1) + elif not success: + print("error: no project has branch %s" % nb, file=sys.stderr) + sys.exit(1) -- cgit v1.2.3-54-g00ecf