StringIO that throws an exception when it's read from
| 79 | |
| 80 | |
| 81 | class WriteOnlyStringIO(io.StringIO): |
| 82 | """StringIO that throws an exception when it's read from""" |
| 83 | |
| 84 | def read(self, *args, **kwargs): |
| 85 | raise IOError |
| 86 | |
| 87 | def readline(self, *args, **kwargs): |
| 88 | raise IOError |
| 89 | |
| 90 | def readlines(self, *args, **kwargs): |
| 91 | raise IOError |
| 92 | |
| 93 | def readable(self, *args, **kwargs): |
| 94 | """Returns True if the IO object can be read.""" |
| 95 | return False |
| 96 | |
| 97 | |
| 98 | class redirect_stdin(contextlib._RedirectStream): # type: ignore |