##// END OF EJS Templates
Remove unused imports from IPython.core
Thomas Kluyver -
Show More
@@ -21,7 +21,6 b' import os'
21 from shutil import copyfile
21 from shutil import copyfile
22 import sys
22 import sys
23
23
24 from IPython.core.error import UsageError
25 from IPython.config.configurable import Configurable
24 from IPython.config.configurable import Configurable
26 from IPython.utils.traitlets import Instance
25 from IPython.utils.traitlets import Instance
27 from IPython.utils.py3compat import PY3
26 from IPython.utils.py3compat import PY3
@@ -10,12 +10,6 b''
10 #-----------------------------------------------------------------------------
10 #-----------------------------------------------------------------------------
11
11
12 #-----------------------------------------------------------------------------
12 #-----------------------------------------------------------------------------
13 # Imports
14 #-----------------------------------------------------------------------------
15
16 import warnings
17
18 #-----------------------------------------------------------------------------
19 # Classes and functions
13 # Classes and functions
20 #-----------------------------------------------------------------------------
14 #-----------------------------------------------------------------------------
21
15
@@ -71,7 +71,6 b' import re'
71 import sys
71 import sys
72
72
73 # IPython modules
73 # IPython modules
74 from IPython.core.splitinput import split_user_input, LineInfo
75 from IPython.utils.py3compat import cast_unicode
74 from IPython.utils.py3compat import cast_unicode
76 from IPython.core.inputtransformer import (leading_indent,
75 from IPython.core.inputtransformer import (leading_indent,
77 classic_prompt,
76 classic_prompt,
@@ -85,7 +84,7 b' from IPython.core.inputtransformer import (leading_indent,'
85 assemble_python_lines,
84 assemble_python_lines,
86 )
85 )
87
86
88 # Temporary!
87 # These are available in this module for backwards compatibility.
89 from IPython.core.inputtransformer import (ESC_SHELL, ESC_SH_CAP, ESC_HELP,
88 from IPython.core.inputtransformer import (ESC_SHELL, ESC_SH_CAP, ESC_HELP,
90 ESC_HELP2, ESC_MAGIC, ESC_MAGIC2,
89 ESC_HELP2, ESC_MAGIC, ESC_MAGIC2,
91 ESC_QUOTE, ESC_QUOTE2, ESC_PAREN, ESC_SEQUENCES)
90 ESC_QUOTE, ESC_QUOTE2, ESC_PAREN, ESC_SEQUENCES)
@@ -3,7 +3,7 b' import functools'
3 import re
3 import re
4 from StringIO import StringIO
4 from StringIO import StringIO
5
5
6 from IPython.core.splitinput import split_user_input, LineInfo
6 from IPython.core.splitinput import LineInfo
7 from IPython.utils import tokenize2
7 from IPython.utils import tokenize2
8 from IPython.utils.tokenize2 import generate_tokens, untokenize, TokenError
8 from IPython.utils.tokenize2 import generate_tokens, untokenize, TokenError
9
9
@@ -15,7 +15,6 b''
15 # Imports
15 # Imports
16 #-----------------------------------------------------------------------------
16 #-----------------------------------------------------------------------------
17 # Stdlib
17 # Stdlib
18 import json
19 import os
18 import os
20 import re
19 import re
21 import sys
20 import sys
@@ -20,11 +20,10 b' import sys'
20 from pprint import pformat
20 from pprint import pformat
21
21
22 # Our own packages
22 # Our own packages
23 from IPython.core import magic_arguments
23 from IPython.core import magic_arguments, page
24 from IPython.core.error import UsageError
24 from IPython.core.error import UsageError
25 from IPython.core.magic import Magics, magics_class, line_magic, magic_escapes
25 from IPython.core.magic import Magics, magics_class, line_magic, magic_escapes
26 from IPython.utils.text import format_screen, dedent, indent
26 from IPython.utils.text import format_screen, dedent, indent
27 from IPython.core import magic_arguments, page
28 from IPython.testing.skipdoctest import skip_doctest
27 from IPython.testing.skipdoctest import skip_doctest
29 from IPython.utils.ipstruct import Struct
28 from IPython.utils.ipstruct import Struct
30 from IPython.utils.path import unquote_filename
29 from IPython.utils.path import unquote_filename
@@ -18,15 +18,12 b' from __future__ import print_function'
18 __all__ = ['Inspector','InspectColors']
18 __all__ = ['Inspector','InspectColors']
19
19
20 # stdlib modules
20 # stdlib modules
21 import __builtin__
22 import inspect
21 import inspect
23 import linecache
22 import linecache
24 import os
23 import os
25 import sys
26 import types
24 import types
27 import io as stdlib_io
25 import io as stdlib_io
28
26
29 from collections import namedtuple
30 try:
27 try:
31 from itertools import izip_longest
28 from itertools import izip_longest
32 except ImportError:
29 except ImportError:
@@ -29,11 +29,7 b' import re'
29 from IPython.core.autocall import IPyAutocall
29 from IPython.core.autocall import IPyAutocall
30 from IPython.config.configurable import Configurable
30 from IPython.config.configurable import Configurable
31 from IPython.core.inputsplitter import (
31 from IPython.core.inputsplitter import (
32 ESC_SHELL,
33 ESC_SH_CAP,
34 ESC_HELP,
35 ESC_MAGIC,
32 ESC_MAGIC,
36 ESC_MAGIC2,
37 ESC_QUOTE,
33 ESC_QUOTE,
38 ESC_QUOTE2,
34 ESC_QUOTE2,
39 ESC_PAREN,
35 ESC_PAREN,
@@ -15,11 +15,7 b' import tempfile'
15 import unittest
15 import unittest
16 from os.path import join
16 from os.path import join
17
17
18 import nose.tools as nt
19 from nose import SkipTest
20
21 from IPython.core.completerlib import magic_run_completer, module_completion
18 from IPython.core.completerlib import magic_run_completer, module_completion
22 from IPython.utils import py3compat
23 from IPython.utils.tempdir import TemporaryDirectory
19 from IPython.utils.tempdir import TemporaryDirectory
24
20
25
21
@@ -122,7 +122,7 b' def test_ipdb_magics():'
122 ipdb> continue
122 ipdb> continue
123 '''
123 '''
124
124
125 def test_ipdb_magics():
125 def test_ipdb_magics2():
126 '''Test ipdb with a very short function.
126 '''Test ipdb with a very short function.
127
127
128 >>> def bar():
128 >>> def bar():
@@ -3,7 +3,7 b''
3
3
4 import nose.tools as nt
4 import nose.tools as nt
5
5
6 from IPython.core.fakemodule import FakeModule, init_fakemod_dict
6 from IPython.core.fakemodule import FakeModule
7
7
8 # Make a fakemod and check a few properties
8 # Make a fakemod and check a few properties
9 def test_mk_fakemod():
9 def test_mk_fakemod():
@@ -9,8 +9,7 b' except:'
9 numpy = None
9 numpy = None
10 import nose.tools as nt
10 import nose.tools as nt
11
11
12 from IPython.core.formatters import FormatterABC, PlainTextFormatter
12 from IPython.core.formatters import PlainTextFormatter
13 from IPython.lib import pretty
14
13
15 class A(object):
14 class A(object):
16 def __repr__(self):
15 def __repr__(self):
@@ -7,10 +7,8 b''
7
7
8 # stdlib
8 # stdlib
9 import os
9 import os
10 import shutil
11 import sys
10 import sys
12 import tempfile
11 import tempfile
13 import unittest
14 from datetime import datetime
12 from datetime import datetime
15
13
16 # third party
14 # third party
@@ -388,14 +388,6 b' class InteractiveLoopTestCase(unittest.TestCase):'
388 self.check_ns(['x =(1+','1+','2)'], dict(x=4))
388 self.check_ns(['x =(1+','1+','2)'], dict(x=4))
389
389
390
390
391 def test_LineInfo():
392 """Simple test for LineInfo construction and str()"""
393 linfo = isp.LineInfo(' %cd /home')
394 nt.assert_equal(str(linfo), 'LineInfo [ |%|cd|/home]')
395
396
397
398
399 class IPythonInputTestCase(InputSplitterTestCase):
391 class IPythonInputTestCase(InputSplitterTestCase):
400 """By just creating a new class whose .isp is a different instance, we
392 """By just creating a new class whose .isp is a different instance, we
401 re-run the same test battery on the new input splitter.
393 re-run the same test battery on the new input splitter.
@@ -1,5 +1,4 b''
1 import tokenize
1 import tokenize
2 import unittest
3 import nose.tools as nt
2 import nose.tools as nt
4
3
5 from IPython.testing import tools as tt
4 from IPython.testing import tools as tt
@@ -4,17 +4,11 b''
4 # Module imports
4 # Module imports
5 #-----------------------------------------------------------------------------
5 #-----------------------------------------------------------------------------
6
6
7 # stdlib
8 import os
9 import shutil
10 import tempfile
11
12 # third party
7 # third party
13 import nose.tools as nt
8 import nose.tools as nt
14
9
15 # our own packages
10 # our own packages
16 from IPython.testing.globalipapp import get_ipython
11 from IPython.testing.globalipapp import get_ipython
17 from IPython.utils import py3compat
18
12
19 #-----------------------------------------------------------------------------
13 #-----------------------------------------------------------------------------
20 # Globals
14 # Globals
@@ -476,8 +476,6 b' def test_timeit_arguments():'
476
476
477 def test_timeit_special_syntax():
477 def test_timeit_special_syntax():
478 "Test %%timeit with IPython special syntax"
478 "Test %%timeit with IPython special syntax"
479 from IPython.core.magic import register_line_magic
480
481 @register_line_magic
479 @register_line_magic
482 def lmagic(line):
480 def lmagic(line):
483 ip = get_ipython()
481 ip = get_ipython()
@@ -208,7 +208,7 b' def test_calltip_cell_magic():'
208 check_calltip(cmagic, 'cmagic', 'cmagic(line, cell)', "A cell magic")
208 check_calltip(cmagic, 'cmagic', 'cmagic(line, cell)', "A cell magic")
209
209
210
210
211 def test_calltip_line_magic():
211 def test_calltip_line_cell_magic():
212 check_calltip(lcmagic, 'lcmagic', 'lcmagic(line, cell=None)',
212 check_calltip(lcmagic, 'lcmagic', 'lcmagic(line, cell=None)',
213 "A line/cell magic")
213 "A line/cell magic")
214
214
@@ -6,7 +6,7 b''
6 import nose.tools as nt
6 import nose.tools as nt
7
7
8 from IPython.core.prefilter import AutocallChecker
8 from IPython.core.prefilter import AutocallChecker
9 from IPython.testing import tools as tt, decorators as dec
9 from IPython.testing import decorators as dec
10 from IPython.testing.globalipapp import get_ipython
10 from IPython.testing.globalipapp import get_ipython
11
11
12 #-----------------------------------------------------------------------------
12 #-----------------------------------------------------------------------------
@@ -29,7 +29,6 b' import tempfile'
29 from unittest import TestCase
29 from unittest import TestCase
30
30
31 import nose.tools as nt
31 import nose.tools as nt
32 from nose import SkipTest
33
32
34 from IPython.core.profileapp import list_profiles_in, list_bundled_profiles
33 from IPython.core.profileapp import list_profiles_in, list_bundled_profiles
35 from IPython.core.profiledir import ProfileDir
34 from IPython.core.profiledir import ProfileDir
@@ -4,12 +4,10 b''
4 import unittest
4 import unittest
5
5
6 import os
6 import os
7 import nose.tools as nt
8
7
9 from IPython.testing import tools as tt, decorators as dec
8 from IPython.testing import tools as tt, decorators as dec
10 from IPython.core.prompts import PromptManager, LazyEvaluate
9 from IPython.core.prompts import PromptManager, LazyEvaluate
11 from IPython.testing.globalipapp import get_ipython
10 from IPython.testing.globalipapp import get_ipython
12 from IPython.utils import py3compat
13 from IPython.utils.tempdir import TemporaryDirectory
11 from IPython.utils.tempdir import TemporaryDirectory
14
12
15 ip = get_ipython()
13 ip = get_ipython()
@@ -17,8 +17,6 b' Authors'
17 #-----------------------------------------------------------------------------
17 #-----------------------------------------------------------------------------
18 import unittest
18 import unittest
19
19
20 import nose.tools as nt
21
22 from IPython.testing import decorators as dec
20 from IPython.testing import decorators as dec
23 from IPython.testing import tools as tt
21 from IPython.testing import tools as tt
24
22
@@ -1,5 +1,7 b''
1 # coding: utf-8
1 # coding: utf-8
2 from IPython.core.splitinput import split_user_input
2 import nose.tools as nt
3
4 from IPython.core.splitinput import split_user_input, LineInfo
3 from IPython.testing import tools as tt
5 from IPython.testing import tools as tt
4 from IPython.utils import py3compat
6 from IPython.utils import py3compat
5
7
@@ -33,3 +35,8 b' else:'
33
35
34 def test_split_user_input():
36 def test_split_user_input():
35 return tt.check_pairs(split_user_input, tests)
37 return tt.check_pairs(split_user_input, tests)
38
39 def test_LineInfo():
40 """Simple test for LineInfo construction and str()"""
41 linfo = LineInfo(' %cd /home')
42 nt.assert_equal(str(linfo), 'LineInfo [ |%|cd|/home]')
General Comments 0
You need to be logged in to leave comments. Login now