StringIO that throws an exception when it's read from
| 140 | |
| 141 | |
| 142 | class WriteOnlyStringIO(io.StringIO): |
| 143 | """ StringIO that throws an exception when it's read from """ |
| 144 | |
| 145 | def read(self, *args, **kwargs): |
| 146 | raise IOError |
| 147 | |
| 148 | def readline(self, *args, **kwargs): |
| 149 | raise IOError |
| 150 | |
| 151 | def readlines(self, *args, **kwargs): |
| 152 | raise IOError |
| 153 | |
| 154 | def readable(self, *args, **kwargs): |
| 155 | """ Returns True if the IO object can be read. """ |
| 156 | return False |
| 157 | |
| 158 | |
| 159 | class redirect_stdin(contextlib._RedirectStream): # type: ignore |