diff options
author | Marcel Bargull <marcel.bargull@udo.edu> | 2018-06-16 08:13:29 +0200 |
---|---|---|
committer | Marcel Bargull <marcel.bargull@udo.edu> | 2018-06-16 08:13:29 +0200 |
commit | 13cd9b56e285a0ddf4c64e4c5347485bd9ec6546 (patch) | |
tree | 57fffc2464800635b134135fe85638bae8e201cb /reader.py | |
parent | 3dbf6566aa45bcf4306be162f4e20a9fbf120d1e (diff) | |
download | ruamel.yaml-13cd9b56e285a0ddf4c64e4c5347485bd9ec6546.tar.gz |
fix _get_non_printable_ascii for PY2
Diffstat (limited to 'reader.py')
-rw-r--r-- | reader.py | 7 |
1 files changed, 4 insertions, 3 deletions
@@ -201,12 +201,13 @@ class Reader(object): ) UNICODE_SIZE = 4 + _printable_ascii = ('\x09\x0A\x0D' + ''.join(map(chr, range(0x20, 0x7F)))).encode('ascii') + @classmethod - def _get_non_printable_ascii( - cls, data, printable=b'\x09\x0A\x0D' + bytes(range(0x20, 0x7E+1))): + def _get_non_printable_ascii(cls, data): # type: (Text, bytes) -> Union[None, Tuple[int, Text]] ascii_bytes = data.encode('ascii') - non_printables = ascii_bytes.translate(None, printable) + non_printables = ascii_bytes.translate(None, cls._printable_ascii) if not non_printables: return None non_printable = non_printables[:1] |