Revert "Use pylint 2.7 for depot_tools"
This reverts commit 22bf605bb63f8ff01aa7c1a2841718e3489b43d6.
Reason for revert: breaks gclient sync
Original change's description:
> 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: Ie97d686748c9c952e87718a65f401c5f6f80a5c9
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3400616
> Reviewed-by: Gavin Mak <gavinmak@google.com>
> Commit-Queue: Aravind Vasudevan <aravindvasudev@google.com>
Bug: 1262286
Change-Id: Ieb946073c7886c7bf056ce843a5a48e82becf7a5
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3413672
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Josip Sokcevic <sokcevic@google.com>
diff --git a/gclient_utils.py b/gclient_utils.py
index 3087ed2..ae958cd 100644
--- a/gclient_utils.py
+++ b/gclient_utils.py
@@ -301,8 +301,8 @@
exitcode = subprocess.call(['cmd.exe', '/c', 'rd', '/q', '/s', path])
if exitcode == 0:
return
-
- print('rd exited with code %d' % exitcode, file=sys.stderr)
+ else:
+ print('rd exited with code %d' % exitcode, file=sys.stderr)
time.sleep(3)
raise Exception('Failed to remove path %s' % path)
@@ -437,12 +437,11 @@
lf_loc = obj[0].find(b'\n')
if cr_loc == lf_loc == -1:
break
-
- if cr_loc == -1 or (0 <= lf_loc < cr_loc):
+ elif cr_loc == -1 or (lf_loc >= 0 and lf_loc < cr_loc):
line, remaining = obj[0].split(b'\n', 1)
- if line:
- self._wrapped_write(b'%d>%s\n' % (index, line))
- elif lf_loc == -1 or (0 <= cr_loc < lf_loc):
+ if line:
+ self._wrapped_write(b'%d>%s\n' % (index, line))
+ elif lf_loc == -1 or (cr_loc >= 0 and cr_loc < lf_loc):
line, remaining = obj[0].split(b'\r', 1)
if line:
self._wrapped_write(b'%d>%s\r' % (index, line))
@@ -751,16 +750,12 @@
"""Returns 'mac', 'win', or 'linux', matching the current platform."""
if sys.platform.startswith(('cygwin', 'win')):
return 'win'
-
- if sys.platform.startswith('linux'):
+ elif sys.platform.startswith('linux'):
return 'linux'
-
- if sys.platform == 'darwin':
+ elif sys.platform == 'darwin':
return 'mac'
-
- if sys.platform.startswith('aix'):
+ elif sys.platform.startswith('aix'):
return 'aix'
-
raise Error('Unknown platform: ' + sys.platform)
@@ -811,6 +806,7 @@
def run(self, work_queue):
"""work_queue is passed as keyword argument so it should be
the last parameters of the function when you override it."""
+ pass
@property
def name(self):
@@ -1215,8 +1211,8 @@
"""
if platform.architecture()[0].startswith('64'):
return '2g'
-
- return '512m'
+ else:
+ return '512m'
def DefaultIndexPackConfig(url=''):
@@ -1263,15 +1259,13 @@
"""
if isinstance(obj, collections_abc.Mapping):
return FrozenDict((freeze(k), freeze(v)) for k, v in obj.items())
-
- if isinstance(obj, (list, tuple)):
+ elif isinstance(obj, (list, tuple)):
return tuple(freeze(i) for i in obj)
-
- if isinstance(obj, set):
+ elif isinstance(obj, set):
return frozenset(freeze(i) for i in obj)
-
- hash(obj)
- return obj
+ else:
+ hash(obj)
+ return obj
class FrozenDict(collections_abc.Mapping):