From 37ba4599d0b0c6780e2539f9ec01ae95c1d25120 Mon Sep 17 00:00:00 2001 From: xjasonlyu Date: Sun, 17 Dec 2023 18:08:50 -0500 Subject: [PATCH] Fix: python2 compatible --- MetaTube.bundle/Contents/Code/utils.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/MetaTube.bundle/Contents/Code/utils.py b/MetaTube.bundle/Contents/Code/utils.py index e15ee56..9e1127c 100644 --- a/MetaTube.bundle/Contents/Code/utils.py +++ b/MetaTube.bundle/Contents/Code/utils.py @@ -15,6 +15,8 @@ # Python 3 compatible code if sys.version_info.major == 3: unicode = str + # noinspection PyShadowingBuiltins + filter = lambda f, t: u''.join(i for i in t if f(i)) # Based on an answer by John Machin on Stack Overflow: @@ -27,7 +29,7 @@ def is_valid_xml_char(i): 0x10000 <= c <= 0x10FFFF or c in (0x9, 0xA, 0xD)) - return u''.join(c for c in s if is_valid_xml_char(c)) + return filter(is_valid_xml_char, s) def safe_unicode(o):