Skip to content

Commit abdf750

Browse files
committed
Fix indentation issues reported by flake8
- E121 continuation line under-indented for hanging indent - E122 continuation line missing indentation or outdented - E125 continuation line with same indent as next logical line - E126 continuation line over-indented for hanging indent - E127 continuation line over-indented for visual indent - E128 continuation line under-indented for visual indent - E129 visually indented line with same indent as next logical line - E131 continuation line unaligned for hanging indent Fixed automatically with autopep8: git ls-files | grep py$ | xargs autopep8 --in-place \ --select E121,E122,E125,E126,E127,E128,E129,E131 Change-Id: Ifd95fb8e6a1a4d6e9de187b5787d64a6326dd249 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/254605 Reviewed-by: Mike Frysinger <[email protected]> Tested-by: David Pursehouse <[email protected]>
1 parent 0ab95ba commit abdf750

19 files changed

+133
-133
lines changed

editor.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ def _SelectEditor(cls):
5757

5858
if os.getenv('TERM') == 'dumb':
5959
print(
60-
"""No editor specified in GIT_EDITOR, core.editor, VISUAL or EDITOR.
60+
"""No editor specified in GIT_EDITOR, core.editor, VISUAL or EDITOR.
6161
Tried to fall back to vi but terminal is dumb. Please configure at
6262
least one of these before using this command.""", file=sys.stderr)
6363
sys.exit(1)
@@ -104,10 +104,10 @@ def EditString(cls, data):
104104
rc = subprocess.Popen(args, shell=shell).wait()
105105
except OSError as e:
106106
raise EditorError('editor failed, %s: %s %s'
107-
% (str(e), editor, path))
107+
% (str(e), editor, path))
108108
if rc != 0:
109109
raise EditorError('editor failed with exit status %d: %s %s'
110-
% (rc, editor, path))
110+
% (rc, editor, path))
111111

112112
with open(path, mode='rb') as fd2:
113113
return fd2.read().decode('utf-8')

git_command.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -57,16 +57,16 @@ def ssh_sock(create=True):
5757
if not os.path.exists(tmp_dir):
5858
tmp_dir = tempfile.gettempdir()
5959
_ssh_sock_path = os.path.join(
60-
tempfile.mkdtemp('', 'ssh-', tmp_dir),
61-
'master-%r@%h:%p')
60+
tempfile.mkdtemp('', 'ssh-', tmp_dir),
61+
'master-%r@%h:%p')
6262
return _ssh_sock_path
6363

6464
def _ssh_proxy():
6565
global _ssh_proxy_path
6666
if _ssh_proxy_path is None:
6767
_ssh_proxy_path = os.path.join(
68-
os.path.dirname(__file__),
69-
'git_ssh')
68+
os.path.dirname(__file__),
69+
'git_ssh')
7070
return _ssh_proxy_path
7171

7272
def _add_ssh_client(p):

git_config.py

+10-10
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,8 @@ def __init__(self, configfile, defaults=None, jsonFile=None):
104104
self._json = jsonFile
105105
if self._json is None:
106106
self._json = os.path.join(
107-
os.path.dirname(self.file),
108-
'.repo_' + os.path.basename(self.file) + '.json')
107+
os.path.dirname(self.file),
108+
'.repo_' + os.path.basename(self.file) + '.json')
109109

110110
def Has(self, name, include_defaults=True):
111111
"""Return true if this configuration file has the key.
@@ -269,7 +269,7 @@ def _Read(self):
269269
def _ReadJson(self):
270270
try:
271271
if os.path.getmtime(self._json) \
272-
<= os.path.getmtime(self.file):
272+
<= os.path.getmtime(self.file):
273273
platform_utils.remove(self._json)
274274
return None
275275
except OSError:
@@ -422,16 +422,16 @@ def _open_ssh(host, port=None):
422422
return True
423423

424424
if not _ssh_master \
425-
or 'GIT_SSH' in os.environ \
426-
or sys.platform in ('win32', 'cygwin'):
425+
or 'GIT_SSH' in os.environ \
426+
or sys.platform in ('win32', 'cygwin'):
427427
# failed earlier, or cygwin ssh can't do this
428428
#
429429
return False
430430

431431
# We will make two calls to ssh; this is the common part of both calls.
432432
command_base = ['ssh',
433-
'-o', 'ControlPath %s' % ssh_sock(),
434-
host]
433+
'-o', 'ControlPath %s' % ssh_sock(),
434+
host]
435435
if port is not None:
436436
command_base[1:1] = ['-p', str(port)]
437437

