(f, mode)
| 106 | return |
| 107 | |
| 108 | def _reopen_stdio(f, mode): |
| 109 | if not buffered and mode[0] == "w": |
| 110 | buffering = 0 |
| 111 | else: |
| 112 | buffering = -1 |
| 113 | |
| 114 | return io.TextIOWrapper( |
| 115 | open(os.dup(f.fileno()), mode, buffering), # type: ignore[arg-type] |
| 116 | f.encoding, |
| 117 | f.errors, |
| 118 | f.newlines, |
| 119 | f.line_buffering, |
| 120 | ) |
| 121 | |
| 122 | sys.stdin = _reopen_stdio(sys.stdin, "rb") |
| 123 | sys.stdout = _reopen_stdio(sys.stdout, "wb") |
no test coverage detected