StringIO that throws an exception when it's read from
| 439 | |
| 440 | |
| 441 | class WriteOnlyStringIO(io.StringIO): |
| 442 | """ StringIO that throws an exception when it's read from """ |
| 443 | |
| 444 | def read(self, *args, **kwargs): |
| 445 | raise IOError |
| 446 | |
| 447 | def readline(self, *args, **kwargs): |
| 448 | raise IOError |
| 449 | |
| 450 | def readlines(self, *args, **kwargs): |
| 451 | raise IOError |
| 452 | |
| 453 | def readable(self, *args, **kwargs): |
| 454 | """ Returns True if the IO object can be read. """ |
| 455 | return False |
| 456 | |
| 457 | |
| 458 | class redirect_stdin(contextlib._RedirectStream): # type: ignore |