qt.py 762 B

123456789101112131415161718192021222324
  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. import sys
  7. from warnings import warn
  8. from IPython.utils.shimmodule import ShimModule, ShimWarning
  9. warn("The `IPython.qt` package has been deprecated since IPython 4.0. "
  10. "You should import from qtconsole instead.", ShimWarning)
  11. # Unconditionally insert the shim into sys.modules so that further import calls
  12. # trigger the custom attribute access above
  13. _console = sys.modules['IPython.qt.console'] = ShimModule(
  14. src='IPython.qt.console', mirror='qtconsole')
  15. _qt = ShimModule(src='IPython.qt', mirror='qtconsole')
  16. _qt.console = _console
  17. sys.modules['IPython.qt'] = _qt