Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 33883d8

Browse files
committed
Merge pull request #9504 from Carreau/cleanup-deprecated-features
Cleanup deprecated features
2 parents 30a7e8c + 94e7434 commit 33883d8

12 files changed

Lines changed: 16 additions & 133 deletions

File tree

IPython/__init__.py

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -144,14 +144,3 @@ def start_kernel(argv=None, **kwargs):
144144
from IPython.kernel.zmq.kernelapp import launch_new_instance
145145
return launch_new_instance(argv=argv, **kwargs)
146146

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-

IPython/core/builtin_trap.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ def __init__(self, shell=None):
5757
from IPython.lib import deepreload
5858
if self.shell.deep_reload:
5959
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)
6161
self.auto_builtins['reload'] = deepreload._dreload
6262
else:
6363
self.auto_builtins['dreload']= deepreload._dreload

IPython/core/formatters.py

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -35,21 +35,6 @@
3535

3636
class DisplayFormatter(Configurable):
3737

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-
5338
active_types = List(Unicode(),
5439
help="""List of currently active mime-types to display.
5540
You can use this to set a white-list for formats to display.

IPython/core/interactiveshell.py

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -643,14 +643,6 @@ def init_builtins(self):
643643
# IPython at a time.
644644
builtin_mod.__dict__['__IPYTHON__'] = True
645645

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-
654646
self.builtin_trap = BuiltinTrap(shell=self)
655647

656648
def init_inspector(self):
@@ -2019,10 +2011,9 @@ def init_magics(self):
20192011

20202012
# Expose as public API from the magics manager
20212013
self.register_magics = self.magics_manager.register
2022-
self.define_magic = self.magics_manager.define_magic
20232014

20242015
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,
20262017
m.ExtensionMagics, m.HistoryMagics, m.LoggingMagics,
20272018
m.NamespaceMagics, m.OSMagics, m.PylabMagics, m.ScriptMagics,
20282019
)

IPython/core/magic.py

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -426,25 +426,6 @@ def register_function(self, func, magic_kind='line', magic_name=None):
426426
setattr(self.user_magics, magic_name, func)
427427
record_magic(self.magics, magic_kind, magic_name, func)
428428

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-
448429
def register_alias(self, alias_name, magic_name, magic_kind='line'):
449430
"""Register an alias to a magic function.
450431

IPython/core/magics/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
from .basic import BasicMagics
1818
from .code import CodeMagics, MacroToEdit
1919
from .config import ConfigMagics
20-
from .deprecated import DeprecatedMagics
2120
from .display import DisplayMagics
2221
from .execution import ExecutionMagics
2322
from .extension import ExtensionMagics

IPython/core/magics/deprecated.py

Lines changed: 0 additions & 47 deletions
This file was deleted.

IPython/core/shellapp.py

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -62,20 +62,6 @@
6262
colours.""",
6363
"Disable using colors for info related things."
6464
)
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-
)
7965
nosep_config = Config()
8066
nosep_config.InteractiveShell.separate_in = ''
8167
nosep_config.InteractiveShell.separate_out = ''

IPython/lib/deepreload.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -350,12 +350,12 @@ def _dreload(module, **kwargs):
350350
import reload explicitly from `IPython.lib.deepreload` to use it
351351
352352
"""
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.
353356
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.
355358
Please import `reload` explicitly from `IPython.lib.deepreload`.
356359
""", DeprecationWarning, stacklevel=2)
357360
reload(module, **kwargs)
358361

359-
# Uncomment the following to automatically activate deep reloading whenever
360-
# this module is imported
361-
#builtin_mod.reload = reload

IPython/terminal/embed.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,7 @@ def __init__(self, **kw):
8989

9090

9191
if kw.get('user_global_ns', None) is not None:
92-
warnings.warn("user_global_ns has been replaced by user_module. The\
93-
parameter will be ignored, and removed in IPython 5.0", DeprecationWarning)
92+
raise DeprecationWarning("Key word argument `user_global_ns` has been replaced by `user_module` since IPython 4.0.")
9493

9594
self._call_location_id = kw.pop('_call_location_id', None)
9695

@@ -197,12 +196,10 @@ def mainloop(self, local_ns=None, module=None, stack_depth=0,
197196
"""
198197

199198
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)
201-
module = DummyMod()
202-
module.__dict__ = global_ns
199+
raise DeprecationWarning("'global_ns' keyword argument is deprecated, and has been removed in IPython 5.0 use `module` keyword argument instead.")
203200

204201
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)
206203

207204
# Get locals and globals from caller
208205
if ((local_ns is None or module is None or compile_flags is None)

0 commit comments

Comments
 (0)