[meld/Python3] misc: Remove unused fallback_decode()
- From: Kai Willadsen <kaiw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [meld/Python3] misc: Remove unused fallback_decode()
- Date: Sun, 24 Jul 2016 01:48:37 +0000 (UTC)
commit e8bfd114101c805d6999c5378f0f717f85cae8e2
Author: Kai Willadsen <kai willadsen gmail com>
Date: Sun Jul 24 11:26:55 2016 +1000
misc: Remove unused fallback_decode()
meld/misc.py | 25 -------------------------
1 files changed, 0 insertions(+), 25 deletions(-)
---
diff --git a/meld/misc.py b/meld/misc.py
index dd10a9f..a9945c4 100644
--- a/meld/misc.py
+++ b/meld/misc.py
@@ -230,31 +230,6 @@ def gdk_to_cairo_color(color):
return (color.red / 65535., color.green / 65535., color.blue / 65535.)
-def fallback_decode(bytestring, encodings, lossy=False):
- """Try and decode bytes according to multiple encodings
-
- Generally, this should be used for best-effort decoding, when the
- desired behaviour is "probably this, or UTF-8".
-
- If lossy is True, then decode errors will be replaced. This may be
- reasonable when the string is for display only.
- """
- if isinstance(bytestring, str):
- return bytestring
-
- for encoding in encodings:
- try:
- return bytestring.decode(encoding)
- except UnicodeDecodeError:
- pass
-
- if lossy:
- return bytestring.decode(encoding, errors='replace')
-
- raise ValueError(
- "Couldn't decode %r as one of %r" % (bytestring, encodings))
-
-
def all_same(lst):
"""Return True if all elements of the list are equal"""
return not lst or lst.count(lst[0]) == len(lst)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]