(f, mode)
| 134 | return |
| 135 | |
| 136 | def _reopen_stdio(f, mode): |
| 137 | if not hasattr(stream.buffer, "raw") and mode[0] == "w": |
| 138 | buffering = 0 |
| 139 | else: |
| 140 | buffering = -1 |
| 141 | |
| 142 | return io.TextIOWrapper( |
| 143 | open(os.dup(f.fileno()), mode, buffering), |
| 144 | f.encoding, |
| 145 | f.errors, |
| 146 | f.newlines, |
| 147 | f.line_buffering, |
| 148 | ) |
| 149 | |
| 150 | sys.stdin = _reopen_stdio(sys.stdin, "rb") |
| 151 | sys.stdout = _reopen_stdio(sys.stdout, "wb") |
no test coverage detected