From ad7f19cd022f2fc903dd1fbf97538f3d8e7e74f1 2014-05-01 23:43:02 From: Thomas Kluyver Date: 2014-05-01 23:43:02 Subject: [PATCH] Merge pull request #5771 from spenczar/no_unused_imports Remove unused imports --- diff --git a/IPython/config/loader.py b/IPython/config/loader.py index 1051cde..a29e5d5 100644 --- a/IPython/config/loader.py +++ b/IPython/config/loader.py @@ -35,7 +35,7 @@ from IPython.utils.path import filefind, get_ipython_dir from IPython.utils import py3compat from IPython.utils.encoding import DEFAULT_ENCODING from IPython.utils.py3compat import unicode_type, iteritems -from IPython.utils.traitlets import HasTraits, List, Any, TraitError +from IPython.utils.traitlets import HasTraits, List, Any #----------------------------------------------------------------------------- # Exceptions diff --git a/IPython/core/application.py b/IPython/core/application.py index 8e02ffa..5608de1 100644 --- a/IPython/core/application.py +++ b/IPython/core/application.py @@ -28,7 +28,6 @@ Authors: #----------------------------------------------------------------------------- import atexit -import errno import glob import logging import os diff --git a/IPython/core/completer.py b/IPython/core/completer.py index b1bc646..8ce61c7 100644 --- a/IPython/core/completer.py +++ b/IPython/core/completer.py @@ -79,7 +79,6 @@ from IPython.config.configurable import Configurable from IPython.core.error import TryNext from IPython.core.inputsplitter import ESC_MAGIC from IPython.utils import generics -from IPython.utils import io from IPython.utils.dir2 import dir2 from IPython.utils.process import arg_split from IPython.utils.py3compat import builtin_mod, string_types diff --git a/IPython/core/formatters.py b/IPython/core/formatters.py index 4e6fd76..51077e9 100644 --- a/IPython/core/formatters.py +++ b/IPython/core/formatters.py @@ -35,11 +35,9 @@ from IPython.external.decorator import decorator # Our own imports from IPython.config.configurable import Configurable from IPython.lib import pretty -from IPython.utils import io from IPython.utils.traitlets import ( Bool, Dict, Integer, Unicode, CUnicode, ObjectName, List, ) -from IPython.utils.warn import warn from IPython.utils.py3compat import ( unicode_to_str, with_metaclass, PY3, string_types, unicode_type, ) diff --git a/IPython/core/profiledir.py b/IPython/core/profiledir.py index 508d90c..bff81e2 100644 --- a/IPython/core/profiledir.py +++ b/IPython/core/profiledir.py @@ -7,7 +7,6 @@ import os import shutil import errno -import time from IPython.config.configurable import LoggingConfigurable from IPython.utils.path import get_ipython_package_dir, expand_path, ensure_dir_exists diff --git a/IPython/core/pylabtools.py b/IPython/core/pylabtools.py index 5f00e92..a4b396a 100644 --- a/IPython/core/pylabtools.py +++ b/IPython/core/pylabtools.py @@ -20,7 +20,6 @@ from __future__ import print_function # Imports #----------------------------------------------------------------------------- -import sys from io import BytesIO from IPython.core.display import _pngxy diff --git a/IPython/core/shellapp.py b/IPython/core/shellapp.py index f957cc9..e7b57b1 100644 --- a/IPython/core/shellapp.py +++ b/IPython/core/shellapp.py @@ -35,7 +35,7 @@ from IPython.utils import py3compat from IPython.utils.contexts import preserve_keys from IPython.utils.path import filefind from IPython.utils.traitlets import ( - Unicode, Instance, List, Bool, CaselessStrEnum, Dict + Unicode, Instance, List, Bool, CaselessStrEnum ) from IPython.lib.inputhook import guis diff --git a/IPython/external/qt_for_kernel.py b/IPython/external/qt_for_kernel.py index d360054..d478c55 100644 --- a/IPython/external/qt_for_kernel.py +++ b/IPython/external/qt_for_kernel.py @@ -34,7 +34,6 @@ else: import os import sys -from IPython.utils.warn import warn from IPython.utils.version import check_version from IPython.external.qt_loaders import (load_qt, QT_API_PYSIDE, QT_API_PYQT, QT_API_PYQT_DEFAULT, diff --git a/IPython/html/nbconvert/handlers.py b/IPython/html/nbconvert/handlers.py index 1cb9ba9..fb97f5f 100644 --- a/IPython/html/nbconvert/handlers.py +++ b/IPython/html/nbconvert/handlers.py @@ -7,11 +7,8 @@ from tornado import web from ..base.handlers import IPythonHandler, notebook_path_regex from IPython.nbformat.current import to_notebook_json -from IPython.utils import tz from IPython.utils.py3compat import cast_bytes -import sys - def find_resource_files(output_files_dir): files = [] for dirpath, dirnames, filenames in os.walk(output_files_dir): @@ -137,4 +134,4 @@ default_handlers = [ (r"/nbconvert/%s%s" % (_format_regex, notebook_path_regex), NbconvertFileHandler), (r"/nbconvert/%s" % _format_regex, NbconvertPostHandler), -] \ No newline at end of file +] diff --git a/IPython/html/services/kernels/kernelmanager.py b/IPython/html/services/kernels/kernelmanager.py index 5ff0751..ff27b59 100644 --- a/IPython/html/services/kernels/kernelmanager.py +++ b/IPython/html/services/kernels/kernelmanager.py @@ -21,9 +21,7 @@ import os from tornado import web from IPython.kernel.multikernelmanager import MultiKernelManager -from IPython.utils.traitlets import ( - Dict, List, Unicode, -) +from IPython.utils.traitlets import List, Unicode, TraitError from IPython.html.utils import to_os_path from IPython.utils.py3compat import getcwd diff --git a/IPython/html/services/kernels/tests/test_kernels_api.py b/IPython/html/services/kernels/tests/test_kernels_api.py index 52b6cf2..5e624a7 100644 --- a/IPython/html/services/kernels/tests/test_kernels_api.py +++ b/IPython/html/services/kernels/tests/test_kernels_api.py @@ -1,10 +1,6 @@ """Test the kernels service API.""" -import os -import sys -import json - import requests from IPython.html.utils import url_path_join diff --git a/IPython/html/tree/handlers.py b/IPython/html/tree/handlers.py index e5adf03..b58fe67 100644 --- a/IPython/html/tree/handlers.py +++ b/IPython/html/tree/handlers.py @@ -15,11 +15,9 @@ Authors: #----------------------------------------------------------------------------- # Imports #----------------------------------------------------------------------------- -import os - from tornado import web from ..base.handlers import IPythonHandler, notebook_path_regex, path_regex -from ..utils import url_path_join, path2url, url2path, url_escape, is_hidden +from ..utils import url_path_join, url_escape #----------------------------------------------------------------------------- # Handlers diff --git a/IPython/nbconvert/nbconvertapp.py b/IPython/nbconvert/nbconvertapp.py index 0ef2072..c49c077 100755 --- a/IPython/nbconvert/nbconvertapp.py +++ b/IPython/nbconvert/nbconvertapp.py @@ -21,7 +21,6 @@ from IPython.utils.traitlets import ( Unicode, List, Instance, DottedObjectName, Type, CaselessStrEnum, ) from IPython.utils.importstring import import_item -from IPython.utils.text import dedent from .exporters.export import get_export_names, exporter_map from IPython.nbconvert import exporters, preprocessors, writers, postprocessors diff --git a/IPython/nbformat/convert.py b/IPython/nbformat/convert.py index 7ae96ee..049883a 100644 --- a/IPython/nbformat/convert.py +++ b/IPython/nbformat/convert.py @@ -16,8 +16,6 @@ Authors: # Imports #----------------------------------------------------------------------------- -import re - from .reader import get_version, versions #----------------------------------------------------------------------------- diff --git a/IPython/parallel/factory.py b/IPython/parallel/factory.py index 4636136..92a3d9c 100644 --- a/IPython/parallel/factory.py +++ b/IPython/parallel/factory.py @@ -16,19 +16,11 @@ Authors: # Imports #----------------------------------------------------------------------------- - -import logging -import os - -import zmq -from zmq.eventloop.ioloop import IOLoop - -from IPython.config.configurable import Configurable from IPython.utils.localinterfaces import localhost -from IPython.utils.traitlets import Integer, Instance, Unicode +from IPython.utils.traitlets import Integer, Unicode from IPython.parallel.util import select_random_ports -from IPython.kernel.zmq.session import Session, SessionFactory +from IPython.kernel.zmq.session import SessionFactory #----------------------------------------------------------------------------- # Classes diff --git a/IPython/parallel/util.py b/IPython/parallel/util.py index 03e09b8..ee4084f 100644 --- a/IPython/parallel/util.py +++ b/IPython/parallel/util.py @@ -33,9 +33,7 @@ from IPython.config.application import Application from IPython.utils.localinterfaces import localhost, is_public_ip, public_ips from IPython.utils.py3compat import string_types, iteritems, itervalues from IPython.kernel.zmq.log import EnginePUBHandler -from IPython.kernel.zmq.serialize import ( - unserialize_object, serialize_object, pack_apply_message, unpack_apply_message -) + #----------------------------------------------------------------------------- # Classes @@ -387,4 +385,4 @@ def set_hwm(sock, hwm=0): except zmq.ZMQError: pass - \ No newline at end of file + diff --git a/IPython/terminal/ipapp.py b/IPython/terminal/ipapp.py index b98cd88..658b2cf 100755 --- a/IPython/terminal/ipapp.py +++ b/IPython/terminal/ipapp.py @@ -30,9 +30,7 @@ import logging import os import sys -from IPython.config.loader import ( - Config, PyFileConfigLoader, ConfigFileNotFound -) +from IPython.config.loader import Config from IPython.config.application import boolean_flag, catch_config_error, Application from IPython.core import release from IPython.core import usage diff --git a/IPython/utils/pickleshare.py b/IPython/utils/pickleshare.py index 36211c1..e0f23f3 100755 --- a/IPython/utils/pickleshare.py +++ b/IPython/utils/pickleshare.py @@ -35,7 +35,7 @@ License: MIT open source license. from __future__ import print_function from IPython.external.path import path as Path -import os,stat,time +import stat, time import collections try: import cPickle as pickle diff --git a/IPython/utils/process.py b/IPython/utils/process.py index 2e8d0f9..a7a54ea 100644 --- a/IPython/utils/process.py +++ b/IPython/utils/process.py @@ -18,7 +18,6 @@ from __future__ import print_function # Stdlib import os import sys -import shlex # Our own if sys.platform == 'win32': diff --git a/docs/gh-pages.py b/docs/gh-pages.py index 3294bf8..b32cf5d 100755 --- a/docs/gh-pages.py +++ b/docs/gh-pages.py @@ -15,7 +15,6 @@ something like 'current' as a stable URL for the most current version of the """ # Imports #----------------------------------------------------------------------------- import os -import re import shutil import sys from os import chdir as cd diff --git a/examples/Customization/appconfig.py b/examples/Customization/appconfig.py index c2e4d26..0d1c266 100644 --- a/examples/Customization/appconfig.py +++ b/examples/Customization/appconfig.py @@ -33,7 +33,7 @@ the trait's events for all of the config=True attributes. from IPython.config.configurable import Configurable from IPython.config.application import Application from IPython.utils.traitlets import ( - Bool, Unicode, Int, Float, List, Dict + Bool, Unicode, Int, List, Dict ) diff --git a/setupext/setupext.py b/setupext/setupext.py index f8e4b59..070b3e3 100644 --- a/setupext/setupext.py +++ b/setupext/setupext.py @@ -14,7 +14,7 @@ __docformat__ = "restructuredtext en" # Imports #------------------------------------------------------------------------------- -import sys, os +import sys from textwrap import fill display_status=True diff --git a/tools/github_stats.py b/tools/github_stats.py index abe1bbe..dcd2d13 100755 --- a/tools/github_stats.py +++ b/tools/github_stats.py @@ -12,8 +12,6 @@ To generate a report for IPython 2.0, run: from __future__ import print_function import codecs -import json -import re import sys from argparse import ArgumentParser diff --git a/tools/make_tarball.py b/tools/make_tarball.py index 33c5ec5..3e59a4f 100755 --- a/tools/make_tarball.py +++ b/tools/make_tarball.py @@ -4,10 +4,8 @@ import commands import os -import sys -import shutil -from toollib import * +from toollib import cd, sh tag = commands.getoutput('git describe --tags') base_name = 'ipython-%s' % tag diff --git a/tools/toollib.py b/tools/toollib.py index 41b9dd3..65f9eb4 100644 --- a/tools/toollib.py +++ b/tools/toollib.py @@ -6,8 +6,6 @@ from __future__ import print_function import os import sys -from distutils.dir_util import remove_tree - # Useful shorthands pjoin = os.path.join cd = os.chdir