(
stream: t.BinaryIO,
encoding: str | None,
errors: str | None,
force_readable: bool = False,
force_writable: bool = False,
)
| 17 | |
| 18 | |
| 19 | def _make_text_stream( |
| 20 | stream: t.BinaryIO, |
| 21 | encoding: str | None, |
| 22 | errors: str | None, |
| 23 | force_readable: bool = False, |
| 24 | force_writable: bool = False, |
| 25 | ) -> t.TextIO: |
| 26 | if encoding is None: |
| 27 | encoding = get_best_encoding(stream) |
| 28 | if errors is None: |
| 29 | errors = "replace" |
| 30 | return _NonClosingTextIOWrapper( |
| 31 | stream, |
| 32 | encoding, |
| 33 | errors, |
| 34 | line_buffering=True, |
| 35 | force_readable=force_readable, |
| 36 | force_writable=force_writable, |
| 37 | ) |
| 38 | |
| 39 | |
| 40 | def is_ascii_encoding(encoding: str) -> bool: |
no test coverage detected