(self, stream, fallback=None)
| 22 | class 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__ |
nothing calls this directly
no outgoing calls
no test coverage detected