diff --git a/IPython/core/interactiveshell.py b/IPython/core/interactiveshell.py index 4fdbbdc..cce24de 100644 --- a/IPython/core/interactiveshell.py +++ b/IPython/core/interactiveshell.py @@ -354,9 +354,10 @@ class InteractiveShell(SingletonConfigurable): @observe('prompt_in1', 'prompt_in2', 'prompt_out', 'prompt_pad_left') def _prompt_trait_changed(self, change): name = change['name'] - warn("InteractiveShell.{name} is deprecated since IPython 4.0 and ignored since 5.0, set TerminalInteractiveShell.prompts object directly.".format( - name=name) - ) + warn("InteractiveShell.{name} is deprecated since IPython 4.0" + " and ignored since 5.0, set TerminalInteractiveShell.prompts" + " object directly.".format(name=name)) + # protect against weird cases where self.config may not exist: show_rewritten_input = Bool(True, @@ -811,7 +812,7 @@ class InteractiveShell(SingletonConfigurable): if _warn_deprecated and (name in IPython.core.hooks.deprecated): alternative = IPython.core.hooks.deprecated[name] - warn("Hook {} is deprecated. Use {} instead.".format(name, alternative)) + warn("Hook {} is deprecated. Use {} instead.".format(name, alternative), stacklevel=2) if not dp: dp = IPython.core.hooks.CommandChainDispatcher() @@ -839,7 +840,7 @@ class InteractiveShell(SingletonConfigurable): Register a function for calling after code execution. """ warn("ip.register_post_execute is deprecated, use " - "ip.events.register('post_run_cell', func) instead.") + "ip.events.register('post_run_cell', func) instead.", stacklevel=2) self.events.register('post_run_cell', func) def _clear_warning_registry(self): diff --git a/IPython/utils/PyColorize.py b/IPython/utils/PyColorize.py index 50ce8e5..d4469f0 100644 --- a/IPython/utils/PyColorize.py +++ b/IPython/utils/PyColorize.py @@ -54,7 +54,7 @@ else: from StringIO import StringIO ############################################################################# -### Python Source Parser (does Hilighting) +### Python Source Parser (does Highlighting) ############################################################################# _KEYWORD = token.NT_OFFSET + 1 diff --git a/IPython/utils/daemonize.py b/IPython/utils/daemonize.py index a1bfaa1..0de3852 100644 --- a/IPython/utils/daemonize.py +++ b/IPython/utils/daemonize.py @@ -1,4 +1,4 @@ from warnings import warn -warn("IPython.utils.daemonize has moved to ipyparallel.apps.daemonize") +warn("IPython.utils.daemonize has moved to ipyparallel.apps.daemonize", stacklevel=2) from ipyparallel.apps.daemonize import daemonize diff --git a/IPython/utils/eventful.py b/IPython/utils/eventful.py index 9f904ae..661851e 100644 --- a/IPython/utils/eventful.py +++ b/IPython/utils/eventful.py @@ -1,6 +1,6 @@ from warnings import warn -warn("IPython.utils.eventful has moved to traitlets.eventful") +warn("IPython.utils.eventful has moved to traitlets.eventful", stacklevel=2) from traitlets.eventful import * diff --git a/IPython/utils/io.py b/IPython/utils/io.py index 6e86670..5c2dec1 100644 --- a/IPython/utils/io.py +++ b/IPython/utils/io.py @@ -207,7 +207,7 @@ def temp_pyfile(src, ext='.py'): def atomic_writing(*args, **kwargs): """DEPRECATED: moved to notebook.services.contents.fileio""" - warn("IPython.utils.io.atomic_writing has moved to notebook.services.contents.fileio") + warn("IPython.utils.io.atomic_writing has moved to notebook.services.contents.fileio", stacklevel=2) from notebook.services.contents.fileio import atomic_writing return atomic_writing(*args, **kwargs) @@ -234,6 +234,6 @@ rprinte = raw_print_err def unicode_std_stream(stream='stdout'): """DEPRECATED, moved to nbconvert.utils.io""" - warn("IPython.utils.io.unicode_std_stream has moved to nbconvert.utils.io") + warn("IPython.utils.io.unicode_std_stream has moved to nbconvert.utils.io", stacklevel=2) from nbconvert.utils.io import unicode_std_stream return unicode_std_stream(stream) diff --git a/IPython/utils/jsonutil.py b/IPython/utils/jsonutil.py index c3ee938..2672e09 100644 --- a/IPython/utils/jsonutil.py +++ b/IPython/utils/jsonutil.py @@ -1,5 +1,5 @@ from warnings import warn -warn("IPython.utils.jsonutil has moved to jupyter_client.jsonutil") +warn("IPython.utils.jsonutil has moved to jupyter_client.jsonutil", stacklevel=2) from jupyter_client.jsonutil import * diff --git a/IPython/utils/localinterfaces.py b/IPython/utils/localinterfaces.py index 89b8fde..2f91122 100644 --- a/IPython/utils/localinterfaces.py +++ b/IPython/utils/localinterfaces.py @@ -1,5 +1,5 @@ from warnings import warn -warn("IPython.utils.localinterfaces has moved to jupyter_client.localinterfaces") +warn("IPython.utils.localinterfaces has moved to jupyter_client.localinterfaces", stacklevel=2) from jupyter_client.localinterfaces import * diff --git a/IPython/utils/log.py b/IPython/utils/log.py index 4c820dd..bb262ed 100644 --- a/IPython/utils/log.py +++ b/IPython/utils/log.py @@ -1,6 +1,6 @@ from warnings import warn -warn("IPython.utils.log has moved to traitlets.log") +warn("IPython.utils.log has moved to traitlets.log", stacklevel=2) from traitlets.log import * diff --git a/IPython/utils/pickleutil.py b/IPython/utils/pickleutil.py index 665ff09..785e6f6 100644 --- a/IPython/utils/pickleutil.py +++ b/IPython/utils/pickleutil.py @@ -1,5 +1,5 @@ from warnings import warn -warn("IPython.utils.pickleutil has moved to ipykernel.pickleutil") +warn("IPython.utils.pickleutil has moved to ipykernel.pickleutil", stacklevel=2) from ipykernel.pickleutil import * diff --git a/IPython/utils/traitlets.py b/IPython/utils/traitlets.py index 64b5937..2f979fa 100644 --- a/IPython/utils/traitlets.py +++ b/IPython/utils/traitlets.py @@ -1,6 +1,6 @@ from warnings import warn -warn("IPython.utils.traitlets has moved to a top-level traitlets package.") +warn("IPython.utils.traitlets has moved to a top-level traitlets package.", stacklevel=2) from traitlets import *