From aae2a7328a4d28077a4b4182b4f36f19c953765b Mon Sep 17 00:00:00 2001 From: Vincent Driessen Date: Thu, 14 Apr 2016 12:38:53 +0200 Subject: Fix comment --- git/compat.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'git/compat.py') diff --git a/git/compat.py b/git/compat.py index 146bfd4b..1630fcd5 100644 --- a/git/compat.py +++ b/git/compat.py @@ -56,7 +56,9 @@ def safe_decode(s): return s elif isinstance(s, six.binary_type): if PRE_PY27: - return s.decode(defenc) # we're screwed + # Python 2.6 does not support the `errors` argument, so we cannot + # control the replacement of unsafe chars in it. + return s.decode(defenc) else: return s.decode(defenc, errors='replace') raise TypeError('Expected bytes or text, but got %r' % (s,)) -- cgit v1.2.3 From 6bdaa463f7c73d30d75d7ea954dd3c5c0c31617b Mon Sep 17 00:00:00 2001 From: Vincent Driessen Date: Thu, 14 Apr 2016 15:58:27 +0200 Subject: Drop dependency on six --- git/compat.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'git/compat.py') diff --git a/git/compat.py b/git/compat.py index 1630fcd5..f018ef33 100644 --- a/git/compat.py +++ b/git/compat.py @@ -8,7 +8,6 @@ # flake8: noqa import sys -import six from gitdb.utils.compat import ( PY3, @@ -34,6 +33,7 @@ if PY3: return bytes([n]) def mviter(d): return d.values() + range = xrange unicode = str else: FileType = file @@ -44,6 +44,7 @@ else: byte_ord = ord bchr = chr unicode = unicode + range = xrange def mviter(d): return d.itervalues() @@ -52,9 +53,9 @@ PRE_PY27 = sys.version_info < (2, 7) def safe_decode(s): """Safely decodes a binary string to unicode""" - if isinstance(s, six.text_type): + if isinstance(s, unicode): return s - elif isinstance(s, six.binary_type): + elif isinstance(s, bytes): if PRE_PY27: # Python 2.6 does not support the `errors` argument, so we cannot # control the replacement of unsafe chars in it. -- cgit v1.2.3 From 722473e86e64405ac5eb9cb43133f8953d6c65d0 Mon Sep 17 00:00:00 2001 From: Vincent Driessen Date: Tue, 19 Apr 2016 21:34:24 +0200 Subject: Remove Python 2.6 hack Since support was dropped. --- git/compat.py | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) (limited to 'git/compat.py') diff --git a/git/compat.py b/git/compat.py index f018ef33..7bd8e494 100644 --- a/git/compat.py +++ b/git/compat.py @@ -48,20 +48,13 @@ else: def mviter(d): return d.itervalues() -PRE_PY27 = sys.version_info < (2, 7) - def safe_decode(s): """Safely decodes a binary string to unicode""" if isinstance(s, unicode): return s elif isinstance(s, bytes): - if PRE_PY27: - # Python 2.6 does not support the `errors` argument, so we cannot - # control the replacement of unsafe chars in it. - return s.decode(defenc) - else: - return s.decode(defenc, errors='replace') + return s.decode(defenc, errors='replace') raise TypeError('Expected bytes or text, but got %r' % (s,)) -- cgit v1.2.3