##// END OF EJS Templates
Be more explicit in some deprecation warnings
Matthias Bussonnier -
Show More
@@ -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]
General Comments 0
You need to be logged in to leave comments. Login now