Skip to content

Commit

Permalink
Fix: python2 compatible
Browse files Browse the repository at this point in the history
  • Loading branch information
xjasonlyu committed Dec 17, 2023
1 parent db453e7 commit 37ba459
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion MetaTube.bundle/Contents/Code/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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):
Expand Down

0 comments on commit 37ba459

Please sign in to comment.