@@ -465,7 +465,7 @@ def _open_ssh(host, port=None):
465465
except Exception as e:
466466
_ssh_master = False
467467
print('\nwarn: cannot enable ssh control master for %s:%s\n%s'
468-
% (host, port, str(e)), file=sys.stderr)
468+
% (host, port, str(e)), file=sys.stderr)
469469
return False
470470

471471
time.sleep(1)
@@ -583,7 +583,7 @@ def __init__(self, config, name):
583583
self.review = self._Get('review')
584584
self.projectname = self._Get('projectname')
585585
self.fetch = list(map(RefSpec.FromString,
586-
self._Get('fetch', all_keys=True)))
586+
self._Get('fetch', all_keys=True)))
587587
self._review_url = None
588588

589589
def _InsteadOf(self):
@@ -598,7 +598,7 @@ def _InsteadOf(self):
598598

599599
for insteadOf in insteadOfList:
600600
if self.url.startswith(insteadOf) \
601-
and len(insteadOf) > len(longest):
601+
and len(insteadOf) > len(longest):
602602
longest = insteadOf
603603
longestUrl = url
604604

gitc_utils.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ def _set_project_revisions(projects):
5252
project.remote.url,
5353
project.revisionExpr],
5454
capture_stdout=True, cwd='/tmp'))
55-
for project in projects if not git_config.IsId(project.revisionExpr)]
55+
for project in projects if not git_config.IsId(project.revisionExpr)]
5656
for proj, gitcmd in project_gitcmds:
5757
if gitcmd.Wait():
5858
print('FATAL: Failed to retrieve revisionExpr for %s' % proj)

main.py

+8-8
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ def _Run(self, name, gopts, argv):
188188
copts = cmd.ReadEnvironmentOptions(copts)
189189
except NoManifestException as e:
190190
print('error: in `%s`: %s' % (' '.join([name] + argv), str(e)),
191-
file=sys.stderr)
191+
file=sys.stderr)
192192
print('error: manifest missing or unreadable -- please run init',
193193
file=sys.stderr)
194194
return 1
@@ -211,9 +211,9 @@ def _Run(self, name, gopts, argv):
211211
cmd.ValidateOptions(copts, cargs)
212212
result = cmd.Execute(copts, cargs)
213213
except (DownloadError, ManifestInvalidRevisionError,
214-
NoManifestException) as e:
214+
NoManifestException) as e:
215215
print('error: in `%s`: %s' % (' '.join([name] + argv), str(e)),
216-
file=sys.stderr)
216+
file=sys.stderr)
217217
if isinstance(e, NoManifestException):
218218
print('error: manifest missing or unreadable -- please run init',
219219
file=sys.stderr)
@@ -346,7 +346,7 @@ class _BasicAuthHandler(urllib.request.HTTPBasicAuthHandler):
346346
def http_error_401(self, req, fp, code, msg, headers):
347347
_AddPasswordFromUserInput(self, msg, req)
348348
return urllib.request.HTTPBasicAuthHandler.http_error_401(
349-
self, req, fp, code, msg, headers)
349+
self, req, fp, code, msg, headers)
350350

351351
def http_error_auth_reqed(self, authreq, host, req, headers):
352352
try:
@@ -356,7 +356,7 @@ def _add_header(name, val):
356356
old_add_header(name, val)
357357
req.add_header = _add_header
358358
return urllib.request.AbstractBasicAuthHandler.http_error_auth_reqed(
359-
self, authreq, host, req, headers)
359+
self, authreq, host, req, headers)
360360
except:
361361
reset = getattr(self, 'reset_retry_count', None)
362362
if reset is not None:
@@ -369,7 +369,7 @@ class _DigestAuthHandler(urllib.request.HTTPDigestAuthHandler):
369369
def http_error_401(self, req, fp, code, msg, headers):
370370
_AddPasswordFromUserInput(self, msg, req)
371371
return urllib.request.HTTPDigestAuthHandler.http_error_401(
372-
self, req, fp, code, msg, headers)
372+
self, req, fp, code, msg, headers)
373373

