Patchwork [2,of,2,V2] cleanup: drop unused variables and an unused import

login
register
mail settings
Submitter Simon Heimberg
Date July 1, 2013, 7:13 p.m.
Message ID <842518cb2a53892b2fe7.1372705994@lapsi.heimberg.home>
Download mbox | patch
Permalink /patch/1779/
State Accepted
Commit 9de689d20230ffdc0c6b233cf0c0d756c8521c7f
Headers show

Comments

Simon Heimberg - July 1, 2013, 7:13 p.m.
# HG changeset patch
# User Simon Heimberg <simohe@besonet.ch>
# Date 1372704536 -7200
# Node ID 842518cb2a53892b2fe7c1ce3baef8f08fad856b
# Parent  fe1b5227e8f34bb736189b3456c06f00d3fbf194
cleanup: drop unused variables and an unused import
Augie Fackler - July 9, 2013, 9:36 p.m.
queued these, thanks

On Jul 1, 2013, at 3:13 PM, Simon Heimberg <simohe@besonet.ch> wrote:

> # HG changeset patch
> # User Simon Heimberg <simohe@besonet.ch>
> # Date 1372704536 -7200
> # Node ID 842518cb2a53892b2fe7c1ce3baef8f08fad856b
> # Parent  fe1b5227e8f34bb736189b3456c06f00d3fbf194
> cleanup: drop unused variables and an unused import
> 
> diff -r fe1b5227e8f3 -r 842518cb2a53 contrib/casesmash.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)
> diff -r fe1b5227e8f3 -r 842518cb2a53 contrib/check-code.py
> --- 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
> @@ -341,13 +341,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):
> diff -r fe1b5227e8f3 -r 842518cb2a53 contrib/hgfixes/fix_leftover_imports.py
> --- 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
> diff -r fe1b5227e8f3 -r 842518cb2a53 contrib/perf.py
> --- 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)
> 
> diff -r fe1b5227e8f3 -r 842518cb2a53 contrib/simplemerge
> --- 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
> 
> diff -r fe1b5227e8f3 -r 842518cb2a53 doc/hgmanpage.py
> --- 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'):
> diff -r fe1b5227e8f3 -r 842518cb2a53 tests/hghave.py
> --- 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)
> diff -r fe1b5227e8f3 -r 842518cb2a53 tests/test-check-pyflakes.t
> --- 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)
> 
> diff -r fe1b5227e8f3 -r 842518cb2a53 tests/test-hgweb-auth.py
> --- 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:
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel

Patch

diff -r fe1b5227e8f3 -r 842518cb2a53 contrib/casesmash.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)
diff -r fe1b5227e8f3 -r 842518cb2a53 contrib/check-code.py
--- 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
@@ -341,13 +341,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):
diff -r fe1b5227e8f3 -r 842518cb2a53 contrib/hgfixes/fix_leftover_imports.py
--- 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
diff -r fe1b5227e8f3 -r 842518cb2a53 contrib/perf.py
--- 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)
 
diff -r fe1b5227e8f3 -r 842518cb2a53 contrib/simplemerge
--- 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
 
diff -r fe1b5227e8f3 -r 842518cb2a53 doc/hgmanpage.py
--- 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'):
diff -r fe1b5227e8f3 -r 842518cb2a53 tests/hghave.py
--- 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)
diff -r fe1b5227e8f3 -r 842518cb2a53 tests/test-check-pyflakes.t
--- 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)
   
diff -r fe1b5227e8f3 -r 842518cb2a53 tests/test-hgweb-auth.py
--- 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: