cleanup: move stdlib imports to their own import statement
There are a few warnings still produced by my import checker, but
those are false positives produced by modules that share a name with
stdlib modules.
--- a/mercurial/ancestor.py Wed Nov 06 18:19:04 2013 -0500
+++ b/mercurial/ancestor.py Wed Nov 06 16:48:06 2013 -0500
@@ -5,7 +5,8 @@
# This software may be used and distributed according to the terms of the
# GNU General Public License version 2 or any later version.
-import heapq, util
+import heapq
+import util
from node import nullrev
def ancestors(pfunc, *orignodes):
--- a/mercurial/commands.py Wed Nov 06 18:19:04 2013 -0500
+++ b/mercurial/commands.py Wed Nov 06 16:48:06 2013 -0500
@@ -17,7 +17,8 @@
import merge as mergemod
import minirst, revset, fileset
import dagparser, context, simplemerge, graphmod
-import random, setdiscovery, treediscovery, dagutil, pvec, localrepo
+import random
+import setdiscovery, treediscovery, dagutil, pvec, localrepo
import phases, obsolete
table = {}
--- a/mercurial/fancyopts.py Wed Nov 06 18:19:04 2013 -0500
+++ b/mercurial/fancyopts.py Wed Nov 06 16:48:06 2013 -0500
@@ -5,7 +5,8 @@
# This software may be used and distributed according to the terms of the
# GNU General Public License version 2 or any later version.
-import getopt, util
+import getopt
+import util
from i18n import _
def gnugetopt(args, options, longoptions):
--- a/mercurial/fileset.py Wed Nov 06 18:19:04 2013 -0500
+++ b/mercurial/fileset.py Wed Nov 06 16:48:06 2013 -0500
@@ -5,7 +5,8 @@
# This software may be used and distributed according to the terms of the
# GNU General Public License version 2 or any later version.
-import parser, error, util, merge, re
+import re
+import parser, error, util, merge
from i18n import _
elements = {
--- a/mercurial/hbisect.py Wed Nov 06 18:19:04 2013 -0500
+++ b/mercurial/hbisect.py Wed Nov 06 16:48:06 2013 -0500
@@ -8,7 +8,8 @@
# This software may be used and distributed according to the terms of the
# GNU General Public License version 2 or any later version.
-import os, error
+import os
+import error
from i18n import _
from node import short, hex
import util
--- a/mercurial/help.py Wed Nov 06 18:19:04 2013 -0500
+++ b/mercurial/help.py Wed Nov 06 16:48:06 2013 -0500
@@ -6,7 +6,8 @@
# GNU General Public License version 2 or any later version.
from i18n import gettext, _
-import itertools, sys, os, error
+import itertools, sys, os
+import error
import extensions, revset, fileset, templatekw, templatefilters, filemerge
import encoding, util, minirst
import cmdutil
--- a/mercurial/hgweb/hgweb_mod.py Wed Nov 06 18:19:04 2013 -0500
+++ b/mercurial/hgweb/hgweb_mod.py Wed Nov 06 16:48:06 2013 -0500
@@ -6,7 +6,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 os
+import os, re
from mercurial import ui, hg, hook, error, encoding, templater, util, repoview
from mercurial.templatefilters import websub
from mercurial.i18n import _
@@ -14,7 +14,7 @@
from common import HTTP_OK, HTTP_NOT_MODIFIED, HTTP_BAD_REQUEST
from common import HTTP_NOT_FOUND, HTTP_SERVER_ERROR
from request import wsgirequest
-import webcommands, protocol, webutil, re
+import webcommands, protocol, webutil
perms = {
'changegroup': 'pull',
--- a/mercurial/mdiff.py Wed Nov 06 18:19:04 2013 -0500
+++ b/mercurial/mdiff.py Wed Nov 06 16:48:06 2013 -0500
@@ -6,8 +6,8 @@
# GNU General Public License version 2 or any later version.
from i18n import _
-import bdiff, mpatch, util
-import re, struct, base85, zlib
+import bdiff, mpatch, util, base85
+import re, struct, zlib
def splitnewlines(text):
'''like str.splitlines, but only split on newlines.'''
--- a/mercurial/setdiscovery.py Wed Nov 06 18:19:04 2013 -0500
+++ b/mercurial/setdiscovery.py Wed Nov 06 16:48:06 2013 -0500
@@ -8,7 +8,8 @@
from node import nullid
from i18n import _
-import random, util, dagutil
+import random
+import util, dagutil
def _updatesample(dag, nodes, sample, always, quicksamplesize=0):
# if nodes is empty we scan the entire graph
--- a/mercurial/util.py Wed Nov 06 18:19:04 2013 -0500
+++ b/mercurial/util.py Wed Nov 06 16:48:06 2013 -0500
@@ -14,9 +14,9 @@
"""
from i18n import _
-import error, osutil, encoding, collections
+import error, osutil, encoding
import errno, re, shutil, sys, tempfile, traceback
-import os, time, datetime, calendar, textwrap, signal
+import os, time, datetime, calendar, textwrap, signal, collections
import imp, socket, urllib
if os.name == 'nt':
--- a/mercurial/worker.py Wed Nov 06 18:19:04 2013 -0500
+++ b/mercurial/worker.py Wed Nov 06 16:48:06 2013 -0500
@@ -6,7 +6,8 @@
# GNU General Public License version 2 or any later version.
from i18n import _
-import errno, os, signal, sys, threading, util
+import errno, os, signal, sys, threading
+import util
def countcpus():
'''try to count the number of CPUs on the system'''