374374
def http_error_auth_reqed(self, auth_header, host, req, headers):
375375
try:
@@ -379,7 +379,7 @@ def _add_header(name, val):
379379
old_add_header(name, val)
380380
req.add_header = _add_header
381381
return urllib.request.AbstractDigestAuthHandler.http_error_auth_reqed(
382-
self, auth_header, host, req, headers)
382+
self, auth_header, host, req, headers)
383383
except:
384384
reset = getattr(self, 'reset_retry_count', None)
385385
if reset is not None:
@@ -406,7 +406,7 @@ def http_error_auth_reqed(self, auth_header, host, req, headers):
406406

407407
if self.retried > 3:
408408
raise urllib.request.HTTPError(req.get_full_url(), 401,
409-
"Negotiate auth failed", headers, None)
409+
"Negotiate auth failed", headers, None)
410410
else:
411411
self.retried += 1
412412

manifest_xml.py

+13-13
Original file line numberDiff line numberDiff line change
@@ -140,12 +140,12 @@ def __init__(self, repodir):
140140
self._load_local_manifests = True
141141

142142
self.repoProject = MetaProject(self, 'repo',
143-
gitdir=os.path.join(repodir, 'repo/.git'),
144-
worktree=os.path.join(repodir, 'repo'))
143+
gitdir=os.path.join(repodir, 'repo/.git'),
144+
worktree=os.path.join(repodir, 'repo'))
145145

146146
self.manifestProject = MetaProject(self, 'manifests',
147-
gitdir=os.path.join(repodir, 'manifests.git'),
148-
worktree=os.path.join(repodir, 'manifests'))
147+
gitdir=os.path.join(repodir, 'manifests.git'),
148+
worktree=os.path.join(repodir, 'manifests'))
149149

150150
self._Unload()
151151

@@ -462,12 +462,12 @@ def _Load(self):
462462
self.localManifestWarning = True
463463
print('warning: %s is deprecated; put local manifests '
464464
'in `%s` instead' % (LOCAL_MANIFEST_NAME,
465-
os.path.join(self.repodir, LOCAL_MANIFESTS_DIR_NAME)),
465+
os.path.join(self.repodir, LOCAL_MANIFESTS_DIR_NAME)),
466466
file=sys.stderr)
467467
nodes.append(self._ParseManifestXml(local, self.repodir))
468468

469469
local_dir = os.path.abspath(os.path.join(self.repodir,
470-
LOCAL_MANIFESTS_DIR_NAME))
470+
LOCAL_MANIFESTS_DIR_NAME))
471471
try:
472472
for local_file in sorted(platform_utils.listdir(local_dir)):
473473
if local_file.endswith('.xml'):
@@ -512,7 +512,7 @@ def _ParseManifestXml(self, path, include_root):
512512
fp = os.path.join(include_root, name)
513513
if not os.path.isfile(fp):
514514
raise ManifestParseError("include %s doesn't exist or isn't a file"
515-
% (name,))
515+
% (name,))
516516
try:
517517
nodes.extend(self._ParseManifestXml(fp, include_root))
518518
# should isolate this to the exact exception, but that's
@@ -811,21 +811,21 @@ def _ParseProject(self, node, parent=None, **extra_proj_attrs):
811811
remote = self._default.remote
812812
if remote is None:
813813
raise ManifestParseError("no remote for project %s within %s" %
814-
(name, self.manifestFile))
814+
(name, self.manifestFile))
815815

816816
revisionExpr = node.getAttribute('revision') or remote.revision
817817
if not revisionExpr:
818818
revisionExpr = self._default.revisionExpr
819819
if not revisionExpr:
820820
raise ManifestParseError("no revision for project %s within %s" %
821-
(name, self.manifestFile))
821+
(name, self.manifestFile))
822822

823823
path = node.getAttribute('path')
824824
if not path:
825825
path = name
826826
if path.startswith('/'):
827827
raise ManifestParseError("project %s path cannot be absolute in %s" %
828-
(name, self.manifestFile))
828+
(name, self.manifestFile))
829829

830830
rebase = node.getAttribute('rebase')
831831
if not rebase:
@@ -1054,7 +1054,7 @@ def _ParseAnnotation(self, project, node):
10541054
keep = "true"
10551055
if keep != "true" and keep != "false":
10561056
raise ManifestParseError('optional "keep" attribute must be '
1057-
'"true" or "false"')
1057+
'"true" or "false"')
10581058
project.AddAnnotation(name, value, keep)
10591059

