[PATCH] pylint, pyflakes: remove unused or duplicate imports

Nicolas Dumazet nicdumz at gmail.com
Wed Apr 14 04:03:54 CDT 2010


# HG changeset patch
# User Nicolas Dumazet <nicdumz.commits at gmail.com>
# Date 1271235490 -32400
# Node ID 342b20693f5b21fae0da8ce8198b99521ff7e868
# Parent  428bef22c4a4dc642437b23740fff34fd60f69a3
pylint, pyflakes: remove unused or duplicate imports

diff --git a/contrib/check-code.py b/contrib/check-code.py
--- a/contrib/check-code.py
+++ b/contrib/check-code.py
@@ -7,7 +7,7 @@
 # This software may be used and distributed according to the terms of the
 # GNU General Public License version 2 or any later version.
 
-import sys, re, glob
+import re, glob
 import optparse
 
 def repquote(m):
diff --git a/doc/rst2man.py b/doc/rst2man.py
--- a/doc/rst2man.py
+++ b/doc/rst2man.py
@@ -45,14 +45,9 @@
 
 __docformat__ = 'reStructuredText'
 
-import sys
-import os
-import time
 import re
-from types import ListType
 
-import docutils
-from docutils import nodes, utils, writers, languages
+from docutils import nodes, writers, languages
 import roman
 
 FIELD_LIST_INDENT = 7
diff --git a/hgext/churn.py b/hgext/churn.py
--- a/hgext/churn.py
+++ b/hgext/churn.py
@@ -10,7 +10,7 @@
 
 from mercurial.i18n import _
 from mercurial import patch, cmdutil, util, templater
-import sys, os
+import os
 import time, datetime
 
 def maketemplater(ui, repo, tmpl):
diff --git a/mercurial/byterange.py b/mercurial/byterange.py
--- a/mercurial/byterange.py
+++ b/mercurial/byterange.py
@@ -25,11 +25,6 @@
 import urllib2
 import email.Utils
 
-try:
-    from cStringIO import StringIO
-except ImportError, msg:
-    from StringIO import StringIO
-
 class RangeError(IOError):
     """Error raised when an unsatisfiable range is requested."""
     pass
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
@@ -10,7 +10,6 @@
 from mercurial import ui, hg, hook, error, encoding, templater
 from common import get_mtime, ErrorResponse, permhooks
 from common import HTTP_OK, HTTP_BAD_REQUEST, HTTP_NOT_FOUND, HTTP_SERVER_ERROR
-from common import HTTP_UNAUTHORIZED, HTTP_METHOD_NOT_ALLOWED
 from request import wsgirequest
 import webcommands, protocol, webutil
 
diff --git a/mercurial/hgweb/server.py b/mercurial/hgweb/server.py
--- a/mercurial/hgweb/server.py
+++ b/mercurial/hgweb/server.py
@@ -7,7 +7,7 @@
 # GNU General Public License version 2 or any later version.
 
 import os, sys, errno, urllib, BaseHTTPServer, socket, SocketServer, traceback
-from mercurial import hg, util, error
+from mercurial import util, error
 from mercurial.i18n import _
 
 def _splitURI(uri):
diff --git a/mercurial/patch.py b/mercurial/patch.py
--- a/mercurial/patch.py
+++ b/mercurial/patch.py
@@ -10,7 +10,7 @@
 from node import hex, nullid, short
 import base85, cmdutil, mdiff, util, diffhelpers, copies
 import cStringIO, email.Parser, os, re
-import sys, tempfile, zlib
+import tempfile, zlib
 
 gitre = re.compile('diff --git a/(.*) b/(.*)')
 
diff --git a/mercurial/streamclone.py b/mercurial/streamclone.py
--- a/mercurial/streamclone.py
+++ b/mercurial/streamclone.py
@@ -6,7 +6,6 @@
 # GNU General Public License version 2 or any later version.
 
 import util, error
-from i18n import _
 
 from mercurial import store
 
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -37,7 +37,6 @@
 import tempfile
 from distutils.core import setup, Extension
 from distutils.dist import Distribution
-from distutils.command.install_data import install_data
 from distutils.command.build import build
 from distutils.command.build_py import build_py
 from distutils.spawn import spawn, find_executable
diff --git a/tests/get-with-headers.py b/tests/get-with-headers.py
--- a/tests/get-with-headers.py
+++ b/tests/get-with-headers.py
@@ -3,7 +3,7 @@
 """This does HTTP GET requests given a host:port and path and returns
 a subset of the headers plus the body of the result."""
 
-import httplib, sys, re
+import httplib, sys
 
 try:
     import msvcrt, os
diff --git a/tests/killdaemons.py b/tests/killdaemons.py
--- a/tests/killdaemons.py
+++ b/tests/killdaemons.py
@@ -1,6 +1,6 @@
 #!/usr/bin/env python
 
-import os, sys, time, errno, signal
+import os, time, errno, signal
 
 # Kill off any leftover daemon processes
 try:
diff --git a/tests/run-tests.py b/tests/run-tests.py
--- a/tests/run-tests.py
+++ b/tests/run-tests.py
@@ -46,9 +46,8 @@
 import errno
 import optparse
 import os
-import signal
+import shutil
 import subprocess
-import shutil
 import signal
 import sys
 import tempfile
diff --git a/tests/test-status-inprocess.py b/tests/test-status-inprocess.py
--- a/tests/test-status-inprocess.py
+++ b/tests/test-status-inprocess.py
@@ -1,5 +1,4 @@
 #!/usr/bin/python
-import os
 from mercurial.ui import ui
 from mercurial.localrepo import localrepository
 from mercurial.commands import add, commit, status


More information about the Mercurial-devel mailing list