##// END OF EJS Templates
Add stacklevel=2 to warn function
Srinivas Reddy Thatiparthy -
Show More
@@ -354,9 +354,10 b' class InteractiveShell(SingletonConfigurable):'
354 @observe('prompt_in1', 'prompt_in2', 'prompt_out', 'prompt_pad_left')
354 @observe('prompt_in1', 'prompt_in2', 'prompt_out', 'prompt_pad_left')
355 def _prompt_trait_changed(self, change):
355 def _prompt_trait_changed(self, change):
356 name = change['name']
356 name = change['name']
357 warn("InteractiveShell.{name} is deprecated since IPython 4.0 and ignored since 5.0, set TerminalInteractiveShell.prompts object directly.".format(
357 warn("InteractiveShell.{name} is deprecated since IPython 4.0"
358 name=name)
358 " and ignored since 5.0, set TerminalInteractiveShell.prompts"
359 )
359 " object directly.".format(name=name))
360
360 # protect against weird cases where self.config may not exist:
361 # protect against weird cases where self.config may not exist:
361
362
362 show_rewritten_input = Bool(True,
363 show_rewritten_input = Bool(True,
@@ -811,7 +812,7 b' class InteractiveShell(SingletonConfigurable):'
811
812
812 if _warn_deprecated and (name in IPython.core.hooks.deprecated):
813 if _warn_deprecated and (name in IPython.core.hooks.deprecated):
813 alternative = IPython.core.hooks.deprecated[name]
814 alternative = IPython.core.hooks.deprecated[name]
814 warn("Hook {} is deprecated. Use {} instead.".format(name, alternative))
815 warn("Hook {} is deprecated. Use {} instead.".format(name, alternative), stacklevel=2)
815
816
816 if not dp:
817 if not dp:
817 dp = IPython.core.hooks.CommandChainDispatcher()
818 dp = IPython.core.hooks.CommandChainDispatcher()
@@ -839,7 +840,7 b' class InteractiveShell(SingletonConfigurable):'
839 Register a function for calling after code execution.
840 Register a function for calling after code execution.
840 """
841 """
841 warn("ip.register_post_execute is deprecated, use "
842 warn("ip.register_post_execute is deprecated, use "
842 "ip.events.register('post_run_cell', func) instead.")
843 "ip.events.register('post_run_cell', func) instead.", stacklevel=2)
843 self.events.register('post_run_cell', func)
844 self.events.register('post_run_cell', func)
844
845
845 def _clear_warning_registry(self):
846 def _clear_warning_registry(self):
@@ -54,7 +54,7 b' else:'
54 from StringIO import StringIO
54 from StringIO import StringIO
55
55
56 #############################################################################
56 #############################################################################
57 ### Python Source Parser (does Hilighting)
57 ### Python Source Parser (does Highlighting)
58 #############################################################################
58 #############################################################################
59
59
60 _KEYWORD = token.NT_OFFSET + 1
60 _KEYWORD = token.NT_OFFSET + 1
@@ -1,4 +1,4 b''
1 from warnings import warn
1 from warnings import warn
2
2
3 warn("IPython.utils.daemonize has moved to ipyparallel.apps.daemonize")
3 warn("IPython.utils.daemonize has moved to ipyparallel.apps.daemonize", stacklevel=2)
4 from ipyparallel.apps.daemonize import daemonize
4 from ipyparallel.apps.daemonize import daemonize
@@ -1,6 +1,6 b''
1
1
2 from warnings import warn
2 from warnings import warn
3
3
4 warn("IPython.utils.eventful has moved to traitlets.eventful")
4 warn("IPython.utils.eventful has moved to traitlets.eventful", stacklevel=2)
5
5
6 from traitlets.eventful import *
6 from traitlets.eventful import *
@@ -207,7 +207,7 b" def temp_pyfile(src, ext='.py'):"
207
207
208 def atomic_writing(*args, **kwargs):
208 def atomic_writing(*args, **kwargs):
209 """DEPRECATED: moved to notebook.services.contents.fileio"""
209 """DEPRECATED: moved to notebook.services.contents.fileio"""
210 warn("IPython.utils.io.atomic_writing has moved to notebook.services.contents.fileio")
210 warn("IPython.utils.io.atomic_writing has moved to notebook.services.contents.fileio", stacklevel=2)
211 from notebook.services.contents.fileio import atomic_writing
211 from notebook.services.contents.fileio import atomic_writing
212 return atomic_writing(*args, **kwargs)
212 return atomic_writing(*args, **kwargs)
213
213
@@ -234,6 +234,6 b' rprinte = raw_print_err'
234
234
235 def unicode_std_stream(stream='stdout'):
235 def unicode_std_stream(stream='stdout'):
236 """DEPRECATED, moved to nbconvert.utils.io"""
236 """DEPRECATED, moved to nbconvert.utils.io"""
237 warn("IPython.utils.io.unicode_std_stream has moved to nbconvert.utils.io")
237 warn("IPython.utils.io.unicode_std_stream has moved to nbconvert.utils.io", stacklevel=2)
238 from nbconvert.utils.io import unicode_std_stream
238 from nbconvert.utils.io import unicode_std_stream
239 return unicode_std_stream(stream)
239 return unicode_std_stream(stream)
@@ -1,5 +1,5 b''
1 from warnings import warn
1 from warnings import warn
2
2
3 warn("IPython.utils.jsonutil has moved to jupyter_client.jsonutil")
3 warn("IPython.utils.jsonutil has moved to jupyter_client.jsonutil", stacklevel=2)
4
4
5 from jupyter_client.jsonutil import *
5 from jupyter_client.jsonutil import *
@@ -1,5 +1,5 b''
1 from warnings import warn
1 from warnings import warn
2
2
3 warn("IPython.utils.localinterfaces has moved to jupyter_client.localinterfaces")
3 warn("IPython.utils.localinterfaces has moved to jupyter_client.localinterfaces", stacklevel=2)
4
4
5 from jupyter_client.localinterfaces import *
5 from jupyter_client.localinterfaces import *
@@ -1,6 +1,6 b''
1
1
2 from warnings import warn
2 from warnings import warn
3
3
4 warn("IPython.utils.log has moved to traitlets.log")
4 warn("IPython.utils.log has moved to traitlets.log", stacklevel=2)
5
5
6 from traitlets.log import *
6 from traitlets.log import *
@@ -1,5 +1,5 b''
1 from warnings import warn
1 from warnings import warn
2
2
3 warn("IPython.utils.pickleutil has moved to ipykernel.pickleutil")
3 warn("IPython.utils.pickleutil has moved to ipykernel.pickleutil", stacklevel=2)
4
4
5 from ipykernel.pickleutil import *
5 from ipykernel.pickleutil import *
@@ -1,6 +1,6 b''
1
1
2 from warnings import warn
2 from warnings import warn
3
3
4 warn("IPython.utils.traitlets has moved to a top-level traitlets package.")
4 warn("IPython.utils.traitlets has moved to a top-level traitlets package.", stacklevel=2)
5
5
6 from traitlets import *
6 from traitlets import *
General Comments 0
You need to be logged in to leave comments. Login now