Patchwork [8,of,9,pyflakes] verify: avoid shadowing two variables with a list comprehension

login
register
mail settings
Submitter Augie Fackler
Date Nov. 10, 2016, 9:52 p.m.
Message ID <36bb399e6ca5cecb2f6f.1478814751@arthedain.pit.corp.google.com>
Download mbox | patch
Permalink /patch/17460/
State Accepted
Headers show

Comments

Augie Fackler - Nov. 10, 2016, 9:52 p.m.
# HG changeset patch
# User Augie Fackler <augie@google.com>
# Date 1478813754 18000
#      Thu Nov 10 16:35:54 2016 -0500
# Node ID 36bb399e6ca5cecb2f6f1b7338b2f73569ffbaf0
# Parent  dace366e1d4818d03d65dce96e749acbcd4aadf4
verify: avoid shadowing two variables with a list comprehension

The variable names are clearly worse now, but since we're really just
transposing key and value I'm not too worried about the clarity loss.

Patch

diff --git a/mercurial/verify.py b/mercurial/verify.py
--- a/mercurial/verify.py
+++ b/mercurial/verify.py
@@ -425,7 +425,7 @@  class verifier(object):
 
             # cross-check
             if f in filenodes:
-                fns = [(lr, n) for n, lr in filenodes[f].iteritems()]
+                fns = [(v, k) for k, v in filenodes[f].iteritems()]
                 for lr, node in sorted(fns):
                     self.err(lr, _("manifest refers to unknown revision %s") %
                              short(node), f)