Attempt to decode a string of bytes.
(data: bytes)
| 72 | |
| 73 | |
| 74 | def attempt_decode(data: bytes) -> Union[str, bytes]: |
| 75 | """Attempt to decode a string of bytes.""" |
| 76 | try: |
| 77 | return data.decode() |
| 78 | except UnicodeDecodeError: |
| 79 | return data |
| 80 | |
| 81 | |
| 82 | def map_type(data: Any) -> "ctypes._CData": |
no test coverage detected