Patchwork [3,of,7] cleanup: avoid local vars shadowing imports

login
register
mail settings
Submitter Mads Kiilerich
Date Aug. 15, 2014, 2:21 p.m.
Message ID <acee2c1d3c12c1c6624d.1408112479@mk-desktop>
Download mbox | patch
Permalink /patch/5425/
State Accepted
Headers show

Comments

Mads Kiilerich - Aug. 15, 2014, 2:21 p.m.
# HG changeset patch
# User Mads Kiilerich <madski@unity3d.com>
# Date 1408112447 -7200
#      Fri Aug 15 16:20:47 2014 +0200
# Node ID acee2c1d3c12c1c6624d269f77fb8e0819a39a7d
# Parent  3e2392e264d2aef3ea26ae9d809d2f4e5eeba699
cleanup: avoid local vars shadowing imports

This will mute some pyflakes "import ... shadowed by loop variable" warnings.

Patch

diff --git a/mercurial/hgweb/hgweb_mod.py b/mercurial/hgweb/hgweb_mod.py
--- a/mercurial/hgweb/hgweb_mod.py
+++ b/mercurial/hgweb/hgweb_mod.py
@@ -392,5 +392,5 @@  class hgweb(object):
         }
 
     def check_perm(self, req, op):
-        for hook in permhooks:
-            hook(self, req, op)
+        for permhook in permhooks:
+            permhook(self, req, op)
diff --git a/mercurial/merge.py b/mercurial/merge.py
--- a/mercurial/merge.py
+++ b/mercurial/merge.py
@@ -10,7 +10,7 @@  import struct
 from node import nullid, nullrev, hex, bin
 from i18n import _
 from mercurial import obsolete
-import error, util, filemerge, copies, subrepo, worker, dicthelpers
+import error as errormod, util, filemerge, copies, subrepo, worker, dicthelpers
 import errno, os, shutil
 
 _pack = struct.pack
@@ -1011,7 +1011,7 @@  def update(repo, node, branchmerge, forc
             # but currently we are only checking the branch tips.
             try:
                 node = repo.branchtip(wc.branch())
-            except error.RepoLookupError:
+            except errormod.RepoLookupError:
                 if wc.branch() == "default": # no default branch!
                     node = repo.lookup("tip") # update to tip
                 else:
diff --git a/mercurial/obsolete.py b/mercurial/obsolete.py
--- a/mercurial/obsolete.py
+++ b/mercurial/obsolete.py
@@ -748,8 +748,8 @@  def _computeobsoleteset(repo):
     obs = set()
     getrev = repo.changelog.nodemap.get
     getphase = repo._phasecache.phase
-    for node in repo.obsstore.successors:
-        rev = getrev(node)
+    for n in repo.obsstore.successors:
+        rev = getrev(n)
         if rev is not None and getphase(repo, rev):
             obs.add(rev)
     return obs
diff --git a/mercurial/tagmerge.py b/mercurial/tagmerge.py
--- a/mercurial/tagmerge.py
+++ b/mercurial/tagmerge.py
@@ -71,7 +71,7 @@ 
 #         - put blocks whose nodes come all from p2 first
 #     - write the tag blocks in the sorted order
 
-import tags
+import tags as tagsmod
 import util
 from node import nullid, hex
 from i18n import _
@@ -85,8 +85,8 @@  def readtagsformerge(ui, repo, lines, fn
     with each tag. Rhis is done because only the line numbers of the first
     parent are useful for merging
     '''
-    filetags = tags._readtaghist(ui, repo, lines, fn=fn, recode=None,
-                              calcnodelines=True)[1]
+    filetags = tagsmod._readtaghist(ui, repo, lines, fn=fn, recode=None,
+                                    calcnodelines=True)[1]
     for tagname, taginfo in filetags.items():
         if not keeplinenums:
             for el in taginfo: