##// END OF EJS Templates
Merge pull request #8135 from takluyver/bigsplit-qtconsole...
Min RK -
r20857:9821726b merge
parent child Browse files
Show More
@@ -0,0 +1,22 b''
1 """
2 Shim to maintain backwards compatibility with old IPython.qt imports.
3 """
4 # Copyright (c) IPython Development Team.
5 # Distributed under the terms of the Modified BSD License.
6
7 from __future__ import print_function
8
9 # Stdlib
10 import sys
11 import types
12 from warnings import warn
13
14 warn("The `IPython.qt` package has been deprecated. "
15 "You should import from jupyter_qtconsole instead.")
16
17 from IPython.utils.shimmodule import ShimModule
18
19 # Unconditionally insert the shim into sys.modules so that further import calls
20 # trigger the custom attribute access above
21
22 sys.modules['IPython.qt'] = ShimModule('qt', mirror='jupyter_qtconsole')
@@ -0,0 +1,43 b''
1 """A shim module for deprecated imports
2 """
3 # Copyright (c) IPython Development Team.
4 # Distributed under the terms of the Modified BSD License.
5
6 import types
7
8 class ShimModule(types.ModuleType):
9
10 def __init__(self, *args, **kwargs):
11 self._mirror = kwargs.pop("mirror")
12 super(ShimModule, self).__init__(*args, **kwargs)
13
14 def __getattr__(self, key):
15 # Use the equivalent of import_item(name), see below
16 name = "%s.%s" % (self._mirror, key)
17
18 # NOTE: the code below is copied *verbatim* from
19 # importstring.import_item. For some very strange reason that makes no
20 # sense to me, if we call it *as a function*, it doesn't work. This
21 # has something to do with the deep bowels of the import machinery and
22 # I couldn't find a way to make the code work as a standard function
23 # call. But at least since it's an unmodified copy of import_item,
24 # which is used extensively and has a test suite, we can be reasonably
25 # confident this is OK. If anyone finds how to call the function, all
26 # the below could be replaced simply with:
27 #
28 # from IPython.utils.importstring import import_item
29 # return import_item('MIRROR.' + key)
30
31 parts = name.rsplit('.', 1)
32 if len(parts) == 2:
33 # called with 'foo.bar....'
34 package, obj = parts
35 module = __import__(package, fromlist=[obj])
36 try:
37 pak = module.__dict__[obj]
38 except KeyError:
39 raise AttributeError(obj)
40 return pak
41 else:
42 # called with un-dotted string
43 return __import__(parts[0])
@@ -21,7 +21,7 b' before_install:'
21 - git clone --quiet --depth 1 https://github.com/minrk/travis-wheels travis-wheels
21 - git clone --quiet --depth 1 https://github.com/minrk/travis-wheels travis-wheels
22 - 'if [[ $GROUP != js* ]]; then COVERAGE="--coverage xml"; fi'
22 - 'if [[ $GROUP != js* ]]; then COVERAGE="--coverage xml"; fi'
23 install:
23 install:
24 - pip install -f travis-wheels/wheelhouse file://$PWD#egg=ipython[all] coveralls
24 - pip install -f travis-wheels/wheelhouse -e file://$PWD#egg=ipython[all] coveralls
25 before_script:
25 before_script:
26 - 'if [[ $GROUP == js* ]]; then python -m IPython.external.mathjax mathjax.zip; fi'
26 - 'if [[ $GROUP == js* ]]; then python -m IPython.external.mathjax mathjax.zip; fi'
27 script:
27 script:
@@ -9,17 +9,9 b' This will let code that was making `from IPython.frontend...` calls continue'
9 working, though a warning will be printed.
9 working, though a warning will be printed.
10 """
10 """
11
11
12 #-----------------------------------------------------------------------------
12 # Copyright (c) IPython Development Team.
13 # Copyright (c) 2013, IPython Development Team.
13 # Distributed under the terms of the Modified BSD License.
14 #
15 # Distributed under the terms of the Modified BSD License.
16 #
17 # The full license is in the file COPYING.txt, distributed with this software.
18 #-----------------------------------------------------------------------------
19
14
20 #-----------------------------------------------------------------------------
21 # Imports
22 #-----------------------------------------------------------------------------
23 from __future__ import print_function
15 from __future__ import print_function
24
16
25 # Stdlib
17 # Stdlib
@@ -30,47 +22,7 b' from warnings import warn'
30 warn("The top-level `frontend` package has been deprecated. "
22 warn("The top-level `frontend` package has been deprecated. "
31 "All its subpackages have been moved to the top `IPython` level.")
23 "All its subpackages have been moved to the top `IPython` level.")
32
24
33 #-----------------------------------------------------------------------------
25 from IPython.utils.shimmodule import ShimModule
34 # Class declarations
35 #-----------------------------------------------------------------------------
36
37 class ShimModule(types.ModuleType):
38
39 def __init__(self, *args, **kwargs):
40 self._mirror = kwargs.pop("mirror")
41 super(ShimModule, self).__init__(*args, **kwargs)
42
43 def __getattr__(self, key):
44 # Use the equivalent of import_item(name), see below
45 name = "%s.%s" % (self._mirror, key)
46
47 # NOTE: the code below is copied *verbatim* from
48 # importstring.import_item. For some very strange reason that makes no
49 # sense to me, if we call it *as a function*, it doesn't work. This
50 # has something to do with the deep bowels of the import machinery and
51 # I couldn't find a way to make the code work as a standard function
52 # call. But at least since it's an unmodified copy of import_item,
53 # which is used extensively and has a test suite, we can be reasonably
54 # confident this is OK. If anyone finds how to call the function, all
55 # the below could be replaced simply with:
56 #
57 # from IPython.utils.importstring import import_item
58 # return import_item('MIRROR.' + key)
59
60 parts = name.rsplit('.', 1)
61 if len(parts) == 2:
62 # called with 'foo.bar....'
63 package, obj = parts
64 module = __import__(package, fromlist=[obj])
65 try:
66 pak = module.__dict__[obj]
67 except KeyError:
68 raise AttributeError(obj)
69 return pak
70 else:
71 # called with un-dotted string
72 return __import__(parts[0])
73
74
26
75 # Unconditionally insert the shim into sys.modules so that further import calls
27 # Unconditionally insert the shim into sys.modules so that further import calls
76 # trigger the custom attribute access above
28 # trigger the custom attribute access above
1 NO CONTENT: file renamed from IPython/qt/__init__.py to jupyter_qtconsole/__init__.py
NO CONTENT: file renamed from IPython/qt/__init__.py to jupyter_qtconsole/__init__.py
1 NO CONTENT: file renamed from IPython/qt/base_frontend_mixin.py to jupyter_qtconsole/base_frontend_mixin.py
NO CONTENT: file renamed from IPython/qt/base_frontend_mixin.py to jupyter_qtconsole/base_frontend_mixin.py
1 NO CONTENT: file renamed from IPython/qt/client.py to jupyter_qtconsole/client.py
NO CONTENT: file renamed from IPython/qt/client.py to jupyter_qtconsole/client.py
1 NO CONTENT: file renamed from IPython/qt/console/__init__.py to jupyter_qtconsole/console/__init__.py
NO CONTENT: file renamed from IPython/qt/console/__init__.py to jupyter_qtconsole/console/__init__.py
1 NO CONTENT: file renamed from IPython/qt/console/__main__.py to jupyter_qtconsole/console/__main__.py
NO CONTENT: file renamed from IPython/qt/console/__main__.py to jupyter_qtconsole/console/__main__.py
1 NO CONTENT: file renamed from IPython/qt/console/ansi_code_processor.py to jupyter_qtconsole/console/ansi_code_processor.py
NO CONTENT: file renamed from IPython/qt/console/ansi_code_processor.py to jupyter_qtconsole/console/ansi_code_processor.py
1 NO CONTENT: file renamed from IPython/qt/console/bracket_matcher.py to jupyter_qtconsole/console/bracket_matcher.py
NO CONTENT: file renamed from IPython/qt/console/bracket_matcher.py to jupyter_qtconsole/console/bracket_matcher.py
1 NO CONTENT: file renamed from IPython/qt/console/call_tip_widget.py to jupyter_qtconsole/console/call_tip_widget.py
NO CONTENT: file renamed from IPython/qt/console/call_tip_widget.py to jupyter_qtconsole/console/call_tip_widget.py
1 NO CONTENT: file renamed from IPython/qt/console/completion_html.py to jupyter_qtconsole/console/completion_html.py
NO CONTENT: file renamed from IPython/qt/console/completion_html.py to jupyter_qtconsole/console/completion_html.py
1 NO CONTENT: file renamed from IPython/qt/console/completion_plain.py to jupyter_qtconsole/console/completion_plain.py
NO CONTENT: file renamed from IPython/qt/console/completion_plain.py to jupyter_qtconsole/console/completion_plain.py
1 NO CONTENT: file renamed from IPython/qt/console/completion_widget.py to jupyter_qtconsole/console/completion_widget.py
NO CONTENT: file renamed from IPython/qt/console/completion_widget.py to jupyter_qtconsole/console/completion_widget.py
1 NO CONTENT: file renamed from IPython/qt/console/console_widget.py to jupyter_qtconsole/console/console_widget.py
NO CONTENT: file renamed from IPython/qt/console/console_widget.py to jupyter_qtconsole/console/console_widget.py
1 NO CONTENT: file renamed from IPython/qt/console/frontend_widget.py to jupyter_qtconsole/console/frontend_widget.py
NO CONTENT: file renamed from IPython/qt/console/frontend_widget.py to jupyter_qtconsole/console/frontend_widget.py
1 NO CONTENT: file renamed from IPython/qt/console/history_console_widget.py to jupyter_qtconsole/console/history_console_widget.py
NO CONTENT: file renamed from IPython/qt/console/history_console_widget.py to jupyter_qtconsole/console/history_console_widget.py
1 NO CONTENT: file renamed from IPython/qt/console/ipython_widget.py to jupyter_qtconsole/console/ipython_widget.py
NO CONTENT: file renamed from IPython/qt/console/ipython_widget.py to jupyter_qtconsole/console/ipython_widget.py
1 NO CONTENT: file renamed from IPython/qt/console/kill_ring.py to jupyter_qtconsole/console/kill_ring.py
NO CONTENT: file renamed from IPython/qt/console/kill_ring.py to jupyter_qtconsole/console/kill_ring.py
1 NO CONTENT: file renamed from IPython/qt/console/magic_helper.py to jupyter_qtconsole/console/magic_helper.py
NO CONTENT: file renamed from IPython/qt/console/magic_helper.py to jupyter_qtconsole/console/magic_helper.py
1 NO CONTENT: file renamed from IPython/qt/console/mainwindow.py to jupyter_qtconsole/console/mainwindow.py
NO CONTENT: file renamed from IPython/qt/console/mainwindow.py to jupyter_qtconsole/console/mainwindow.py
1 NO CONTENT: file renamed from IPython/qt/console/pygments_highlighter.py to jupyter_qtconsole/console/pygments_highlighter.py
NO CONTENT: file renamed from IPython/qt/console/pygments_highlighter.py to jupyter_qtconsole/console/pygments_highlighter.py
1 NO CONTENT: file renamed from IPython/qt/console/qtconsoleapp.py to jupyter_qtconsole/console/qtconsoleapp.py
NO CONTENT: file renamed from IPython/qt/console/qtconsoleapp.py to jupyter_qtconsole/console/qtconsoleapp.py
1 NO CONTENT: file renamed from IPython/qt/console/resources/icon/IPythonConsole.svg to jupyter_qtconsole/console/resources/icon/IPythonConsole.svg
NO CONTENT: file renamed from IPython/qt/console/resources/icon/IPythonConsole.svg to jupyter_qtconsole/console/resources/icon/IPythonConsole.svg
1 NO CONTENT: file renamed from IPython/qt/console/rich_ipython_widget.py to jupyter_qtconsole/console/rich_ipython_widget.py
NO CONTENT: file renamed from IPython/qt/console/rich_ipython_widget.py to jupyter_qtconsole/console/rich_ipython_widget.py
1 NO CONTENT: file renamed from IPython/qt/console/styles.py to jupyter_qtconsole/console/styles.py
NO CONTENT: file renamed from IPython/qt/console/styles.py to jupyter_qtconsole/console/styles.py
1 NO CONTENT: file renamed from IPython/qt/console/tests/__init__.py to jupyter_qtconsole/console/tests/__init__.py
NO CONTENT: file renamed from IPython/qt/console/tests/__init__.py to jupyter_qtconsole/console/tests/__init__.py
1 NO CONTENT: file renamed from IPython/qt/console/tests/test_ansi_code_processor.py to jupyter_qtconsole/console/tests/test_ansi_code_processor.py
NO CONTENT: file renamed from IPython/qt/console/tests/test_ansi_code_processor.py to jupyter_qtconsole/console/tests/test_ansi_code_processor.py
1 NO CONTENT: file renamed from IPython/qt/console/tests/test_app.py to jupyter_qtconsole/console/tests/test_app.py
NO CONTENT: file renamed from IPython/qt/console/tests/test_app.py to jupyter_qtconsole/console/tests/test_app.py
1 NO CONTENT: file renamed from IPython/qt/console/tests/test_console_widget.py to jupyter_qtconsole/console/tests/test_console_widget.py
NO CONTENT: file renamed from IPython/qt/console/tests/test_console_widget.py to jupyter_qtconsole/console/tests/test_console_widget.py
1 NO CONTENT: file renamed from IPython/qt/console/tests/test_kill_ring.py to jupyter_qtconsole/console/tests/test_kill_ring.py
NO CONTENT: file renamed from IPython/qt/console/tests/test_kill_ring.py to jupyter_qtconsole/console/tests/test_kill_ring.py
1 NO CONTENT: file renamed from IPython/qt/inprocess.py to jupyter_qtconsole/inprocess.py
NO CONTENT: file renamed from IPython/qt/inprocess.py to jupyter_qtconsole/inprocess.py
1 NO CONTENT: file renamed from IPython/qt/kernel_mixins.py to jupyter_qtconsole/kernel_mixins.py
NO CONTENT: file renamed from IPython/qt/kernel_mixins.py to jupyter_qtconsole/kernel_mixins.py
1 NO CONTENT: file renamed from IPython/qt/manager.py to jupyter_qtconsole/manager.py
NO CONTENT: file renamed from IPython/qt/manager.py to jupyter_qtconsole/manager.py
1 NO CONTENT: file renamed from IPython/qt/rich_text.py to jupyter_qtconsole/rich_text.py
NO CONTENT: file renamed from IPython/qt/rich_text.py to jupyter_qtconsole/rich_text.py
1 NO CONTENT: file renamed from IPython/qt/svg.py to jupyter_qtconsole/svg.py
NO CONTENT: file renamed from IPython/qt/svg.py to jupyter_qtconsole/svg.py
1 NO CONTENT: file renamed from IPython/qt/util.py to jupyter_qtconsole/util.py
NO CONTENT: file renamed from IPython/qt/util.py to jupyter_qtconsole/util.py
General Comments 0
You need to be logged in to leave comments. Login now