cleanup: drop unused variables and an unused import
authorSimon Heimberg <simohe@besonet.ch>
Mon, 01 Jul 2013 20:48:56 +0200
changeset 19378 9de689d20230
parent 19377 0cb996ee8c6d
child 19379 83d0df2ddf3f
cleanup: drop unused variables and an unused import
contrib/casesmash.py
contrib/check-code.py
contrib/hgfixes/fix_leftover_imports.py
contrib/perf.py
contrib/simplemerge
doc/hgmanpage.py
tests/hghave.py
tests/test-check-pyflakes.t
tests/test-hgweb-auth.py
--- a/contrib/casesmash.py	Mon Jul 01 20:48:55 2013 +0200
+++ b/contrib/casesmash.py	Mon Jul 01 20:48:56 2013 +0200
@@ -7,7 +7,7 @@
         d, base = os.path.split(fname)
         try:
             files = os.listdir(d or '.')
-        except OSError, inst:
+        except OSError:
             files = []
         if base in files:
             return f(fname, *args, **kwargs)
--- a/contrib/check-code.py	Mon Jul 01 20:48:55 2013 +0200
+++ b/contrib/check-code.py	Mon Jul 01 20:48:56 2013 +0200
@@ -337,13 +337,12 @@
         for pats in failandwarn:
             for i, pseq in enumerate(pats):
                 # fix-up regexes for multi-line searches
-                po = p = pseq[0]
+                p = pseq[0]
                 # \s doesn't match \n
                 p = re.sub(r'(?<!\\)\\s', r'[ \\t]', p)
                 # [^...] doesn't match newline
                 p = re.sub(r'(?<!\\)\[\^', r'[^\\n', p)
 
-                #print po, '=>', p
                 pats[i] = (re.compile(p, re.MULTILINE),) + pseq[1:]
         filters = c[2]
         for i, flt in enumerate(filters):
--- a/contrib/hgfixes/fix_leftover_imports.py	Mon Jul 01 20:48:55 2013 +0200
+++ b/contrib/hgfixes/fix_leftover_imports.py	Mon Jul 01 20:48:56 2013 +0200
@@ -48,7 +48,6 @@
     mod_list = ' | '.join(["'%s' '.' ('%s')" %
         (key, "' | '".join(packages[key])) for key in packages])
     mod_list = '(' + mod_list + ' )'
-    bare_names = alternates(mapping.keys())
 
     yield """name_import=import_name< 'import' module_name=dotted_name< %s > >
           """ % mod_list
--- a/contrib/perf.py	Mon Jul 01 20:48:55 2013 +0200
+++ b/contrib/perf.py	Mon Jul 01 20:48:56 2013 +0200
@@ -175,7 +175,7 @@
 def perfmanifest(ui, repo):
     def d():
         t = repo.manifest.tip()
-        m = repo.manifest.read(t)
+        repo.manifest.read(t)
         repo.manifest.mapcache = None
         repo.manifest._cache = None
     timer(d)
@@ -184,7 +184,7 @@
 def perfchangeset(ui, repo, rev):
     n = repo[rev].node()
     def d():
-        c = repo.changelog.read(n)
+        repo.changelog.read(n)
         #repo.changelog._cache = None
     timer(d)
 
--- a/contrib/simplemerge	Mon Jul 01 20:48:55 2013 +0200
+++ b/contrib/simplemerge	Mon Jul 01 20:48:56 2013 +0200
@@ -3,7 +3,7 @@
 from mercurial import demandimport
 demandimport.enable()
 
-import os, sys
+import sys
 from mercurial.i18n import _
 from mercurial import simplemerge, fancyopts, util, ui
 
--- a/doc/hgmanpage.py	Mon Jul 01 20:48:55 2013 +0200
+++ b/doc/hgmanpage.py	Mon Jul 01 20:48:56 2013 +0200
@@ -981,7 +981,6 @@
         #    Level is too low to display:
         #    raise nodes.SkipNode
         attr = {}
-        backref_text = ''
         if node.hasattr('id'):
             attr['name'] = node['id']
         if node.hasattr('line'):
--- a/tests/hghave.py	Mon Jul 01 20:48:55 2013 +0200
+++ b/tests/hghave.py	Mon Jul 01 20:48:56 2013 +0200
@@ -105,7 +105,7 @@
     sock = socket.socket(socket.AF_UNIX)
     try:
         sock.bind(name)
-    except socket.error, err:
+    except socket.error:
         return False
     sock.close()
     os.unlink(name)
--- a/tests/test-check-pyflakes.t	Mon Jul 01 20:48:55 2013 +0200
+++ b/tests/test-check-pyflakes.t	Mon Jul 01 20:48:56 2013 +0200
@@ -5,7 +5,6 @@
 (skipping binary file random-seed)
   $ hg manifest 2>/dev/null | egrep "\.py$|^[^.]*$" | grep -v /random_seed$ \
   > | xargs pyflakes 2>/dev/null | "$TESTDIR/filterpyflakes.py"
-  contrib/simplemerge:*: 'os' imported but unused (glob)
   contrib/win32/hgwebdir_wsgi.py:*: 'win32traceutil' imported but unused (glob)
   setup.py:*: 'sha' imported but unused (glob)
   setup.py:*: 'zlib' imported but unused (glob)
@@ -16,14 +15,6 @@
   tests/hghave.py:*: 'publish_cmdline' imported but unused (glob)
   tests/hghave.py:*: 'pygments' imported but unused (glob)
   tests/hghave.py:*: 'ssl' imported but unused (glob)
-  contrib/casesmash.py:*: local variable 'inst' is assigned to but never used (glob)
-  contrib/check-code.py:*: local variable 'po' is assigned to but never used (glob)
-  contrib/hgfixes/fix_leftover_imports.py:*: local variable 'bare_names' is assigned to but never used (glob)
-  contrib/perf.py:*: local variable 'm' is assigned to but never used (glob)
-  contrib/perf.py:*: local variable 'c' is assigned to but never used (glob)
-  doc/hgmanpage.py:*: local variable 'backref_text' is assigned to but never used (glob)
-  tests/hghave.py:*: local variable 'err' is assigned to but never used (glob)
-  tests/test-hgweb-auth.py:*: local variable 'e' is assigned to but never used (glob)
   contrib/win32/hgwebdir_wsgi.py:*: 'from isapi.install import *' used; unable to detect undefined names (glob)
   hgext/inotify/linux/__init__.py:*: 'from _inotify import *' used; unable to detect undefined names (glob)
   
--- a/tests/test-hgweb-auth.py	Mon Jul 01 20:48:55 2013 +0200
+++ b/tests/test-hgweb-auth.py	Mon Jul 01 20:48:56 2013 +0200
@@ -41,7 +41,7 @@
             if authinfo is not None:
                 pm.add_password(*authinfo)
             print '    ', pm.find_user_password('test', u)
-        except Abort, e:
+        except Abort:
             print 'abort'
 
     if not urls: