init, sync: fixed flake8 warnings.

Tested:
+ run_tests
+ flake8 subcmds/init.py
+ flake8 subcmds/sync.py

Change-Id: Ie337481d8a210bfc49b0745f75c05a308a0e74d3
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/324155
Reviewed-by: Mike Frysinger <vapier@google.com>
Tested-by: Raman Tenneti <rtenneti@google.com>
This commit is contained in:
Raman Tenneti 2021-11-17 18:38:24 -08:00
parent 6bd89aa657
commit 4a478edb44
2 changed files with 8 additions and 9 deletions

View File

@ -15,7 +15,6 @@
import os import os
import platform import platform
import re import re
import subprocess
import sys import sys
import urllib.parse import urllib.parse
@ -132,8 +131,8 @@ to update the working directory files.
'cannot be re-initialized without --manifest-url/-u') 'cannot be re-initialized without --manifest-url/-u')
sys.exit(1) sys.exit(1)
if opt.standalone_manifest or ( if opt.standalone_manifest or (was_standalone_manifest and
was_standalone_manifest and opt.manifest_url): opt.manifest_url):
m.config.ClearCache() m.config.ClearCache()
if m.gitdir and os.path.exists(m.gitdir): if m.gitdir and os.path.exists(m.gitdir):
platform_utils.rmtree(m.gitdir) platform_utils.rmtree(m.gitdir)
@ -486,8 +485,8 @@ to update the working directory files.
self.OptionParser.error('--mirror and --use-superproject cannot be ' self.OptionParser.error('--mirror and --use-superproject cannot be '
'used together.') 'used together.')
if opt.standalone_manifest and ( if opt.standalone_manifest and (opt.manifest_branch or
opt.manifest_branch or opt.manifest_name != 'default.xml'): opt.manifest_name != 'default.xml'):
self.OptionParser.error('--manifest-branch and --manifest-name cannot' self.OptionParser.error('--manifest-branch and --manifest-name cannot'
' be used with --standalone-manifest.') ' be used with --standalone-manifest.')

View File

@ -448,8 +448,8 @@ later is required to fix a server side protocol bug.
else: else:
pm.update(inc=0, msg='warming up') pm.update(inc=0, msg='warming up')
chunksize = 4 chunksize = 4
with multiprocessing.Pool( with multiprocessing.Pool(jobs, initializer=self._FetchInitChild,
jobs, initializer=self._FetchInitChild, initargs=(ssh_proxy,)) as pool: initargs=(ssh_proxy,)) as pool:
results = pool.imap_unordered( results = pool.imap_unordered(
functools.partial(self._FetchProjectList, opt), functools.partial(self._FetchProjectList, opt),
projects_list, projects_list,
@ -767,7 +767,7 @@ later is required to fix a server side protocol bug.
with open(copylinkfile_path, 'rb') as fp: with open(copylinkfile_path, 'rb') as fp:
try: try:
old_copylinkfile_paths = json.load(fp) old_copylinkfile_paths = json.load(fp)
except: except Exception:
print('error: %s is not a json formatted file.' % print('error: %s is not a json formatted file.' %
copylinkfile_path, file=sys.stderr) copylinkfile_path, file=sys.stderr)
platform_utils.remove(copylinkfile_path) platform_utils.remove(copylinkfile_path)
@ -1131,7 +1131,7 @@ def _PostRepoUpgrade(manifest, quiet=False):
target = os.path.join('repo', 'docs', 'internal-fs-layout.md') target = os.path.join('repo', 'docs', 'internal-fs-layout.md')
try: try:
platform_utils.symlink(target, link) platform_utils.symlink(target, link)
except: except Exception:
pass pass
wrapper = Wrapper() wrapper = Wrapper()