(bytes_: bytes)
| 22 | |
| 23 | |
| 24 | def _try_decode(bytes_: bytes) -> str: |
| 25 | try: |
| 26 | return bytes_.decode("utf-8") |
| 27 | except UnicodeDecodeError: |
| 28 | pass |
| 29 | |
| 30 | charset_match = from_bytes(bytes_).best() |
| 31 | if charset_match is None: |
| 32 | raise CharacterSetDecodeError() |
| 33 | try: |
| 34 | return bytes_.decode(charset_match.encoding) |
| 35 | except UnicodeDecodeError as e: |
| 36 | raise CharacterSetDecodeError() from e |
| 37 | |
| 38 | |
| 39 | def _popen( |
no test coverage detected