From 54891794b298a6b75ef6578c48f5f991c8b040f3 2013-10-29 16:14:15 From: Thomas Kluyver Date: 2013-10-29 16:14:15 Subject: [PATCH] Use explicit relative imports python-modernize with lib2to3.fixes.fix_import fixer --- diff --git a/IPython/external/decorator/__init__.py b/IPython/external/decorator/__init__.py index 697c21b..d0e95b4 100644 --- a/IPython/external/decorator/__init__.py +++ b/IPython/external/decorator/__init__.py @@ -1,4 +1,4 @@ try: from decorator import * except ImportError: - from _decorator import * + from ._decorator import * diff --git a/IPython/external/decorators/__init__.py b/IPython/external/decorators/__init__.py index 6401893..dd8f52b 100644 --- a/IPython/external/decorators/__init__.py +++ b/IPython/external/decorators/__init__.py @@ -2,8 +2,8 @@ try: from numpy.testing.decorators import * from numpy.testing.noseclasses import KnownFailure except ImportError: - from _decorators import * + from ._decorators import * try: - from _numpy_testing_noseclasses import KnownFailure + from ._numpy_testing_noseclasses import KnownFailure except ImportError: pass diff --git a/IPython/external/decorators/_decorators.py b/IPython/external/decorators/_decorators.py index b87a455..19de5e5 100644 --- a/IPython/external/decorators/_decorators.py +++ b/IPython/external/decorators/_decorators.py @@ -20,9 +20,9 @@ import warnings #from numpy.testing.utils import \ # WarningManager, WarningMessage # Our version: -from _numpy_testing_utils import WarningManager +from ._numpy_testing_utils import WarningManager try: - from _numpy_testing_noseclasses import KnownFailureTest + from ._numpy_testing_noseclasses import KnownFailureTest except: pass diff --git a/IPython/external/jsonpointer/__init__.py b/IPython/external/jsonpointer/__init__.py index 4643cb6..90383aa 100644 --- a/IPython/external/jsonpointer/__init__.py +++ b/IPython/external/jsonpointer/__init__.py @@ -1,4 +1,4 @@ try: from jsonpointer import * except ImportError : - from _jsonpointer import * + from ._jsonpointer import * diff --git a/IPython/external/jsonschema/__init__.py b/IPython/external/jsonschema/__init__.py index 59817d5..20eac31 100644 --- a/IPython/external/jsonschema/__init__.py +++ b/IPython/external/jsonschema/__init__.py @@ -1,4 +1,4 @@ try: from jsonschema import * except ImportError : - from _jsonschema import * + from ._jsonschema import * diff --git a/IPython/external/pexpect/__init__.py b/IPython/external/pexpect/__init__.py index ff99aae..a0cf671 100644 --- a/IPython/external/pexpect/__init__.py +++ b/IPython/external/pexpect/__init__.py @@ -2,4 +2,4 @@ try: import pexpect from pexpect import * except ImportError: - from _pexpect import * + from ._pexpect import * diff --git a/IPython/external/simplegeneric/__init__.py b/IPython/external/simplegeneric/__init__.py index be48f27..a81972a 100644 --- a/IPython/external/simplegeneric/__init__.py +++ b/IPython/external/simplegeneric/__init__.py @@ -1,4 +1,4 @@ try: from simplegeneric import * except ImportError: - from _simplegeneric import * + from ._simplegeneric import * diff --git a/IPython/external/ssh/tunnel.py b/IPython/external/ssh/tunnel.py index c63f0ce..6aa3f2d 100644 --- a/IPython/external/ssh/tunnel.py +++ b/IPython/external/ssh/tunnel.py @@ -35,7 +35,7 @@ try: except ImportError: paramiko = None else: - from forward import forward_tunnel + from .forward import forward_tunnel try: from IPython.external import pexpect diff --git a/IPython/kernel/zmq/displayhook.py b/IPython/kernel/zmq/displayhook.py index ef1c643..5ec9698 100644 --- a/IPython/kernel/zmq/displayhook.py +++ b/IPython/kernel/zmq/displayhook.py @@ -5,7 +5,7 @@ from IPython.core.displayhook import DisplayHook from IPython.kernel.inprocess.socket import SocketABC from IPython.utils.jsonutil import encode_images from IPython.utils.traitlets import Instance, Dict -from session import extract_header, Session +from .session import extract_header, Session class ZMQDisplayHook(object): """A simple displayhook that publishes the object's repr over a ZeroMQ diff --git a/IPython/kernel/zmq/embed.py b/IPython/kernel/zmq/embed.py index b9a0faf..cd721f9 100644 --- a/IPython/kernel/zmq/embed.py +++ b/IPython/kernel/zmq/embed.py @@ -8,7 +8,7 @@ import sys from IPython.utils.frame import extract_module_locals -from kernelapp import IPKernelApp +from .kernelapp import IPKernelApp #----------------------------------------------------------------------------- # Code diff --git a/IPython/kernel/zmq/iostream.py b/IPython/kernel/zmq/iostream.py index 8d66b8f..daabc62 100644 --- a/IPython/kernel/zmq/iostream.py +++ b/IPython/kernel/zmq/iostream.py @@ -16,7 +16,7 @@ from io import StringIO, UnsupportedOperation import zmq -from session import extract_header +from .session import extract_header from IPython.utils import py3compat diff --git a/IPython/kernel/zmq/ipkernel.py b/IPython/kernel/zmq/ipkernel.py index f5951e9..7dc6fcc 100755 --- a/IPython/kernel/zmq/ipkernel.py +++ b/IPython/kernel/zmq/ipkernel.py @@ -35,9 +35,9 @@ from IPython.utils.traitlets import ( Type ) -from serialize import serialize_object, unpack_apply_message -from session import Session -from zmqshell import ZMQInteractiveShell +from .serialize import serialize_object, unpack_apply_message +from .session import Session +from .zmqshell import ZMQInteractiveShell #----------------------------------------------------------------------------- diff --git a/IPython/kernel/zmq/kernelapp.py b/IPython/kernel/zmq/kernelapp.py index 7461bbf..bb707ce 100644 --- a/IPython/kernel/zmq/kernelapp.py +++ b/IPython/kernel/zmq/kernelapp.py @@ -50,13 +50,13 @@ from IPython.utils.importstring import import_item from IPython.kernel import write_connection_file # local imports -from heartbeat import Heartbeat -from ipkernel import Kernel -from parentpoller import ParentPollerUnix, ParentPollerWindows -from session import ( +from .heartbeat import Heartbeat +from .ipkernel import Kernel +from .parentpoller import ParentPollerUnix, ParentPollerWindows +from .session import ( Session, session_flags, session_aliases, default_secure, ) -from zmqshell import ZMQInteractiveShell +from .zmqshell import ZMQInteractiveShell #----------------------------------------------------------------------------- # Flags and Aliases diff --git a/IPython/kernel/zmq/zmqshell.py b/IPython/kernel/zmq/zmqshell.py index 8812994..cbb7295 100644 --- a/IPython/kernel/zmq/zmqshell.py +++ b/IPython/kernel/zmq/zmqshell.py @@ -50,7 +50,7 @@ from IPython.kernel.zmq.displayhook import ZMQShellDisplayHook from IPython.kernel.zmq.datapub import ZMQDataPublisher from IPython.kernel.zmq.session import extract_header from IPython.kernel.comm import CommManager -from session import Session +from .session import Session #----------------------------------------------------------------------------- # Functions and classes diff --git a/IPython/nbconvert/__init__.py b/IPython/nbconvert/__init__.py index 72166bc..9a915c8 100755 --- a/IPython/nbconvert/__init__.py +++ b/IPython/nbconvert/__init__.py @@ -1,7 +1,7 @@ """Utilities for converting notebooks to and from different formats.""" from .exporters import * -import filters -import preprocessors -import postprocessors -import writers +from . import filters +from . import preprocessors +from . import postprocessors +from . import writers diff --git a/IPython/parallel/tests/test_client.py b/IPython/parallel/tests/test_client.py index 24ebd14..34d9c88 100644 --- a/IPython/parallel/tests/test_client.py +++ b/IPython/parallel/tests/test_client.py @@ -30,7 +30,7 @@ from IPython.parallel import error from IPython.parallel import AsyncResult, AsyncHubResult from IPython.parallel import LoadBalancedView, DirectView -from clienttest import ClusterTestCase, segfault, wait, add_engines +from .clienttest import ClusterTestCase, segfault, wait, add_engines def setup(): add_engines(4, total=True) diff --git a/IPython/qt/console/console_widget.py b/IPython/qt/console/console_widget.py index be0abc9..c71d9e3 100644 --- a/IPython/qt/console/console_widget.py +++ b/IPython/qt/console/console_widget.py @@ -23,11 +23,11 @@ from IPython.qt.rich_text import HtmlExporter from IPython.qt.util import MetaQObjectHasTraits, get_font from IPython.utils.text import columnize from IPython.utils.traitlets import Bool, Enum, Integer, Unicode -from ansi_code_processor import QtAnsiCodeProcessor -from completion_widget import CompletionWidget -from completion_html import CompletionHtml -from completion_plain import CompletionPlain -from kill_ring import QtKillRing +from .ansi_code_processor import QtAnsiCodeProcessor +from .completion_widget import CompletionWidget +from .completion_html import CompletionHtml +from .completion_plain import CompletionPlain +from .kill_ring import QtKillRing #----------------------------------------------------------------------------- diff --git a/IPython/qt/console/frontend_widget.py b/IPython/qt/console/frontend_widget.py index 524cf76..acd3b49 100644 --- a/IPython/qt/console/frontend_widget.py +++ b/IPython/qt/console/frontend_widget.py @@ -16,11 +16,11 @@ from IPython.core.inputtransformer import classic_prompt from IPython.core.oinspect import call_tip from IPython.qt.base_frontend_mixin import BaseFrontendMixin from IPython.utils.traitlets import Bool, Instance, Unicode -from bracket_matcher import BracketMatcher -from call_tip_widget import CallTipWidget -from completion_lexer import CompletionLexer -from history_console_widget import HistoryConsoleWidget -from pygments_highlighter import PygmentsHighlighter +from .bracket_matcher import BracketMatcher +from .call_tip_widget import CallTipWidget +from .completion_lexer import CompletionLexer +from .history_console_widget import HistoryConsoleWidget +from .pygments_highlighter import PygmentsHighlighter class FrontendHighlighter(PygmentsHighlighter): diff --git a/IPython/qt/console/history_console_widget.py b/IPython/qt/console/history_console_widget.py index df7675c..eeb5414 100644 --- a/IPython/qt/console/history_console_widget.py +++ b/IPython/qt/console/history_console_widget.py @@ -3,7 +3,7 @@ from IPython.external.qt import QtGui # Local imports from IPython.utils.traitlets import Bool -from console_widget import ConsoleWidget +from .console_widget import ConsoleWidget class HistoryConsoleWidget(ConsoleWidget): diff --git a/IPython/qt/console/ipython_widget.py b/IPython/qt/console/ipython_widget.py index ca56588..71a0251 100644 --- a/IPython/qt/console/ipython_widget.py +++ b/IPython/qt/console/ipython_widget.py @@ -22,8 +22,8 @@ from IPython.external.qt import QtCore, QtGui from IPython.core.inputsplitter import IPythonInputSplitter from IPython.core.inputtransformer import ipy_prompt from IPython.utils.traitlets import Bool, Unicode -from frontend_widget import FrontendWidget -import styles +from .frontend_widget import FrontendWidget +from . import styles #----------------------------------------------------------------------------- # Constants diff --git a/IPython/qt/console/rich_ipython_widget.py b/IPython/qt/console/rich_ipython_widget.py index 302c6c6..4da9855 100644 --- a/IPython/qt/console/rich_ipython_widget.py +++ b/IPython/qt/console/rich_ipython_widget.py @@ -17,7 +17,7 @@ from IPython.external.qt import QtCore, QtGui # Local imports from IPython.utils.traitlets import Bool from IPython.qt.svg import save_svg, svg_to_clipboard, svg_to_image -from ipython_widget import IPythonWidget +from .ipython_widget import IPythonWidget class RichIPythonWidget(IPythonWidget): diff --git a/IPython/qt/kernel_mixins.py b/IPython/qt/kernel_mixins.py index e97b7b6..55c519e 100644 --- a/IPython/qt/kernel_mixins.py +++ b/IPython/qt/kernel_mixins.py @@ -6,7 +6,7 @@ from IPython.external.qt import QtCore # IPython imports. from IPython.utils.traitlets import HasTraits, Type -from util import MetaQObjectHasTraits, SuperQObject +from .util import MetaQObjectHasTraits, SuperQObject class ChannelQObject(SuperQObject): diff --git a/IPython/testing/__init__.py b/IPython/testing/__init__.py index 16601c0..f41951c 100644 --- a/IPython/testing/__init__.py +++ b/IPython/testing/__init__.py @@ -21,7 +21,7 @@ def test(all=False): # Do the import internally, so that this function doesn't increase total # import time - from iptest import run_iptestall + from .iptest import run_iptestall run_iptestall(inc_slow=all) # So nose doesn't try to run this as a test itself and we end up with an diff --git a/IPython/testing/decorators.py b/IPython/testing/decorators.py index 3ad0548..f768b82 100644 --- a/IPython/testing/decorators.py +++ b/IPython/testing/decorators.py @@ -55,7 +55,7 @@ import unittest from IPython.external.decorator import decorator # Expose the unittest-driven decorators -from ipunittest import ipdoctest, ipdocstring +from .ipunittest import ipdoctest, ipdocstring # Grab the numpy-specific decorators which we keep in a file that we # occasionally update from upstream: decorators.py is a copy of diff --git a/IPython/testing/plugin/iptest.py b/IPython/testing/plugin/iptest.py index 390c422..3a93d91 100755 --- a/IPython/testing/plugin/iptest.py +++ b/IPython/testing/plugin/iptest.py @@ -6,8 +6,8 @@ from nose.core import main from nose.plugins.builtin import plugins from nose.plugins.doctests import Doctest -import ipdoctest -from ipdoctest import IPDocTestRunner +from . import ipdoctest +from .ipdoctest import IPDocTestRunner if __name__ == '__main__': print 'WARNING: this code is incomplete!' diff --git a/IPython/utils/pickleutil.py b/IPython/utils/pickleutil.py index 61315c1..532fdd6 100644 --- a/IPython/utils/pickleutil.py +++ b/IPython/utils/pickleutil.py @@ -25,9 +25,9 @@ try: except ImportError: import pickle -import codeutil # This registers a hook when it's imported -import py3compat -from importstring import import_item +from . import codeutil # This registers a hook when it's imported +from . import py3compat +from .importstring import import_item from IPython.config import Application diff --git a/IPython/utils/tokenize2.py b/IPython/utils/tokenize2.py index d44a2f7..cbb5292 100644 --- a/IPython/utils/tokenize2.py +++ b/IPython/utils/tokenize2.py @@ -4,6 +4,6 @@ import sys if sys.version_info[0] >= 3: - from _tokenize_py3 import * + from ._tokenize_py3 import * else: - from _tokenize_py2 import * + from ._tokenize_py2 import *