10601060
def _get_remote(self, node):
@@ -1065,7 +1065,7 @@ def _get_remote(self, node):
10651065
v = self._remotes.get(name)
10661066
if not v:
10671067
raise ManifestParseError("remote %s not defined in %s" %
1068-
(name, self.manifestFile))
1068+
(name, self.manifestFile))
10691069
return v
10701070

10711071
def _reqatt(self, node, attname):
@@ -1075,7 +1075,7 @@ def _reqatt(self, node, attname):
10751075
v = node.getAttribute(attname)
10761076
if not v:
10771077
raise ManifestParseError("no %s in <%s> within %s" %
1078-
(attname, node.nodeName, self.manifestFile))
1078+
(attname, node.nodeName, self.manifestFile))
10791079
return v
10801080

10811081
def projectsDiff(self, manifest):

progress.py

+18-18
Original file line numberDiff line numberDiff line change
@@ -53,23 +53,23 @@ def update(self, inc=1, msg=''):
5353

5454
if self._total <= 0:
5555
sys.stderr.write('%s\r%s: %d,' % (
56-
CSI_ERASE_LINE,
57-
self._title,
58-
self._done))
56+
CSI_ERASE_LINE,
57+
self._title,
58+
self._done))
5959
sys.stderr.flush()
6060
else:
6161
p = (100 * self._done) / self._total
6262

6363
if self._lastp != p or self._always_print_percentage:
6464
self._lastp = p
6565
sys.stderr.write('%s\r%s: %3d%% (%d%s/%d%s)%s%s%s' % (
66-
CSI_ERASE_LINE,
67-
self._title,
68-
p,
69-
self._done, self._units,
70-
self._total, self._units,
71-
' ' if msg else '', msg,
72-
"\n" if self._print_newline else ""))
66+
CSI_ERASE_LINE,
67+
self._title,
68+
p,
69+
self._done, self._units,
70+
self._total, self._units,
71+
' ' if msg else '', msg,
72+
"\n" if self._print_newline else ""))
7373
sys.stderr.flush()
7474

7575
def end(self):
@@ -78,16 +78,16 @@ def end(self):
7878

7979
if self._total <= 0:
8080
sys.stderr.write('%s\r%s: %d, done.\n' % (
81-
CSI_ERASE_LINE,
82-
self._title,
83-
self._done))
81+
CSI_ERASE_LINE,
82+
self._title,
83+
self._done))
8484
sys.stderr.flush()
8585
else:
8686
p = (100 * self._done) / self._total
8787
sys.stderr.write('%s\r%s: %3d%% (%d%s/%d%s), done.\n' % (
88-
CSI_ERASE_LINE,
89-
self._title,
90-
p,
91-
self._done, self._units,
92-
self._total, self._units))
88+
CSI_ERASE_LINE,
89+
self._title,
90+
p,
91+
self._done, self._units,
92+
self._total, self._units))
9393
sys.stderr.flush()

project.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2341,7 +2341,7 @@ def _RemoteFetch(self, name=None,
23412341
else:
23422342
branch = self.revisionExpr
23432343
if (not self.manifest.IsMirror and is_sha1 and depth
2344-
and git_require((1, 8, 3))):
2344+
and git_require((1, 8, 3))):
23452345
# Shallow checkout of a specific commit, fetch from that commit and not
23462346
# the heads only as the commit might be deeper in the history.
23472347
spec.append(branch)

subcmds/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
cmd = getattr(mod, clsn)()
4141
except AttributeError:
4242
raise SyntaxError('%s/%s does not define class %s' % (
43-
__name__, py, clsn))
43+
__name__, py, clsn))
4444

4545
name = name.replace('_', '-')
4646
cmd.NAME = name

subcmds/abandon.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -95,5 +95,5 @@ def Execute(self, opt, args):
9595
result = "all project"
9696
else:
9797
result = "%s" % (
98-
('\n' + ' ' * width + '| ').join(p.relpath for p in success[br]))
98+
('\n' + ' ' * width + '| ').join(p.relpath for p in success[br]))
9999
print("%s%s| %s\n" % (br, ' ' * (width - len(br)), result), file=sys.stderr)

0 commit comments

Comments
 (0)