Use pylint 2.7 for depot_tools
This includes a few fixes for specific errors, and disables several new
warnings introduced in this version, in order to allow for an incremental migration.
Bug:1262286
Change-Id: I4b8f8fc521386419a3121bbb07edc8ac83170a94
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3413679
Reviewed-by: Josip Sokcevic <sokcevic@google.com>
Commit-Queue: Aravind Vasudevan <aravindvasudev@google.com>
diff --git a/gerrit_util.py b/gerrit_util.py
index 4d5e78b..429e1de 100644
--- a/gerrit_util.py
+++ b/gerrit_util.py
@@ -254,8 +254,8 @@
if a[0]:
secret = base64.b64encode(('%s:%s' % (a[0], a[2])).encode('utf-8'))
return 'Basic %s' % secret.decode('utf-8')
- else:
- return 'Bearer %s' % a[2]
+
+ return 'Bearer %s' % a[2]
return None
def get_auth_email(self, host):
@@ -696,7 +696,8 @@
jmsg = GetChangeRevisions(host, change)
if not jmsg:
return None
- elif len(jmsg) > 1:
+
+ if len(jmsg) > 1:
raise GerritError(200, 'Multiple changes found for ChangeId %s.' % change)
revision = jmsg[0]['current_revision']
path = 'changes/%s/revisions/%s/review'
@@ -981,7 +982,8 @@
if not jmsg:
raise GerritError(
200, 'Could not get review information for change "%s"' % change)
- elif jmsg[0]['current_revision'] != revision:
+
+ if jmsg[0]['current_revision'] != revision:
raise GerritError(200, 'While resetting labels on change "%s", '
'a new patchset was uploaded.' % change)
@@ -1000,7 +1002,7 @@
"""
path = 'changes/'
body = {'project': project, 'branch': branch, 'subject': subject}
- body.update({k: v for k, v in params})
+ body.update(dict(params))
for key in 'project', 'branch', 'subject':
if not body[key]:
raise GerritError(200, '%s is required' % key.title())