StringIO that throws an exception when it's read from
| 621 | |
| 622 | |
| 623 | class WriteOnlyStringIO(io.StringIO): |
| 624 | """ StringIO that throws an exception when it's read from """ |
| 625 | |
| 626 | def read(self, *args, **kwargs): |
| 627 | raise IOError |
| 628 | |
| 629 | def readline(self, *args, **kwargs): |
| 630 | raise IOError |
| 631 | |
| 632 | def readlines(self, *args, **kwargs): |
| 633 | raise IOError |
| 634 | |
| 635 | def readable(self, *args, **kwargs): |
| 636 | """ Returns True if the IO object can be read. """ |
| 637 | return False |
| 638 | |
| 639 | |
| 640 | class redirect_stdin(contextlib._RedirectStream): # type: ignore |