MCPcopy Create free account
hub / github.com/ipython/ipython / __init__

Method __init__

IPython/utils/io.py:24–44  ·  view source on GitHub ↗
(self, stream, fallback=None)

Source from the content-addressed store, hash-verified

22class IOStream:
23
24 def __init__(self, stream, fallback=None):
25 warn('IOStream is deprecated since IPython 5.0, use sys.{stdin,stdout,stderr} instead',
26 DeprecationWarning, stacklevel=2)
27 if not hasattr(stream,'write') or not hasattr(stream,'flush'):
28 if fallback is not None:
29 stream = fallback
30 else:
31 raise ValueError("fallback required, but not specified")
32 self.stream = stream
33 self._swrite = stream.write
34
35 # clone all methods not overridden:
36 def clone(meth):
37 return not hasattr(self, meth) and not meth.startswith('_')
38 for meth in filter(clone, dir(stream)):
39 try:
40 val = getattr(stream, meth)
41 except AttributeError:
42 pass
43 else:
44 setattr(self, meth, val)
45
46 def __repr__(self):
47 cls = self.__class__

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected