lint: fix a few redefined-argument-from-local warnings
Newer pylint catches a few cases where we shadow variables in the
current scope. This is usually unintentional, so just rework the
code to avoid it. It's innocuous in some of our files, but in
others (like upload_symbols) it's downright confusing.
BUG=chromium:980619
TEST=unittests pass
TEST=`CrOS lint` is unchanged
Change-Id: If8e66c84359ea51421e9ae5196583938948f333e
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/chromite/+/1812027
Reviewed-by: Michael Mortensen <mmortensen@google.com>
Commit-Queue: Mike Frysinger <vapier@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
diff --git a/scripts/upload_symbols.py b/scripts/upload_symbols.py
index ce52ea7..4ae3c5a 100644
--- a/scripts/upload_symbols.py
+++ b/scripts/upload_symbols.py
@@ -220,20 +220,20 @@
if o.scheme:
# Support globs of filenames.
ctx = gs.GSContext()
- for p in ctx.LS(p):
- logging.info('processing files inside %s', p)
- o = urllib.parse.urlparse(p)
+ for gspath in ctx.LS(p):
+ logging.info('processing files inside %s', gspath)
+ o = urllib.parse.urlparse(gspath)
key = ('%s%s' % (o.netloc, o.path)).split('/')
# The common cache will not be LRU, removing the need to hold a read
# lock on the cached gsutil.
ref = tar_cache.Lookup(key)
try:
- ref.SetDefault(p)
+ ref.SetDefault(gspath)
except cros_build_lib.RunCommandError as e:
- logging.warning('ignoring %s\n%s', p, e)
+ logging.warning('ignoring %s\n%s', gspath, e)
continue
- for p in FindSymbolFiles(tempdir, [ref.path]):
- yield p
+ for sym in FindSymbolFiles(tempdir, [ref.path]):
+ yield sym
elif os.path.isdir(p):
for root, _, files in os.walk(p):
@@ -249,8 +249,8 @@
logging.info('processing files inside %s', p)
tardir = tempfile.mkdtemp(dir=tempdir)
cache.Untar(os.path.realpath(p), tardir)
- for p in FindSymbolFiles(tardir, [tardir]):
- yield p
+ for sym in FindSymbolFiles(tardir, [tardir]):
+ yield sym
else:
yield SymbolFile(display_path=p, file_name=p)