diff --git a/contrib/casesmash.py b/contrib/casesmash.py --- a/contrib/casesmash.py +++ b/contrib/casesmash.py @@ -7,7 +7,7 @@ def lowerwrap(scope, funcname): 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 --git a/contrib/check-code.py b/contrib/check-code.py --- a/contrib/check-code.py +++ b/contrib/check-code.py @@ -337,13 +337,12 @@ def _preparepats(): 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'(?', p pats[i] = (re.compile(p, re.MULTILINE),) + pseq[1:] filters = c[2] for i, flt in enumerate(filters): diff --git a/contrib/hgfixes/fix_leftover_imports.py b/contrib/hgfixes/fix_leftover_imports.py --- a/contrib/hgfixes/fix_leftover_imports.py +++ b/contrib/hgfixes/fix_leftover_imports.py @@ -48,7 +48,6 @@ def build_pattern(mapping=MAPPING): 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 --git a/contrib/perf.py b/contrib/perf.py --- a/contrib/perf.py +++ b/contrib/perf.py @@ -175,7 +175,7 @@ def perfpathcopies(ui, repo, rev1, rev2) 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 perfmanifest(ui, repo): 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 --git a/contrib/simplemerge b/contrib/simplemerge --- a/contrib/simplemerge +++ b/contrib/simplemerge @@ -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 --git a/doc/hgmanpage.py b/doc/hgmanpage.py --- a/doc/hgmanpage.py +++ b/doc/hgmanpage.py @@ -981,7 +981,6 @@ class Translator(nodes.NodeVisitor): # 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 --git a/tests/hghave.py b/tests/hghave.py --- a/tests/hghave.py +++ b/tests/hghave.py @@ -105,7 +105,7 @@ def has_inotify(): 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 --git a/tests/test-check-pyflakes.t b/tests/test-check-pyflakes.t --- a/tests/test-check-pyflakes.t +++ b/tests/test-check-pyflakes.t @@ -5,7 +5,6 @@ run pyflakes on all tracked files ending (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 @@ run pyflakes on all tracked files ending 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 --git a/tests/test-hgweb-auth.py b/tests/test-hgweb-auth.py --- a/tests/test-hgweb-auth.py +++ b/tests/test-hgweb-auth.py @@ -41,7 +41,7 @@ def test(auth, urls=None): 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: