Decode bytes from binary input streams. Defaults to decoding from 'latin1'. Parameters ---------- line : str or bytes Line to be decoded. encoding : str Encoding used to decode `line`. Returns ------- decoded_line : str
(line, encoding=None)
| 11 | |
| 12 | |
| 13 | def _decode_line(line, encoding=None): |
| 14 | """Decode bytes from binary input streams. |
| 15 | |
| 16 | Defaults to decoding from 'latin1'. |
| 17 | |
| 18 | Parameters |
| 19 | ---------- |
| 20 | line : str or bytes |
| 21 | Line to be decoded. |
| 22 | encoding : str |
| 23 | Encoding used to decode `line`. |
| 24 | |
| 25 | Returns |
| 26 | ------- |
| 27 | decoded_line : str |
| 28 | |
| 29 | """ |
| 30 | if type(line) is bytes: |
| 31 | if encoding is None: |
| 32 | encoding = "latin1" |
| 33 | line = line.decode(encoding) |
| 34 | |
| 35 | return line |
| 36 | |
| 37 | |
| 38 | def _is_string_like(obj): |
no test coverage detected
searching dependent graphs…