##// END OF EJS Templates
Merge pull request #9504 from Carreau/cleanup-deprecated-features...
Thomas Kluyver -
r22412:33883d8a merge
parent child Browse files
Show More
@@ -144,14 +144,3 b' def start_kernel(argv=None, **kwargs):'
144 from IPython.kernel.zmq.kernelapp import launch_new_instance
144 from IPython.kernel.zmq.kernelapp import launch_new_instance
145 return launch_new_instance(argv=argv, **kwargs)
145 return launch_new_instance(argv=argv, **kwargs)
146
146
147 # deprecated shim for IPython.Config
148 import traitlets.config
149 class Config(traitlets.config.Config):
150 def __init__(self, *args, **kwargs):
151 warnings.warn(
152 "IPython.Config is deprecated and will be removed in IPython 5."
153 " Use traitlets.config.Config.",
154 DeprecationWarning, stacklevel=2,
155 )
156 super(Config, self).__init__(*args, **kwargs)
157
@@ -57,7 +57,7 b' class BuiltinTrap(Configurable):'
57 from IPython.lib import deepreload
57 from IPython.lib import deepreload
58 if self.shell.deep_reload:
58 if self.shell.deep_reload:
59 from warnings import warn
59 from warnings import warn
60 warn("Automatically replacing builtin `reload` by `deepreload.reload` is deprecated and will be removed in IPython 6.0, please import `reload` explicitly from `IPython.lib.deeprelaod", DeprecationWarning)
60 warn("Automatically replacing builtin `reload` by `deepreload.reload` is deprecated since IPython 4.0, please import `reload` explicitly from `IPython.lib.deepreload", DeprecationWarning)
61 self.auto_builtins['reload'] = deepreload._dreload
61 self.auto_builtins['reload'] = deepreload._dreload
62 else:
62 else:
63 self.auto_builtins['dreload']= deepreload._dreload
63 self.auto_builtins['dreload']= deepreload._dreload
@@ -35,21 +35,6 b' from IPython.utils.py3compat import ('
35
35
36 class DisplayFormatter(Configurable):
36 class DisplayFormatter(Configurable):
37
37
38 # When set to true only the default plain text formatter will be used.
39 plain_text_only = Bool(False).tag(config=True)
40 def _plain_text_only_changed(self, name, old, new):
41 warnings.warn("""DisplayFormatter.plain_text_only is deprecated.
42
43 It will be removed in IPython 5.0
44
45 Use DisplayFormatter.active_types = ['text/plain']
46 for the same effect.
47 """, DeprecationWarning)
48 if new:
49 self.active_types = ['text/plain']
50 else:
51 self.active_types = self.format_types
52
53 active_types = List(Unicode(),
38 active_types = List(Unicode(),
54 help="""List of currently active mime-types to display.
39 help="""List of currently active mime-types to display.
55 You can use this to set a white-list for formats to display.
40 You can use this to set a white-list for formats to display.
@@ -643,14 +643,6 b' class InteractiveShell(SingletonConfigurable):'
643 # IPython at a time.
643 # IPython at a time.
644 builtin_mod.__dict__['__IPYTHON__'] = True
644 builtin_mod.__dict__['__IPYTHON__'] = True
645
645
646 # In 0.11 we introduced '__IPYTHON__active' as an integer we'd try to
647 # manage on enter/exit, but with all our shells it's virtually
648 # impossible to get all the cases right. We're leaving the name in for
649 # those who adapted their codes to check for this flag, but will
650 # eventually remove it after a few more releases.
651 builtin_mod.__dict__['__IPYTHON__active'] = \
652 'Deprecated, check for __IPYTHON__'
653
654 self.builtin_trap = BuiltinTrap(shell=self)
646 self.builtin_trap = BuiltinTrap(shell=self)
655
647
656 def init_inspector(self):
648 def init_inspector(self):
@@ -2019,10 +2011,9 b' class InteractiveShell(SingletonConfigurable):'
2019
2011
2020 # Expose as public API from the magics manager
2012 # Expose as public API from the magics manager
2021 self.register_magics = self.magics_manager.register
2013 self.register_magics = self.magics_manager.register
2022 self.define_magic = self.magics_manager.define_magic
2023
2014
2024 self.register_magics(m.AutoMagics, m.BasicMagics, m.CodeMagics,
2015 self.register_magics(m.AutoMagics, m.BasicMagics, m.CodeMagics,
2025 m.ConfigMagics, m.DeprecatedMagics, m.DisplayMagics, m.ExecutionMagics,
2016 m.ConfigMagics, m.DisplayMagics, m.ExecutionMagics,
2026 m.ExtensionMagics, m.HistoryMagics, m.LoggingMagics,
2017 m.ExtensionMagics, m.HistoryMagics, m.LoggingMagics,
2027 m.NamespaceMagics, m.OSMagics, m.PylabMagics, m.ScriptMagics,
2018 m.NamespaceMagics, m.OSMagics, m.PylabMagics, m.ScriptMagics,
2028 )
2019 )
@@ -426,25 +426,6 b' class MagicsManager(Configurable):'
426 setattr(self.user_magics, magic_name, func)
426 setattr(self.user_magics, magic_name, func)
427 record_magic(self.magics, magic_kind, magic_name, func)
427 record_magic(self.magics, magic_kind, magic_name, func)
428
428
429 def define_magic(self, name, func):
430 """[Deprecated] Expose own function as magic function for IPython.
431
432 Will be removed in IPython 5.0
433
434 Example::
435
436 def foo_impl(self, parameter_s=''):
437 'My very own magic!. (Use docstrings, IPython reads them).'
438 print 'Magic function. Passed parameter is between < >:'
439 print '<%s>' % parameter_s
440 print 'The self object is:', self
441
442 ip.define_magic('foo',foo_impl)
443 """
444 meth = types.MethodType(func, self.user_magics)
445 setattr(self.user_magics, name, meth)
446 record_magic(self.magics, 'line', name, meth)
447
448 def register_alias(self, alias_name, magic_name, magic_kind='line'):
429 def register_alias(self, alias_name, magic_name, magic_kind='line'):
449 """Register an alias to a magic function.
430 """Register an alias to a magic function.
450
431
@@ -17,7 +17,6 b' from .auto import AutoMagics'
17 from .basic import BasicMagics
17 from .basic import BasicMagics
18 from .code import CodeMagics, MacroToEdit
18 from .code import CodeMagics, MacroToEdit
19 from .config import ConfigMagics
19 from .config import ConfigMagics
20 from .deprecated import DeprecatedMagics
21 from .display import DisplayMagics
20 from .display import DisplayMagics
22 from .execution import ExecutionMagics
21 from .execution import ExecutionMagics
23 from .extension import ExtensionMagics
22 from .extension import ExtensionMagics
@@ -62,20 +62,6 b" addflag('color-info', 'InteractiveShell.color_info',"
62 colours.""",
62 colours.""",
63 "Disable using colors for info related things."
63 "Disable using colors for info related things."
64 )
64 )
65 addflag('deep-reload', 'InteractiveShell.deep_reload',
66 """ **Deprecated** and will be removed in IPython 5.0.
67
68 Enable deep (recursive) reloading by default. IPython can use the
69 deep_reload module which reloads changes in modules recursively (it
70 replaces the reload() function, so you don't need to change anything to
71 use it). deep_reload() forces a full reload of modules whose code may
72 have changed, which the default reload() function does not. When
73 deep_reload is off, IPython will use the normal reload(), but
74 deep_reload will still be available as dreload(). This feature is off
75 by default [which means that you have both normal reload() and
76 dreload()].""",
77 "Disable deep (recursive) reloading by default."
78 )
79 nosep_config = Config()
65 nosep_config = Config()
80 nosep_config.InteractiveShell.separate_in = ''
66 nosep_config.InteractiveShell.separate_in = ''
81 nosep_config.InteractiveShell.separate_out = ''
67 nosep_config.InteractiveShell.separate_out = ''
@@ -350,12 +350,12 b' def _dreload(module, **kwargs):'
350 import reload explicitly from `IPython.lib.deepreload` to use it
350 import reload explicitly from `IPython.lib.deepreload` to use it
351
351
352 """
352 """
353 # this was marked as deprecated and for 5.0 removal, but
354 # IPython.core_builtin_trap have a Deprecation warning for 6.0, so cannot
355 # remove that now.
353 warn("""
356 warn("""
354 injecting `dreload` in interactive namespace is deprecated, and will be removed in IPython 5.0.
357 injecting `dreload` in interactive namespace is deprecated since IPython 4.0.
355 Please import `reload` explicitly from `IPython.lib.deepreload`.
358 Please import `reload` explicitly from `IPython.lib.deepreload`.
356 """, DeprecationWarning, stacklevel=2)
359 """, DeprecationWarning, stacklevel=2)
357 reload(module, **kwargs)
360 reload(module, **kwargs)
358
361
359 # Uncomment the following to automatically activate deep reloading whenever
360 # this module is imported
361 #builtin_mod.reload = reload
@@ -89,8 +89,7 b' class InteractiveShellEmbed(TerminalInteractiveShell):'
89
89
90
90
91 if kw.get('user_global_ns', None) is not None:
91 if kw.get('user_global_ns', None) is not None:
92 warnings.warn("user_global_ns has been replaced by user_module. The\
92 raise DeprecationWarning("Key word argument `user_global_ns` has been replaced by `user_module` since IPython 4.0.")
93 parameter will be ignored, and removed in IPython 5.0", DeprecationWarning)
94
93
95 self._call_location_id = kw.pop('_call_location_id', None)
94 self._call_location_id = kw.pop('_call_location_id', None)
96
95
@@ -197,12 +196,10 b' class InteractiveShellEmbed(TerminalInteractiveShell):'
197 """
196 """
198
197
199 if (global_ns is not None) and (module is None):
198 if (global_ns is not None) and (module is None):
200 warnings.warn("global_ns is deprecated, and will be removed in IPython 5.0 use module instead.", DeprecationWarning)
199 raise DeprecationWarning("'global_ns' keyword argument is deprecated, and has been removed in IPython 5.0 use `module` keyword argument instead.")
201 module = DummyMod()
202 module.__dict__ = global_ns
203
200
204 if (display_banner is not None):
201 if (display_banner is not None):
205 warnings.warn("The display_banner parameter is deprecated.", DeprecationWarning)
202 warnings.warn("The display_banner parameter is deprecated since IPython 4.0", DeprecationWarning)
206
203
207 # Get locals and globals from caller
204 # Get locals and globals from caller
208 if ((local_ns is None or module is None or compile_flags is None)
205 if ((local_ns is None or module is None or compile_flags is None)
@@ -23,7 +23,9 b' from .py3compat import string_types, input, PY3'
23 @undoc
23 @undoc
24 class IOStream:
24 class IOStream:
25
25
26 def __init__(self,stream, fallback=None):
26 def __init__(self, stream, fallback=None):
27 warn('IOStream is deprecated since IPython 5.0, use sys.{stdin,stdout,stderr} instead',
28 DeprecationWarning, stacklevel=2)
27 if not hasattr(stream,'write') or not hasattr(stream,'flush'):
29 if not hasattr(stream,'write') or not hasattr(stream,'flush'):
28 if fallback is not None:
30 if fallback is not None:
29 stream = fallback
31 stream = fallback
@@ -44,7 +46,7 b' class IOStream:'
44 return tpl.format(mod=cls.__module__, cls=cls.__name__, args=self.stream)
46 return tpl.format(mod=cls.__module__, cls=cls.__name__, args=self.stream)
45
47
46 def write(self,data):
48 def write(self,data):
47 warn('IOStream is deprecated, use sys.{stdin,stdout,stderr} instead',
49 warn('IOStream is deprecated since IPython 5.0, use sys.{stdin,stdout,stderr} instead',
48 DeprecationWarning, stacklevel=2)
50 DeprecationWarning, stacklevel=2)
49 try:
51 try:
50 self._swrite(data)
52 self._swrite(data)
@@ -60,7 +62,7 b' class IOStream:'
60 file=sys.stderr)
62 file=sys.stderr)
61
63
62 def writelines(self, lines):
64 def writelines(self, lines):
63 warn('IOStream is deprecated, use sys.{stdin,stdout,stderr} instead',
65 warn('IOStream is deprecated since IPython 5.0, use sys.{stdin,stdout,stderr} instead',
64 DeprecationWarning, stacklevel=2)
66 DeprecationWarning, stacklevel=2)
65 if isinstance(lines, string_types):
67 if isinstance(lines, string_types):
66 lines = [lines]
68 lines = [lines]
@@ -11,7 +11,7 b' from __future__ import print_function'
11 import sys
11 import sys
12 import warnings
12 import warnings
13
13
14 warnings.warn("The module IPython.utils.warn is deprecated, use the standard warnings module instead", DeprecationWarning)
14 warnings.warn("The module IPython.utils.warn is deprecated since IPython 4.0, use the standard warnings module instead", DeprecationWarning)
15
15
16 def warn(msg,level=2,exit_val=1):
16 def warn(msg,level=2,exit_val=1):
17 """Standard warning printer. Gives formatting consistency.
17 """Standard warning printer. Gives formatting consistency.
@@ -30,7 +30,7 b' def warn(msg,level=2,exit_val=1):'
30 -exit_val (1): exit value returned by sys.exit() for a level 4
30 -exit_val (1): exit value returned by sys.exit() for a level 4
31 warning. Ignored for all other levels."""
31 warning. Ignored for all other levels."""
32
32
33 warnings.warn("The module IPython.utils.warn is deprecated, use the standard warnings module instead", DeprecationWarning)
33 warnings.warn("The module IPython.utils.warn is deprecated since IPython 4.0, use the standard warnings module instead", DeprecationWarning)
34 if level>0:
34 if level>0:
35 header = ['','','WARNING: ','ERROR: ','FATAL ERROR: ']
35 header = ['','','WARNING: ','ERROR: ','FATAL ERROR: ']
36 print(header[level], msg, sep='', file=sys.stderr)
36 print(header[level], msg, sep='', file=sys.stderr)
1 NO CONTENT: file was removed
NO CONTENT: file was removed
General Comments 0
You need to be logged in to leave comments. Login now