diff options
author | Harmon <Harmon758@gmail.com> | 2020-02-07 05:31:39 -0600 |
---|---|---|
committer | Sebastian Thiel <sebastian.thiel@icloud.com> | 2020-02-08 10:55:50 +0800 |
commit | e50ee0a0370fcd45a9889e00f26c62fb8f6fa44e (patch) | |
tree | e26d48a3ae7cd277415d06b13db75e88ce7c4512 /git/compat.py | |
parent | c5f3c586e0f06df7ee0fc81289c93d393ea21776 (diff) | |
download | gitpython-e50ee0a0370fcd45a9889e00f26c62fb8f6fa44e.tar.gz |
Remove and replace compat.bytes_chr
Diffstat (limited to 'git/compat.py')
-rw-r--r-- | git/compat.py | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/git/compat.py b/git/compat.py index b048e16e..c9ba7a8a 100644 --- a/git/compat.py +++ b/git/compat.py @@ -117,11 +117,6 @@ def b(data): return data.encode('latin1') return data -if PY3: - bytes_chr = lambda code: bytes((code,)) -else: - bytes_chr = chr - def surrogateescape_handler(exc): """ Pure Python implementation of the PEP 383: the "surrogateescape" error @@ -216,9 +211,9 @@ def encodefilename(fn): for index, ch in enumerate(fn): code = ord(ch) if code < 128: - ch = bytes_chr(code) + ch = bytes((code,)) elif 0xDC80 <= code <= 0xDCFF: - ch = bytes_chr(code - 0xDC00) + ch = bytes((code - 0xDC00,)) else: raise UnicodeEncodeError(FS_ENCODING, fn, index, index+1, @@ -233,7 +228,7 @@ def encodefilename(fn): code = ord(ch) if 0xD800 <= code <= 0xDFFF: if 0xDC80 <= code <= 0xDCFF: - ch = bytes_chr(code - 0xDC00) + ch = bytes((code - 0xDC00,)) encoded.append(ch) else: raise UnicodeEncodeError( |