StringIO that throws an exception when it's read from
| 151 | |
| 152 | |
| 153 | class WriteOnlyStringIO(io.StringIO): |
| 154 | """StringIO that throws an exception when it's read from""" |
| 155 | |
| 156 | def read(self, *args, **kwargs): |
| 157 | raise OSError |
| 158 | |
| 159 | def readline(self, *args, **kwargs): |
| 160 | raise OSError |
| 161 | |
| 162 | def readlines(self, *args, **kwargs): |
| 163 | raise OSError |
| 164 | |
| 165 | def readable(self, *args, **kwargs): |
| 166 | """Returns True if the IO object can be read.""" |
| 167 | return False |
| 168 | |
| 169 | |
| 170 | class redirect_stdin(contextlib._RedirectStream): # type: ignore |